In the MWE below, a pdflatex
compilation (texlive 2020 and 2021) gives an error of type Extra \else
.
The problem disappears
- when I add an extra group around the
\smash
(e.g.{\smash{TTT}}
) - or if I add or subtract a couple of lines of text here and there in the body.
This last fact makes the issue very difficult to debug for me, since small changes may cause the problem to appear or disappear.
The tex source looks licit to me: I use a couple of well-known packages, define a header with a special value for the first page, and the body is only text with two wrapfigure
environments. If there are no errors (please correct me if I'm wrong), I think that there might be some unexpected interaction between the packages around page breaks.
Any suggestion on how I should go on to debug this?
\documentclass{article}
\usepackage{wrapfig}
\usepackage{amsmath}
\makeatletter
% Special header on first page
\def\ps@mine{%
\def\@oddhead{%
\ifnum\value{page}=1%
\smash{TTT}%
\else FFF%
\fi}%
}
\makeatother
\pagestyle{mine}
\begin{document}
hi
\clearpage
Earum minus doloremque tempora aut et fugiat. Iste est in non
asperiores. Laborum aut necessitatibus dolor aspernatur facilis fuga
possimus. Alias ab quo laboriosam fugit sed voluptatem ut. In ut amet
non facilis excepturi.
Ut libero velit vel voluptatem nulla. Et et et et cum id et. Harum
nisi sit doloribus tempore quae occaecati. Est harum et nesciunt
laborum rerum.
Odit magnam inventore explicabo doloribus enim asperiores
provident. Aut ea nam non et nesciunt quasi quo. Inventore ut sed
nulla et voluptatibus ullam dicta.
Odit magnam inventore explicabo doloribus enim asperiores
provident. Aut ea nam non et nesciunt quasi quo. Inventore ut sed
nulla et voluptatibus ullam dicta.
Odit magnam inventore explicabo doloribus enim asperiores
provident. Aut ea nam non et nesciunt quasi quo. Inventore ut sed
nulla et voluptatibus ullam dicta.
\begin{wrapfigure}{R}{0.5\textwidth}
F1\vspace{2in}
\end{wrapfigure}
xxxxx xxxxxxxxx xxx xxxxxxxx xx xxx xxxxx xxxxxx xx xxx
xxxxxxxxxx xxx xxx xx xxx xxxxxxx xx xxxxxx xxxx xxxx xxx xxxxxxx
xxxxxxxx xxx xxxxxx xxxxx. Xxxxx xxxxxxx xxxxxxxx xxxxxxxxx xxxx
xxxxx xxxx xx xxxx xxxxxxxxxx, xxxxx xxxx xxxxxxxxx. Xxx xxxx
xxxxxxx xx xxx xxxxx xx xxxxxxx xxxxxxxxx, xxxxxxxxxx xx
xxx-XxX xxxxxxxx xxx xxxxxxx xxxxx xxx xxxxx.
Xxxx, xxxx xxx xxxxxx xxxxx xxx xxx xx xx xxxxxxxxxxx
xxxx xx xxx xx xxx xxxxxxxxxxxx xxxxx xxx. Xxxx xxxxx xxxxxxx
xxxxxxxx xxxxxxx xxxxxxxxx xx xxxxxx xxxxxxxx xxxxx xxxx xxx xxxxxxx
xxxxxx xxxxxx xxxxxxxx xxx xxxxxxxxxxx xxxxxxxx xxxxxxxxxx.
Xxxxxxxxxxx xxxxxxxxx xxx xxxxxxxx xxxxxxxxxx xxx xx xxxxx xxxxxxxxxx
xxxxxx xxxx x xxxx xxxxx xx xxxxxxxx, xxxx xxxx xx XxX xx xx xxxxxxxx
xx XxX. Xxxxxxxxx xxx xxxxxxx xx xxxxxxxxxx xxx Xxxxx xxxxxxx
xxxxxxxxxxx, xxxxx xxxxxxx x xxxx xxxxx xx xxxxxxxxxxx xxxxxxxxx
xxxxxx xxxxxxxx xxx xxxxxxxx, xxxx xxxx xx
xx
\begin{wrapfigure}{R}{0.5\textwidth}
F2\vspace{2in}
\end{wrapfigure}
Quidem eum voluptates voluptatem fugiat et. Reprehenderit earum
adipisci veritatis aut reprehenderit. Minus ab culpa quasi minima quia
consectetur fuga aut.
Molestiae animi qui ab quo consectetur id saepe. Cumque eius
blanditiis nobis reprehenderit. Voluptates temporibus necessitatibus
odio adipisci ipsa. Quo quidem provident dignissimos iure id. Rem aut
quas perferendis.
Earum minus doloremque tempora aut et fugiat. Iste est in non
asperiores. Laborum aut necessitatibus dolor aspernatur facilis fuga
possimus. Alias ab quo laboriosam fugit sed voluptatem ut. In ut amet
non facilis excepturi.
Ut libero velit vel voluptatem nulla. Et et et et cum id et. Harum
nisi sit doloribus tempore quae occaecati. Est harum et nesciunt
laborum rerum.
\end{document}
=1%
should be=1
or=\@ne
with the percent the\smash
will expand before the test is made.%
after the1
in the\ifnum
line can cause trouble because that causes TeX to keep looking for an additional numeric value, and\smash
surely isn't numeric. Either insert a space before the%
or get rid of it.