Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

It is known that references require an additional run of LaTeX and that these references may depend on BibTeX, which in turn depends on at least one previous compilation of the document source. I have also encountered a statement on the web that certain LaTeX source files might require more compilations.

This makes me curious: What coding patterns (or nestings thereof) will increase the required number of latex runs to generate the final document? Ideally an answer will be a coding pattern (or set of coding patterns) that can be used to increase the number of required compilations by 1.

There are two reasons for asking:

  1. As long as I am not using one of the tools mentioned in the references mentioned in related questions about automated LaTeX (re)compilation (e.g., here and here), I might want to know the answer without needing to inspect the log-file. (On how to properly do that, see my other question here.)
  2. Just as a fun intellectual exercise, it would be interesting to know how to (recursively or otherwise) generate LaTeX source files requiring an arbitrary number of compilations. (For this specific question I have created a separate post, so please put your answers there.)
share|improve this question

1 Answer 1

Tikz code that involve co-ordinate calculations needs at least two runs. For example:

\documentclass[twoside]{article}

\usepackage{tikz}               % you know what this does!
\usetikzlibrary{calc}

\usepackage{fancyhdr}             % put things headers and footers and we plan misuse it ;)
\usepackage{lipsum}               % for sample text


\pagestyle{fancy}
\fancyhf{}
\fancyhead[LO]{%
  \begin{tikzpicture}[overlay,remember picture]
      \fill [color=blue]
        (current page.north west)
        rectangle
        ($ (current page.south west) + (1cm,0cm) $);
  \end{tikzpicture}
}
\fancyhead[RE]{%
\begin{tikzpicture}[overlay,remember picture]
      \fill [color=orange]
        (current page.north east)
        rectangle
        ($ (current page.south east) + (-1cm,0cm) $);
\end{tikzpicture}
}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\begin{document}
\lipsum

\lipsum

\lipsum

\end{document}

involves such calculations and needs two compilations to get the side lines correct.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.