Template:FormatName: Difference between revisions

mNo edit summary
No edit summary
Tag: Manual revert
 
(29 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#lua:
{{#invoke:Common|FormatName|{{{1|==Greek Letters==
  replacements = {
{{Twocolumn|
  ["alpha"] = "α",
To display Greek letters, simply write "alpha", "beta", or "gamma", followed by a space.
  ["beta"] = "β",
|
  ["chi"]  = "χ",
ギリシャ文字を記述するには、alpha, beta, gamma とそのまま書いてください。
  ["delta"] = "δ",
}}
  ["Delta"] = "Δ",
; Example.
  ["epsilon"] = "ε",
* <nowiki>alpha</nowiki> &rarr; alpha
  ["zeta"] = "&zeta;",
* <nowiki>beta</nowiki> &rarr; beta
  ["phi"] = "&phi;",
* <nowiki>chi</nowiki> &rarr; chi
  ["gamma"] = "&gamma;",
* <nowiki>delta</nowiki> &rarr; delta
  ["Gamma"] = "&Gamma;",
* <nowiki>epsilon</nowiki> &rarr; epsilon
  ["eta"] = "&eta;",
* <nowiki>gamma</nowiki> &rarr; gamma
  ["kappa"] = "&kappa;",
* <nowiki>eta</nowiki> &rarr; eta
  ["lambda"] = "&lambda;",
* and so on.
  ["mu"] = "&mu;",
  ["nu"] = "&nu;",
  ["pi"] = "&pi;",
  ["Pi"] = "&Pi;",
  ["theta"] = "&theta;",
  ["tau"] = "&tau;",
  ["upsilon"] = "&upsilon;",
  ["Upsilon"] = "&Upsilon;",
  ["phi"] = "&phi;",
  ["psi"] = "&psi;",
  ["xi"] = "&xi;",
  ["omega"] = "&omega;",
  ["sigma"] = "&sigma;",
  }


  name = stdin:match("[^&]+")
==Super/subscripts==
  name = string.gsub (name, "%a+",  
{{Twocolumn|
  function (str)
Use " _ " for subscripts, " ^ " for superscripts. To add both, write " ^ " first (super-, then subscript). For only one letter, you can directly write the letter whereas for multiple letters, use { }. If without { }, at least one space is needed after the script.
    return replacements [str] or str
|
  end
下付文字は _ 上付き文字は ^ の後に書いてください。両方つけるときは、^ _ (上付き、下付き)の順番で書いてください。1文字の場合はそのまま記述し、複数文字の場合は、{ } でくくってください。{ }でくくらない場合は直後にスペース(空白)が必要です。
  )
}}
 
; Example.
  name = string.gsub( name, "_([%d.]+)^([%d.]+) ", '<span style="position:relative"><sub>%1</sub><span style="font-size:x-small;position:absolute;left:0px;top:-4px">%2</span></span>')
* <nowiki>D^2_1 (next word)</nowiki> &rarr; D^2_1 (next word)
  name = string.gsub( name, "^([%d.]+)_([%d.]+) ", '<span style="position:relative"><sup>%1</sup><span style="font-size:x-small;position:absolute;left:0px;top:5px">%2</span></span>')
* <nowiki>D^{20}_{10} (next word)</nowiki> &rarr; D^{20}_{10} (next word)
  name = string.gsub( name, "_(%d%d?) ", "<sub>%1</sub> " )
* <nowiki>D^1_{10000} (next word)</nowiki> &rarr; D^{1}_{10000} (next word)
  name = string.gsub( name, "^(%d%d?) ", "<sup>%1</sup> " )
* <nowiki>D^{10000}_1 (next word)</nowiki> &rarr; D^{10000}_{1} (next word)
  print(name)
* <nowiki>D^{10}_{10000} (next word)</nowiki> &rarr; D^{10}_{10000} (next word)
|{{{1|==Greek Letters==
* <nowiki>D_1</nowiki> &rarr; D_1
Write Alpha, Beta, or Gamma in lowercase.<br/>
* <nowiki>D^2</nowiki> &rarr; D^2
;Example. (in lowercase)
* <nowiki>Delta^{12.13}</nowiki> &rarr; Delta^{12.13}
* Alpha --> alpha <br/>
* Beta --> beta <br/>
* Gamma --> gamma <br/>
* Delta --> Delta<br/>
*
*
}}}}}
}}}}}
m m
n n
p p
P P
q q
t t
u u
U U
w w
x x
y y
z z

Latest revision as of 00:35, 30 January 2023

Greek Letters

To display Greek letters, simply write "alpha", "beta", or "gamma", followed by a space.

ギリシャ文字を記述するには、α, β, γ とそのまま書いてください。

Example.
  • alpha → α
  • beta → β
  • chi → χ
  • delta → δ
  • epsilon → ε
  • gamma → γ
  • eta → η
  • and so on.

Super/subscripts

Use " _ " for subscripts, " ^ " for superscripts. To add both, write " ^ " first (super-, then subscript). For only one letter, you can directly write the letter whereas for multiple letters, use { }. If without { }, at least one space is needed after the script.

下付文字は _ 上付き文字は ^ の後に書いてください。両方つけるときは、^ _ (上付き、下付き)の順番で書いてください。1文字の場合はそのまま記述し、複数文字の場合は、{ } でくくってください。{ }でくくらない場合は直後にスペース(空白)が必要です。

Example.
  • D^2_1 (next word) → D2
    1
     (next word)
  • D^{20}_{10} (next word) → D20
    10
       (next word)
  • D^1_{10000} (next word) → D1
    10000
          (next word)
  • D^{10000}_1 (next word) → D10000
    1
          (next word)
  • D^{10}_{10000} (next word) → D10
    10000
          (next word)
  • D_1 → D1
  • D^2 → D2
  • Delta^{12.13} → Δ12.13