10

I'm working on a text that makes `pdflatex (from texlive) enter an infinite loop. After experimenting for a while I got a minimum working example, which I show below:

\documentclass{article}

\usepackage{biblatex}
\usepackage{hyperref}
\usepackage{exercise}
\usepackage{mathtools}
\usepackage{tkz-berge}

\begin{document}
\[
\begin{matrix}
  a
\end{matrix}
\]
\end{document}

If I remove any of the \usepackage{...} lines, texlive compiles the document normally. With them all, it enters an infinite loop when processing the matrix.

I added \tracingall after \begin{document}, and the result is this:

{changing \reserved@a=macro:->cccccccccccccccccccccccccccccc\ETC.}
{into \reserved@a=macro:->cccccccccccccccccccccccccccccc\ETC.}
{\advance}
{changing \count24=28952}
{into \count24=28951}
{\relax}
{\expandafter}
{\else: \ifnum (level 3) entered on line 14}
{\fi: \ifnum (level 3) entered on line 14}

\@iwhilenum #1->\ifnum #1\expandafter \@iwhilenum \else \expandafter \@gobble \
fi {#1}
#1<-\@tempcnta >\z@ \relax \edef \reserved@a {\reserved@a c}\advance \@tempcnta
 \m@ne \relax 
{\ifnum: (level 3) entered on line 14}
{true}
{\relax}
{\edef}

\reserved@a ->ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
...
ccccccccccccccccccccccccccccccccccccccc
{changing \reserved@a=macro:->cccccccccccccccccccccccccccccc\ETC.}
{into \reserved@a=macro:->cccccccccccccccccccccccccccccc\ETC.}

I am using texlive from Debian. This is version 2015.20150703-2. The version of biblatex is 2.7a-1 (also a Debian package)

What could be the source of this problem?

Thank you!

  • 1
    I can remove the tikz package, as it's loaded by tkz-berge... Just saying. – Werner Jul 5 '15 at 16:33
  • Ok, good point, I have removed the line loading tikz from the example. Thank you. – Jay Jul 5 '15 at 16:33
  • I can compile the example above without any issue (TL 2015, Linux): Off-topic: hyperref should be the last package to be loaded here, but it is necessary here at all (for this MWE), as well as the biblatex stuff – user31729 Jul 5 '15 at 16:37
  • It is not really texlive entering the loop, presumably, but some binary from the distribution. Could you clarify that? (e.g. which...) TeX Live is the whole caboodle. You are probably running pdflatex or latex or lualatex or.... – cfr Jul 5 '15 at 16:38
  • @cfr: I've just tried with any (...)latex from TL... ;-) No errors – user31729 Jul 5 '15 at 16:39
9

If you update etex.sty to version 2.3 (which will be reaching ctan mirrors in the next day or so) then the original document runs without error, but with a warning explaining the original problem. I have added a check for this case to the package.

Package etex Warning: Extended allocation already in use.
(etex)                etex.sty code will not be used.
(etex)                To force etex package to load, add
(etex)                \RequirePackage{etex}
(etex)                at the start of the document.

Original answer:

It doesn't loop if you do

\RequirePackage[2014/01/01]{latexrelease}
\documentclass{article}
\makeatletter

\usepackage{biblatex}
\usepackage{hyperref}
\usepackage{exercise}
\usepackage{mathtools}
\usepackage{tikz}
\usepackage{tkz-berge}
\tracingonline2
\begin{document}


\[
\tracingmacros2
\begin{matrix}
  a
\end{matrix}
\]
\end{document}

What is happening in the original is that etex.sty is being loaded after latex has already allocated registers and conflicts result in the counter holding the number of matrix columns being changed from 20 to 32768 and latex dies trying to make an array preamble with that many c....

  • But where is it? mathtools can be replaced by graphicx,amsmath, but the other order works! – daleif Jul 5 '15 at 16:53
  • The bug/interaction. It is interesting that replacing mathtools with amsmath,graphicx works, but graphicx,graphicx does not. (made a typo above) – daleif Jul 5 '15 at 16:58
  • 2
    tkz-berge can be replaced by etex, and the loop goes away when one loads etex earlier. – Ulrike Fischer Jul 5 '15 at 16:58
  • @DavidCarlisle is it obvious to the casual user that "at the start of the document" means before \documentclass? Some might even think it to be right after \begin{document} ` :-( – daleif Jul 8 '15 at 17:45
  • @daleif well for almost all classes, either works, so long as you do it before you have allocated 255 count registers. – David Carlisle Jul 8 '15 at 17:53

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.