4

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.
<to be read again> 
\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? – Ulrike Fischer 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) – Max Maier Jul 13 '16 at 8:47
  • 2
    @MaxMaier If you want to compose two other symbols, why asking for different ones? – egreg 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! – Max Maier Jul 14 '16 at 6:18
4

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.

enter image description here

  • 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) – David Carlisle 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. – egreg Jul 13 '16 at 10:14
  • to my eyes, the dot looks too high. – barbara beeton 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. – egreg 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.) – barbara beeton Jul 13 '16 at 15:55
3

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

enter image description here

\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 ⋅ – Ulrike Fischer 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. – Max Maier Jul 14 '16 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.