Fonts & Character SetsDirect Unicode Input of combined Math Diacritics in LuaLaTeX

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
simeonz
Posts: 2
Joined: Sun Oct 14, 2012 2:23 pm

Direct Unicode Input of combined Math Diacritics in LuaLaTeX

Post by simeonz »

Sorry for the multi-posting.

I am trying to typeset a document with combining diacritics in utf8 in math mode. I use LuaLaTex, which supports those in text mode. The following example illustrates the original issue:

Code: Select all

\documentclass{minimal}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\begin{document}
$v⃗$
\end{document}
The vector arrow (U+20D7) is completely lost in the output. In text mode it shows, but in math mode it is discarded from TeX's horizontal list altogether.

Then I tried the following:

Code: Select all

\documentclass{minimal}
\usepackage{unicode-math}
\setmathfont{XITS Math}
{
\catcode`\_=11\relax
\catcode`\:=11\relax
\gdef\SetMathCode#1#2{\um_set_mathcode:nnn{#1}{#2}\um_symfont_tl}
}
\SetMathCode{"20D7}\mathaccent
\begin{document}
$v⃗$
\end{document}
This code uses the unicode-math internal macro \um_set_mathcode:nnn, but it boils down essentially to \Umathcode. In this manner, I change the math family of the arrow to the previously loaded XITS font. The mapping of the diacritics (possibly some of the other characters) are not set up automatically by unicode-math, so it turns out I have to do it manually.

Now the arrow is typeset to the right of the accented "v" (as in the attachment.) You can probably guess that I wish it was typeset above the "v". The \vec macro and \Umathaccent can (and do) do this, but I am trying to make the formulas plain-text readable if possible. (And to this end I also use the Emacs quail system for input.)

I could try and make the codes for the accents and the other diacritics active, but they would have to precede the codes for the main glyphs, which would cause incorrect display in utf8 aware editors (since this is the opposite order of the one in the standard.)

Could you please advice?

My LuaTeX version is beta-0.70.2, TeX Live 2012, LaTeX2e <2011/06/27>

XITS font is version 1.105.

Thanks in advance
Attachments
test.pdf
The arrow protrudes to the right of the symbol.
(2.6 KiB) Downloaded 300 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

simeonz
Posts: 2
Joined: Sun Oct 14, 2012 2:23 pm

Direct Unicode Input of combined Math Diacritics in LuaLaTeX

Post by simeonz »

As I wrote in the stackexchange forum, the issue seems to be with the handling of the special top-accent glyph metric. It is supposed to be done as described in the "Math accent handling" section of the luatex manual. However, apparently, it is done in practice only for the \Umathaccent command, and erroneously omitted for combining characters. The text version of the font uses some other mechanism with horizontal offsets (called "bearings"?), and goes around this limitation.

I would like to ask if anyone knows if such suspect/potential issue would have to be addressed with the LuaTeX/LuaLaTeX core. Or is it more likely to be responsibility of the unicode-math package? I don't want to bother either devs exclusively, in vain. Is there a forum where I can discuss such issue, so as to get the relevant component identified first?
Post Reply