# Bug in unicode-math or lualatex?

Consider the following minimal example:

\documentclass{article}

\usepackage{unicode-math}

\newcommand{\dotcup}{\ensuremath{\mathaccent\cdot\cup}}

\begin{document}
$a \dotcup b$
\end{document}


If compiled with lualatex I get the following error

This is LuaTeX, Version 0.95.0 (TeX Live 2016)
restricted system commands enabled.
(./min.tex
LaTeX2e <2016/03/31> patch level 2
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
...
! Missing number, treated as zero.
\cdot
l.8 $a \dotcup b$
...


On the other hand if I compile the example without unicode-math but with pdflatex, then I get the desired PDF file. Is this a bug in unicode-math or lualatex?

Edit: The command \dotcup is given as an example in the file symbols-a4.pdf where it serves as an example in order to center two symbols over each other. In the end, I am not interested in that particular symbol but in a composition of two other symbols where I receive the same error. That means, it served me as a general example in order to determine if this is a bug or intended behavior.

• Why are you using \cdot? Why not \dot\cup? Jul 13 '16 at 8:10
• @Ulrike Fischer, I took the example from the symbols-a4.pdf where it served as an example in order to center symbols over each other (p. 210) Jul 13 '16 at 8:47
• @MaxMaier If you want to compose two other symbols, why asking for different ones? Jul 13 '16 at 12:13
• @egreg Well I thought it would be a good idea to take a probably known example from a "standard" paper (symbols-a4.pdf). Actually, I didn't ask for these symbols, did I? Again, I was wondering about the error message if this has something to do with unicode-math or lualatex, i.e., if this is a bug or not. But I see your point. Next time I will phrase my question differently. Thanks for all your help! Jul 14 '16 at 6:18

The implementation of \mathaccent and \cdot are very different in legacy LaTeX and unicode-math.

\documentclass{article}

\usepackage{unicode-math}
\newcommand{\cdotaccent}{\Umathaccent fixed "7 "2 ⋅ }

\newcommand{\dotcup}{\mathbin{\cdotaccent\cup}}

\begin{document}
$a \dotcup b$
\end{document}


Of course \ensuremath is useless, whereas \mathbin gives the expected spacing.

• actually \mathaccent still seems to be the primitive (at least \show says \mathaccent=\mathaccent) but it seems to want a \Umathaccent spec anyway in the OPs context) Jul 13 '16 at 8:47
• @DavidCarlisle The problem is that \cdot is not defined via \Umathchardef, so it's not legal in the context of a number. Jul 13 '16 at 10:14
• to my eyes, the dot looks too high. Jul 13 '16 at 12:10
• @barbarabeeton Possibly, but the one in \cupdot is too low. Anyway, the OP says it's not really the required symbol. Jul 13 '16 at 12:12
• @egreg -- being eternally picky, i checked the monotype symbols list. the dot is definitely centered vertically -- as would be expected if both the cup and the dot are aligned on the math axis. (yes, i know that this was just a standin for a general formula, and that there's a formula for \dotcup in the comprehensive symbols list, but i believe the alignment-on-math-axis principle holds except in very special/exceptional cases, of which this isn't one.) Jul 13 '16 at 15:55

The usage is very odd (\mathaccent takes a number not a character as the specifier) although it sort of works if you give it a \mathchardef token as it re-interprets the mathcode as a mathaccent.

unicode-math changes the definition of \cdot (and most symbols) to be \let to the unicode character rather than a \mathchardef defined token, so it is not a valid number.

However even for pdftex the definition seems unfortunate as you probably want a \mathbin operator to use like \cup

I think you want U+228D (⊍) so

\documentclass{article}

\usepackage{unicode-math}

\begin{document}

$a \cupdot b$
\end{document}

• I don't think that there is a luatex bug. \cdot is (after \begin{document}!) no a \mathchar but a simple character: \cdot=the character ⋅ Jul 13 '16 at 10:10
• @Ulrike Fischer, thanks for your help! I took the example from the standard paper symbols-a4.pdf`. I'm actually looking for other symbols, it just served as an example for the problem with lualatex/unicode-math and mathaccent. That means, I was wondering if this is a bug in general or not. Jul 14 '16 at 6:23