# pdflatex endless loop and page headings wrong aligned with dateiliste/babel [closed]

In the following code the heading is wrong aligned if babel and dateiliste are loaded together. Furthermore the whole MWE goes into an endless loop if the first line is removed.

% remove to let pdflatex go into endless loop
\RequirePackage[l2tabu, orthodox]{nag}

\documentclass[english]{scrbook}
%

\usepackage{babel}     % <- remove to correct heading alignment
\usepackage{scrpage2}
\usepackage{dateiliste} % <- remove to correct heading alignment

% only for demonstration
\usepackage{blindtext}

\begin{document}

\frontmatter
\tableofcontents
\mainmatter
\blindtext[1]
\section{section}
\blindtext[5]

\end{document}


EDIT:

The system is Texlive 2012, all packages updated on windows 7.

The endless loop comes from dateiliste, \tracingall shows at the end these lines

\dateiliste@mainfile ->LaTeXTemplate.tex
\@filelist ->\@filelist
\@filelist ->\@filelist
...


which never stops

-

## closed as too localized by Martin Scharrer♦Oct 14 '12 at 7:02

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

Seems like a bug in dateilist –  egreg Oct 6 '12 at 16:58
I wrote the author already, but so far he did not answer any mail from me... –  Matthias Pospiech Oct 6 '12 at 17:45
Sorry, I tried to have a look to the code, but being the doc in German I can't understand what the code is supposed to accomplish. –  egreg Oct 6 '12 at 17:47
I think that \dateiliste@mainfile adds the main file (i.e. the file you are compiling) to the list of files. Somehow, something is putting that into a loop. Try \usepackage[noaddmain]{dateiliste} –  Scott H. Oct 6 '12 at 21:14
Indeed that solved the endless loop, but the wrong aligned headings still remains. Which was the reason I created the MWE in the first place. –  Matthias Pospiech Oct 7 '12 at 6:11

The incorrect placement of the running head is a bug in dateiliste.sty. Loading the babel package causes dateiliste to run the command \dateiliste@babel which in turn runs \addto on \extralanguage for a short list of languages including English. Unfortunately, a number of line endings in that code are not commented out, resulting in some extra spaces, and these work their way in to the page marks. This is apparent even with standard book, but below is a minimal example in your set-up. Note that \listfiles is added to the preamble to prevent dateiliste going into its infinite loop.

\documentclass[english]{scrbook}

\usepackage[a6paper]{geometry}
\usepackage{babel}

\usepackage{dateiliste}

\usepackage{blindtext}
\listfiles

\begin{document}

\mainmatter

\blindtext[2]

\end{document}


To correct this, copy dateiliste.sty to a new file and correct the definition of \dateiliste@babel so that lines end with % percent signs after closing brackets }. Below is the English part of that definition.

\newcommand*{\dateiliste@babel}{
\renewcommand*\fileListPreamble{%
Here is the list of all files used during the run of \LaTeX{}
which produced this document.\footnote{More precisely, it is
the list of files used one \LaTeX-run before the one which
produced this document, but after some runs the list
should stabilize.}
}%
\renewcommand*\fileListName{List of Files}%
\renewcommand*\fileNameName{file name}%
\renewcommand*\pageName{page}%
\renewcommand*\dateName{release date}%
\renewcommand*\verName{ver.}%
\renewcommand*\descriptionName{description}%
}%


Using the new style file gives the following output with the heading correctly flush left.

Alternatively, you can move the babel package after the dateiliste package, delete the offending hook and, if you need them, make the specific definitions:

\documentclass[english]{scrbook}

\usepackage[a6paper]{geometry}

\usepackage{dateiliste}
\usepackage{babel}
\makeatletter
\let\dateiliste@babel\relax  % Clear the hook
\makeatother

%% Make the English definitions
\renewcommand*\fileListPreamble{%
Here is the list of all files used during the run of \LaTeX{}
which produced this document.\footnote{More precisely, it is
the list of files used one \LaTeX-run before the one which
produced this document, but after some runs the list
should stabilize.}
}%
\renewcommand*\fileListName{List of Files}%
\renewcommand*\fileNameName{file name}%
\renewcommand*\pageName{page}%
\renewcommand*\dateName{release date}%
\renewcommand*\verName{ver.}%
\renewcommand*\descriptionName{description}%
%% End of English definitions

\usepackage{blindtext}
\listfiles

\begin{document}

\mainmatter

\blindtext[2]

\end{document}

-
Thanks for your analysis (and also to Markus Kohm, who notified me per mail of this question, and proposed a similar solution). I'll try to correct this and release a new version soon. –  Paŭlo Ebermann Oct 12 '12 at 19:10

Thanks to Matthias for reporting, and thanks to Andrew Swann and Markus Kohm (by mail to me) for analyzing the problems.

The header indenting problem was caused by Babel executing \extrasenglish at this location, and in this macro I did insert misplaced spaces (several of them) by not commenting out the line endings, as should always be done when doing "programming" (not typesetting) after the preamble. Looks like I didn't realize that this is actually executed inside the document, and I didn't really test my translation feature with headings switched on.

I commented out all the line endings in the respective parts of the package.

The endless loop comes from trying to manipulate \@filelist when it is actually undefined. This part of the program tried to remove \jobname.tex, from the file list before adding it again:

  \@expandtwoargs\@removeelement{\dateiliste@mainfile}%
\@filelist\@filelist


This occurs when you use this package (and don't give the [noaddmain] option) but forgot to include the \listfiles command in the preamble. Looks like I never considered this case, as the main goal of my package is to create a file list.

My solution now gives a warning in this case (and leaves out the whole manipulation of \@filelist).

I just uploaded version 0.6 to CTAN which should fix both problems.

-