Template:FormatName: Difference between revisions

No edit summary
mNo edit summary
Line 44: Line 44:
Write "alpha", "beta", or "gamma" in lowercase.
Write "alpha", "beta", or "gamma" in lowercase.
; Example.
; Example.
* "alpha" --> alpha
* <nowiki>alpha</nowiki> &rarr; alpha
* "beta" --> beta
* <nowiki>beta</nowiki> &rarr; beta
* "chi" --> chi
* <nowiki>chi</nowiki> &rarr; chi
* "delta" --> delta
* <nowiki>delta</nowiki> &rarr; delta
* "epsilon" --> epsilon
* <nowiki>epsilon</nowiki> &rarr; epsilon
* "gamma" --> gamma
* <nowiki>gamma</nowiki> &rarr; gamma
* "eta" --> eta
* <nowiki>eta</nowiki> &rarr; eta
* and so on.
* and so on.


==Super/subscripts==
==Super/subscripts==
Use "_" for subscripts, "^" for superscripts. To show both, write the longer super/sub-script first. Some word must follow after a space when both ^ and _ are used.
Use "_" for subscripts, "^" for superscripts. To show both, '''write the longer super/sub-script first'''. Some word must follow after a space when both ^ and _ are used.
; Example.
; Example.
* <nowiki>D_10^20 (next word)</nowiki> &rarr; D_1^2 (next word)
* <nowiki>D_10^20 (next word)</nowiki> &rarr; D_1^2 (next word)

Revision as of 02:15, 20 January 2010

{{#lua:

 replacements = {
 ["alpha"] = "α",
 ["beta"] = "β",
 ["chi"]  = "χ",
 ["delta"] = "δ",
 ["Delta"] = "Δ",
 ["epsilon"] = "ε",
 ["zeta"] = "ζ",
 ["phi"] = "φ",
 ["gamma"] = "γ",
 ["Gamma"] = "Γ",
 ["eta"] = "η",
 ["kappa"] = "κ",
 ["lambda"] = "λ", 
 ["mu"] = "μ", 
 ["nu"] = "ν", 
 ["pi"] = "π",
 ["Pi"] = "Π",
 ["theta"] = "θ",
 ["tau"] = "τ",
 ["upsilon"] = "υ",
 ["Upsilon"] = "Υ",
 ["phi"] = "φ",
 ["psi"] = "ψ",
 ["xi"] = "ξ",
 ["omega"] = "ω",
 ["sigma"] = "σ",
 }

---GREEK LETTERS---

 name = stdin:match(".+")
 name = string.gsub (name, '([%a"]+)', 
 function (str)
   return replacements[str] or str
 end
 )

---SUPER/SUBSCRIPTS---

 name = string.gsub( name, "_([%d.]+)^([%d.]+) ", '%1%2')
 name = string.gsub( name, "%^([%d.]+)_([%d.]+) ", '%1%2')
 name = string.gsub( name, "(%a)_([%d.]+)", "%1%2" )
 name = string.gsub( name, "(%a)^([%d.]+)", "%1%2" )
 print(name)

|==Greek Letters== Write "alpha", "beta", or "gamma" in lowercase.

Example.
  • alpha → alpha
  • beta → beta
  • chi → chi
  • delta → delta
  • epsilon → epsilon
  • gamma → gamma
  • eta → eta
  • and so on.

Super/subscripts

Use "_" for subscripts, "^" for superscripts. To show both, write the longer super/sub-script first. Some word must follow after a space when both ^ and _ are used.

Example.
  • D_10^20 (next word) → D_1^2 (next word)
  • D_10000^1 (next word) → D_10000^1 (next word)
  • D^10000_1 (next word) → D^10000_1 (next word)
  • D^10_10000 (bad example) → D^10_10000 (bad example)
  • D_1 → D_1
  • D^2 → D^2

}}