Why can't LuaLaTeX correctly print the MWE in question "memoir, remove space before chaptertitle", but XeLaTeX can compile it?

LuaLaTeX print a white box over the chapter number, but XeLaTeX print a white number over a gray background.

Note: The MWE on question 411722 does not include the recomended changes by Daleif to be compilable. These are:

At code line 11: Add a % at the end of '\end{tikzpicture}'
At code line 26: Add a % at the end of '\tikzchapnum{##1}'

LuaTeX does everything right (I guess), but you should be aware that setting color=white (you use the shorthand white) may have side effects, especially if you set a color beforehand. Use text=white and everything works as expected.


  \begin{tikzpicture}[overlay, inner sep=10pt, outer sep=0]
    \node[draw=white!80!black, fill=white!80!black,text=white,
    left, anchor=base east, scale=2, inner sep=4pt] (cn) at (\textwidth,0) {\chapnumfont \rmfamily \thechapter};
    \draw[white!80!black] (cn.south east) -- ++(-\textwidth, 0);
    \draw[red] (0,2) -- ++(0,-\textheight);
    \draw[red] (\textwidth,2) -- ++(0,-\textheight);


\chapter{First chapter}
  • Many thanks. I was not able to find this solution from the manual.
    – djnavas
    Jan 30 '18 at 8:11
  • @djnavas Sometimes it's pretty hard to find something in the TikZ manual ;)
    – TeXnician
    Jan 30 '18 at 8:16
  • 1
    could you expand on "does everything right" do you mean xelatex does "something wrong" ? As long as it is arguably documented (somewhere:-) what the behaviour should be then I can see either behaviour could be correct, but having different back ends do different things isn't that great if it could be avoided. Specifically do you know if the difference is in the tikz engine-specific code or is this a difference inherited from the color engine specific files? (+1 though, I failed to find this last night:-) Jan 30 '18 at 10:59
  • @DavidCarlisle It is documented that a color option overrides the text color and the draw color, so the colors would become white in the OP. And limiting the scope of the color change to the text seems to remove this problem (as I would expect following the documentation).
    – TeXnician
    Jan 30 '18 at 14:32
  • @david-carlisle: I report that pdfLaTeX, XeLaTeX and LuaLaTeX print a white number over a gray background with TikZ parameter 'text=white', but when the parameter is 'white', only XeLaTeX print a white number over grey background. The tikz instruction that have the parameter, is: \node[draw=white!80!black, fill=white!80!black, text=white, left, anchor=base east, scale=2, inner sep=4pt] (cn) at (\textwidth,0) {\chapnumfont \rmfamily \thechapter};
    – djnavas
    Jan 31 '18 at 19:05

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.