aliftype / xits

XITS - OpenType implementation of STIX fonts with math support
SIL Open Font License 1.1
351 stars 35 forks source link

Add missing subscript letters #42

Closed phile314 closed 9 years ago

phile314 commented 9 years ago

XITS Math 7.1 is missing some of the subscript letters. It supports a,e,u,o,r,u,x. Missing are h,j,k,l,m,n,o,s,t.

Example tex file:

\documentclass{article}
\usepackage{agda}
\setmathfont{xits-math.otf}

\begin{document}
a $xₐ$\\
e $xₑ$\\
h $xₕ$\\
i $xᵢ$\\
j $xⱼ$\\
k $xₖ$\\
l $xₗ$\\
m $xₘ$\\
n $xₙ$\\
o $xₒ$\\
p $xₚ$\\
r $xᵣ$\\
s $xₛ$\\
t $xₜ$\\
u $xᵤ$\\
x $xₓ$\\
\end{document}

Resulting pdf when rendered with xelatex: http://files.314.ch/Test.pdf

See also https://en.wikipedia.org/wiki/Superscripts_and_Subscripts and http://www.unicode.org/charts/PDF/U2070.pdf

khaledhosny commented 9 years ago

What do you need them for? They are certainly not needed/used for math layout.

phile314 commented 9 years ago

The Agda programming language supports unicode for identifiers. This end up in Latex code, because there is a special literate Agda mode which allows mixing Agda code with latex. This can be exported to a proper Latex file with highlighting information for the Agda code.

Small literate Agda example (note the begin/end{code} commands):

.... snip ...
\begin{document}
\begin{code}
id : A → A
id xₕ = xₕ
\end{code}
\end{document}

This then gets translated into the following Latex code:

.... snip ...
\begin{document}
\begin{code}
... snip ....
\>\AgdaFunction{id} \AgdaBound{xₕ} \AgdaSymbol{=} \AgdaBound{xₕ}
... snip ....
\end{code}
\end{document}

There are some Agda* helper functions used here, but basically the xₕ name ends up being used in math mode.

It's quite common to use subscripts in the Agda programming language. There are some workarounds, but from my point of view adding the subscripts to XITS Math would be the best option.

asr commented 9 years ago

There are some workarounds, but from my point of view adding the subscripts to XITS Math would be the best option.

:+1:

khaledhosny commented 9 years ago

This is actually an issue with the unicode-math package, because XITS Math does not contain any of these subscript characters at all (they are used in linguistics not math, and also math requires arbitrary subscript support). What is happening is that unicode-math maps Unicode subscript and superscript characters to the equivalent LaTeX commands, so $xₐ$ is mapped to $x_a$, but it seems to base its mapping table to an old version of Unicode and the missing ones are relatively new additions to Unicode. As such I don’t think there anything to fix here.

khaledhosny commented 9 years ago

See https://github.com/wspr/unicode-math/blob/master/unicode-math.dtx#L3539-L3560 and https://github.com/wspr/unicode-math/blob/master/unicode-math.dtx#L3583-L3610, should be straightforward to extend.

phile314 commented 9 years ago

Thank you for your help, I will give that a go then.