latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
243 stars 28 forks source link

Difference between Unicode (α) and TeX (\alpha) input #412

Closed Socob closed 6 years ago

Socob commented 6 years ago

Using this minimal document:

\documentclass{scrartcl}

\usepackage{unicode-math}

\setmathfont[range=up/{greek,Greek,latin,Latin,num}]{FreeSans.otf}
\setmathfont[range=it/{greek,Greek,latin,Latin,num}]{FreeSansOblique.otf}
\setmathfont[range=bfup/{greek,Greek,latin,Latin,num}]{FreeSansBold.otf}
\setmathfont[range=bfit/{greek,Greek,latin,Latin,num}]{FreeSansBoldOblique.otf}
\setmathfont[range=\int]{Latin Modern Math}

\setmathfontface\mathrm{FreeSans.otf}
\setmathfontface\mathit{FreeSansOblique.otf}
\setmathfontface\mathbf{FreeSansBold.otf}

\begin{document}

\begin{tabular}{lll}
    math      & $          abcABC123αβΓΔ $
        & $          \alpha\beta\Gamma\Delta $ \\
    mathit    & $\mathit{  abcABC123αβΓΔ}$
        & $\mathit{  \alpha\beta\Gamma\Delta}$ \\
    mathrm    & $\mathrm{  abcABC123αβΓΔ}$
        & $\mathrm{  \alpha\beta\Gamma\Delta}$ \\
    mathup    & $\mathup{  abcABC123αβΓΔ}$
        & $\mathup{  \alpha\beta\Gamma\Delta}$ \\
    mathbf    & $\mathbf{  abcABC123αβΓΔ}$
        & $\mathbf{  \alpha\beta\Gamma\Delta}$ \\
    mathbfup  & $\mathbfup{abcABC123αβΓΔ}$
        & $\mathbfup{\alpha\beta\Gamma\Delta}$ \\
    mathbfit  & $\mathbfit{abcABC123αβΓΔ}$
        & $\mathbfit{\alpha\beta\Gamma\Delta}$ \\
\end{tabular}

\end{document}

I get the following output: test

If the Greek letters are input directly as Unicode, there are no problems, but using the TeX control sequences (\alpha, \beta etc.), there is no output.

(Also, the behavior of \mathbfup and \mathbfit is inconsistent compared to \mathup and \mathit, but I suppose that’s a consequence of #331 et al.)

Tested using unicode-math v0.8h, fontspec v2.6e.

wspr commented 6 years ago

As @hvoss49 says, the correct syntax here uses \symxx because of backwards compatibility concerns with traditional LaTeX. (Or you could load unicode-math with the mathrm=sym, mathit=sym, etc., package options.)

This is covered in §3.1 and §4.4.2, albeit not very coherently. Unfortunately I don't have the brain space to rewrite the docs here right now!