Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 

















Template:Italics correction/calc






Dansk

 

Edit links
 









Template
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 





Permanently protected template

From Wikipedia, the free encyclopedia
 

< Template:Italics correction

0.1em

Examples:

Because it does not know what font is in use on the user's browser, it is a much cruder approximation than TeX's "italic correction" macro \/, but it's still better than a fixed space.

The primary application is mathematics, where italic letters are often followed by a close parenthesis, superscript, or prime symbol. Thus, the Latin and Greek alphabets are covered, but not the entire Unicode space. Some Hebrew and Cyrillic characters could be added as required.

Full list of characters
Italic text {{mvar}} Italic text {{mvar}} Italic text {{mvar}}
Bare +pad Bare +pad Bare +pad Bare +pad Bare +pad Bare +pad
aA aA aA aA rR rR rR rR ι′ Ι′ ι Ι ι′ Ι′ ι Ι
bB bB bB bB sS sS sS sS κ′ Κ′ κ Κ κ′ Κ′ κ Κ
cC cC cC cC tT tT tT tT λ′ Λ′ λ Λ λ′ Λ′ λ Λ
∂′dD dD ∂′dD dD uU uU uU uU μ′ Μ′ μ Μ μ′ Μ′ μ Μ
eE eE eE eE vV vV vV vV ν′ Ν′ ν Ν ν′ Ν′ ν Ν
fF fF fF fF wW wW wW wW ξ′ Ξ′ ξ Ξ ξ′ Ξ′ ξ Ξ
gG gG gG gG xX xX xX xX ο′ Ο′ ο Ο ο′ Ο′ ο Ο
hH hH hH hH yY yY yY yY ϖ′π′ Π′ ϖπ Π ϖ′π′ Π′ ϖ′π Π
iI iI iI iI zZ zZ zZ zZ ϱ′ρ′ Ρ′ ϱρ Ρ ϱ′ρ′ Ρ′ ϱρ Ρ
jJ jJ jJ jJ α′ Α′ α Α α′ Α′ α Α ς′σ′ Σ′ ςσ Σ ς′σ′ Σ′ ςσ Σ
kK kK kK kK β′ Β′ β Β β′ Β′ β Β τ′ Τ′ τ Τ τ′ Τ′ τ Τ
l′ℓ′L lL l′ℓ′L lL γ′ Γ′ γ Γ γ′ Γ′ γ Γ υ′ Υ′ϒ′ υ Υϒ υ′ Υ′ϒ′ υ Υϒ
mM mM mM mM δ′ Δ′ δ Δ δ′ Δ′ δ Δ φ′ϕ′ Φ′ φϕ Φ φ′ϕ′ Φ′ φϕ Φ
nN nN nN nN ε′ϵ′ Ε′ εϵ Ε ε′ϵ′ Ε′ εϵ Ε χ′ Χ′ χ Χ χ′ Χ′ χ Χ
oO oO oO oO ζ′ Ζ′ ζ Ζ ζ′ Ζ′ ζ Ζ ψ′ Ψ′ ψ Ψ ψ′ Ψ′ ψ Ψ
pP pP pP pP η′ Η′ η Η η′ Η′ η Η ω′ Ω′ ω Ω ω′ Ω′ ω Ω
qQ qQ qQ qQ ϑ′θ′ Θ′ ϑθ Θ ϑ′θ′ Θ′ ϑθ Θ
Implementation
It's just a big 109-way #switch statement. For the sake of efficiency (this is likely to be used many times on a page), letters which take the same amount of space are grouped together, and the groups are sorted so the most common ones come first.
I tried
{{#switch:0
|{{#expr:not{{#invoke:String|find|dijkrtvwxyzCDEFGHIJKMNUVWXYZγδζξϖπστΕΖΗΙΚΜΝΞΠΣΥϒΧΨ|{{{1}}}}}}}=0.1em
|{{#expr:not{{#invoke:String|find|cgsuBGOPQRSαβϑθκμνςυχψωΒΘΟΡΩ|{{{1}}}}}}}=0.05em
|{{#expr:not{{#invoke:String|find|ab∂ehmnopqALεϵηιλοϱρφϕΑΔΛΦ|{{{1}}}}}}}=0em
|{{#expr:not{{#invoke:String|find|flTΓΤ|{{{1}}}}}}}=0.15em
|0=0.1em
}}

to reduce the number of cases in the #switch, but that was clearly slower. (The large table makes this documentation page a good benchmark!)

One significant limitation of this template is that it does not accept characters in HTML entity form. While it could be extended to accept |&alpha;or|&#945;or|&#x3B1;, adding all those forms would really bloat the #switch.


Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Italics_correction/calc&oldid=1158255376"

Hidden category: 
Wikipedia semi-protected templates
 



This page was last edited on 2 June 2023, at 22:38 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki