Zulip Chat Archive

Stream: general

Topic: weird LaTeX bug: fullpage + hyperref + listings on NixOS


Johan Commelin (Jan 24 2024 at 13:06):

Does the following LaTeX produce an error on your machine?

\documentclass{article}
\usepackage{lipsum}

\usepackage{amsmath,amssymb}
\usepackage{xcolor}

\definecolor{keywordcolor}{rgb}{0.7, 0.1, 0.1}   % red
\definecolor{tacticcolor}{rgb}{0.0, 0.1, 0.3}    % dark blue
\definecolor{commentcolor}{rgb}{0.4, 0.4, 0.4}   % grey
\definecolor{stringcolor}{rgb}{0.5, 0.3, 0.2}    % brown
\definecolor{symbolcolor}{rgb}{0.1, 0.2, 0.7}    % blue
\definecolor{sortcolor}{rgb}{0.1, 0.5, 0.1}      % green
\definecolor{attributecolor}{rgb}{0.7, 0.1, 0.1} % red
\definecolor{errorcolor}{rgb}{1, 0, 0}           % bright red

\usepackage{listings}
\def\lstlanguagefiles{lstlean.tex}
\lstloadlanguages{lean}
\lstset{language=lean}
\usepackage{scalefnt}




% When commenting out `fullpage', also change the filler text below.
\usepackage{fullpage}
\usepackage[unicode,colorlinks=true,linkcolor=blue,urlcolor=magenta, citecolor=blue]{hyperref}


\begin{document}

% Use the following filler text for testing without `\usepackage{fullpage}'

% \lipsum[1-4]
% \lipsum[2]
%
% Now we just need a tiny bit more filler text.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Use the following filler text for testing with `\usepackage{fullpage}'

\lipsum[1-7]

Now we just need a tiny bit more filler text.

Now we just need a tiny bit more filler text.

Now we just need a tiny bit more filler text.

Now we just need a tiny bit more filler text.

\begin{lstlisting}
  inductive Nat
  | zero : Nat
  | succ : Nat -> Nat
\end{lstlisting}

\end{document}

Johan Commelin (Jan 24 2024 at 13:06):

Without the fullpage + hyperref combo, I do not get an error. And the error occurs when there is a code block in a pagebreak.

Johan Commelin (Jan 24 2024 at 13:07):

Patrick Massot didn't have problems with this code. So it seems to depend on the precise versions of the packages involved.

Johan Commelin (Jan 24 2024 at 13:10):

  • listings 2020/03/24 1.8d
  • fullpage 1999/02/23 1.1
  • hyperref 2023-02-07 v7.00v

Yaël Dillies (Jan 24 2024 at 13:22):

I get

Package Listings: Couldn't load requested language.

Christian Merten (Jan 24 2024 at 19:18):

Both with and without fullpage compile fine for me.

Mauricio Collares (Jan 25 2024 at 14:49):

Yaël Dillies said:

I get

Package Listings: Couldn't load requested language.

You need to save https://raw.githubusercontent.com/leanprover/lean4/master/doc/latex/lstlean.tex in the same directory as the above TeX file.

Mauricio Collares (Jan 25 2024 at 14:52):

I get

! Argument of  has an extra }.
<inserted text>
                \par
l.56
       | succ : Nat -> Nat

both with and without the fullpage package (with the appropriate fillers) when compiling with pdflatex. xelatex works fine in both cases.

Kevin Buzzard (Jan 26 2024 at 22:05):

Is there a reason you're not using minted instead?

Eric Wieser (Jan 26 2024 at 22:16):

The latest minted is a pain to use with Lean 4 until lean4#3125 can be merged (which is waiting on an upstream release)

Shreyas Srinivas (Jan 26 2024 at 22:16):

Can minted be used in overleaf?

Eric Wieser (Jan 26 2024 at 22:16):

(old versions of minted are ok)

Eric Wieser (Jan 26 2024 at 22:17):

Yes, it works fine in overleaf

Eric Wieser (Jan 26 2024 at 22:17):

Overleaf makes it easy to use old minted too (use TeXLive 2022 or maybe it was 2021)

Mauricio Collares (Jan 29 2024 at 11:21):

Just upgraded to TeXLive 2023.20240114 on NixOS, and I still see the same problem. Package versions:

listings 1.9 (2023/02/27)
fullpage 1.1 (1999/02/23)
hyperref v7.01g (2023-11-26)


Last updated: May 02 2025 at 03:31 UTC