9

How do I resolve the "lualatex.exe assertion failed" popups? (I can on the Ignore tab to get out of it)

This beautiful solution, provided by Heiko Oberdiek, to the question How to typeset an isomorphism symbol ($\simeq$) with a long bar works perfectly under pdflatex, xelatex and previous release of lualatex. But under the latest release of lualatex (texlive 2016) it causes a popup message of assertion failure. The popup seems to occur at the statement

  \sbox0{\lower1.9\dimen@\hbox{$\m@th#1\relbar\isomorphism@joinrel\relbar$}}%

MWE:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{article}

\makeatletter
\newcommand*{\isomorphism}{%
  \mathrel{%
    \mathpalette\@isomorphism{}%
  }%
}
\newcommand*{\@isomorphism}[2]{%
% Calculate the amount of moving \sim up as in \simeq
  \sbox0{$#1\simeq$}%
  \sbox2{$#1\sim$}%
  \dimen@=\ht0 %
  \advance\dimen@ by -\ht2 %
%----------------------------
% Compose the two symbols
%----------------------------
  \sbox0{%
    \lower1.9\dimen@\hbox{%
      $\m@th#1\relbar\isomorphism@joinrel\relbar$%
    }%
  }%
  \rlap{%
    \hbox to \wd0{%
      \hfill\raise\dimen@\hbox{$\m@th#1\sim$}\hfill
    }%
  }%
  \copy0 %
}
\newcommand*{\isomorphism@joinrel}{%
  \mathrel{%
    \mkern-3.4mu %
    \mkern-1mu %
    \nonscript\mkern1mu %
  }%
}
\makeatother
\begin{document}
\[ A \isomorphism B^{C \isomorphism D^{E \isomorphism F}} \]
\end{document}
F Quayson
  • 131
  • You say TeX Live, but you have tagged it MikTeX. Which are you using? If this is even relevant... – cfr Dec 12 '16 at 03:43
  • OK. It doesn't like \noscript + kern in \mathrel{} without something else. So giving it something else fixes the problem. Or, rather, works around the problem. This should probably be reported if it looks like a bug i.e. if the original code is kosher. (Which it should be given its author ;).) – cfr Dec 12 '16 at 04:15
  • It is clearly a bug in the binary -- you shouldn't get such a dialog even if you do nonsense in your document. But as it works in miktex (which has already luatex 1.0) it is possible that the bug has been resolved. @davidcarlisle could test it. – Ulrike Fischer Dec 12 '16 at 09:34
  • @UlrikeFischer I get a core dump with luatex 1.01. I'll report of luatex list – David Carlisle Dec 12 '16 at 09:55
  • Reported at http://tug.org/pipermail/luatex/2016-December/006288.html – David Carlisle Dec 12 '16 at 10:02
  • @Martin why add the windows tag? (it was all platforms as far as I can see) – David Carlisle Dec 12 '16 at 17:26
  • @DavidCarlisle Certainly Linux. – cfr Dec 12 '16 at 22:06

3 Answers3

5

It seems to work if the second symbol is consumed as an argument when joining it to the first. Tested with pdfLaTeX and LuaLaTeX (more-or-less current TeX Live 2016).

Just don't ask me to explain why LuaLaTeX doesn't like the original version, whereas pdfLaTeX does ...

\documentclass{article}

\makeatletter
\newcommand*{\isomorphism}{%
  \mathrel{%
    \mathpalette\@isomorphism{}%
  }%
}
\newcommand*{\@isomorphism}[2]{%
% Calculate the amount of moving \sim up as in \simeq
  \sbox0{$#1\simeq$}%
  \sbox2{$#1\sim$}%
  \dimen@=\ht0 %
  \advance\dimen@ by -\ht2 %
%----------------------------
% Compose the two symbols
%----------------------------
  \sbox0{%
    \lower1.9\dimen@\hbox{%
      $\m@th#1\relbar\isomorphism@joinrel\relbar$%
    }%
  }%
  \rlap{%
    \hbox to \wd0{%
      \hfill\raise\dimen@\hbox{$\m@th#1\sim$}\hfill
    }%
  }%
  \copy0 %
}
\newcommand*{\isomorphism@joinrel}[1]{%
  \mathrel{%
    \mkern-3.4mu %
    \mkern-1mu %
    \nonscript\mkern1mu %
    #1
  }%
}
\makeatother
\begin{document}
\[ A \isomorphism B^{C \isomorphism D^{E \isomorphism F}} \]
\end{document}

LuaTeX fix

cfr
  • 198,882
5

This is fixed in revision 6174 of the luatex sources, committed today. It may take a while to appear in TeX distributions, the workarounds in the other answers can be used until then.

David Carlisle
  • 757,742
3

Apparently a bug in LuaTeX 0.95, which doesn't like a \nonscript item in that place.

You can solve it by reversing the order of the items:

\newcommand*{\isomorphism@joinrel}{%
  \mathrel{%
    \mkern-3.4mu
    \nonscript\mkern1mu
    \mkern-1mu
  }%
}

A more general and safe workaround is to add a zero math kern after a \nonscript item that happens to fall at the end of a math list (or sublist), which seems to be the only case triggering the bug:

\nonscript\mkern<mudimen>\mkern0mu

or

\nonscript\mskip<muskip>\mkern0mu

Math kerns have no impact on the detection of math atoms and in the automatically inserted spaces between them.

egreg
  • 1,121,712
  • Accept all the answers (cfr's and egreg's and David's permanent fix - looking forward to the new texlive/miktex distributions). Do employ the macro quite a lot in my developing document (at thirty different locations with a minor modification: replacing the two \relbar macros with a space and \rightarrow, respectively). Now the document compiles a lot faster than before... Excellent, CFR, David and egreg. – F Quayson Dec 13 '16 at 05:49