latex3 / unicode-math

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

`\symliteral` not resulting in correct output of literal input #615

Open jasperhabicht opened 1 year ago

jasperhabicht commented 1 year ago

The package manual (version 0.8q, 2020/01/31) says on page 12:

The \symliteral{⟨syms⟩} command can also be used, regardless of package setting, to force the style to match the literal input characters.

Hence, I would assume that if I set the package option to math-style=ISO, which renders uppercase latin letters (sans and serif) in italic, \symliteral{𝖤} (where 𝖤 is U+1D5A4, i.e. an upright glyph) should output an upright letter. However, the following example shows that this is not the case and the same (italic) glyph is printed twice in the output:

\documentclass{article} 
\usepackage[math-style=ISO]{unicode-math} 

\begin{document} 
$𝖤 \symliteral{𝖤}$ 
\end{document}

Which should be equivalent to:

\documentclass{article} 
\usepackage[math-style=ISO]{unicode-math} 

\begin{document} 
$\char"1D5A4 \symliteral{\char"1D5A4}$ 
\end{document}

image

From the description in the documentation I would assume that the second letter is printed upright.


By the way, I am not at all sure whether it is a good choice to have the package normalize letters from the "Mathematical Alphanumeric Symbols" Unicode block (and related glyphs), since these code points are designed to semantically distinguish different mathematical symbols. So, in my opinion, if the user enters a code point from this Unicode block directly, it should be kept this way, not matter what the setting of the document style is. But I take it that the package authors took into consideration a lot of aspects, so maybe the current choice is still tbe best.

davidcarlisle commented 1 year ago

I think it would be much more natural if the math-style option (and \symb..) only affected the mapping of the base plane to the math alphabets. The current default that a bold italic 𝒙 is typeset upright is hard to reconcile with the Unicode description and is at odds with mathml and other uses of the fonts where <mi mathvariant="anything">𝒙</mi> is always 𝒙 (math-style=literal doesn't really help here, as it prevents $xyz$ being math italic.)