tectonic-typesetting / tectonic

A modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX and TeXLive.
https://tectonic-typesetting.github.io/
Other
3.85k stars 159 forks source link

Fix breaking vertical space in `fancyhdr` #1110

Closed Neved4 closed 8 months ago

Neved4 commented 8 months ago

While accommodating around ≈27K lines of LaTeX I was greeted by an ominous:

! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
error: tfg.tex:10: LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help
Type  H <return>  for immediate help.
 ...                                              

l.10 \end{document}

No pages of output.
Transcript written on tfg.log.
error: halted on potentially-recoverable error as specified

So after much reversing and taming the beast, I stumbled upon the offending code: a line break with extra vertical space.

MWE

\documentclass{article}

\RequirePackage{fancyhdr}
  \fancyfoot[C]{\\[2ex] foo}
                % ^ replace \\[2ex] with \vspace{2ex} to make it compile
\begin{document}
  \pagestyle{fancy}
  bar
\end{document}

The code works on pdfTeX/XeTeX/LuaTeX as of TeX Live 2023. It doesn't under current tectonic. Could be due to something in TeX Live that'll get naturally resolved with the upgrade to 2023. Using \vspace instead just works. Not a high priority, but it was a strange find.

rm-dr commented 8 months ago

I'm surprised that's valid LaTeX. \\[2ex] just looks... Wrong.

I just tested this, and it seems that this isn't a tectonic problem. It's a TeXlive 2022 problem, which doesn't seem to support that odd macro. I tried building with my TeXlive 2023 bundle, and everything worked.

This will work once this is resolved and a TeXlive 2023 bundle is published.

Neved4 commented 8 months ago

@rm-dr There's some ways where you might be forced to use \\[<unit>] instead of \vspace

this isn't a tectonic problem. It's a TeXlive 2022 problem

That seems the case, thx for the follow-up! Closing, upgrade will resolve it naturally.