zcash / zips

Zcash Improvement Proposals
https://zips.z.cash
MIT License
273 stars 156 forks source link

Make the spec build correctly with LuaLaTeX and XeLaTeX #249

Open daira opened 5 years ago

daira commented 5 years ago

The protocol spec does build under LuaLaTeX and XeLaTeX, using the -lualatex or -xelatex option to latexmk. (XeTeX doesn't support the interpolate option to \includegraphics, but it builds if that is removed.) However the output has some problems:

Building correctly with LuaLaTeX and XeLaTeX is useful not so much for its own sake, but because some (not all) of these issues probably indicate areas where we are relying on bug-for-bug compatibility with pdflatex.

daira commented 5 years ago

interpolate no longer seems to make any appreciable difference, so I've removed it. I think that when I originally added it, the images were too low resolution, and/or pdfsizeopt (which is no longer used) was reducing them too much.

daira commented 5 years ago

The font substitutions were fixed by adding \fontencoding{T1} to places where I explicitly select the font using \selectfont, a described at https://tex.stackexchange.com/a/426300/78411 . (As pointed out by David Carlisle here, XeLaTeX is designed for use with TU fonts and so T1 works less well for things like hyphenation, but as it happens, I don't need line-breaking anywhere I'm using \selectfont.)

This didn't work for the use of \fontseries{b} in the \textbnx macro, but \textbnx was negligibly different fom \textbf so I replaced it with the latter.

daira commented 5 years ago

The rest of the spacing and size issues seem to be due to the main document font, Quattrocento, being given incorrect metrics by the quattrocento package when loaded by LuaLaTeX or XeLaTex. In LuaLaTeX this can be worked around to some extent as described here. I've added a variant of this workaround, and now the spec mostly builds correctly in LuaLaTeX.

daira commented 5 years ago

Further changes (4eed11f9256e176ccf4c20a8977e2f9e43d1373e) were needed to make this work under TeXLive 2019. (The -lualatex and -xelatex options apparently regressed and no longer work, so alternative options were required.)