5

A bunch of files will be generated by an engine, for example, pdfLaTeX when it compiles a TeX file. My question is: Do we need to delete all these generated files to ensure correct compilations if we switch to another engine, for example XeLaTeX here.

I have been using LaTeX a while and sometimes I did switch between different engines, but I have not encountered a compilation problem I would say.

Johannes
  • 153
  • Welcome to TeX.SE! – Zarko Feb 02 '17 at 01:41
  • I think you mean engine, and not compiler, cf. http://tex.stackexchange.com/q/13593/. Interesting question nevertheless. – Clément Feb 02 '17 at 02:16
  • Although I couldn't reproduce it off-hand, I can certainly attest that there have been times when switching engines can be (temporarily) problematic. I seem to recall it being an issue with the way sectional headings were getting written to (and then read back in from) auxiliary files; it might also(?) have been connected with font encoding issues. However, it was easy to hit q and finish the compilation. I don't remember there being any discernible errors in the output that necessitated deleting the auxiliary files before switching engines. – jon Feb 02 '17 at 06:06
  • in general no, but sometimes yes, that is it's always safest to delete but then slower as it may take more runs to resolve cross references, but it is always possible that in some cases it errors and you need to delete so in those cases it's quicker to delete first. personally I don't delete unless there is an error. – David Carlisle Feb 02 '17 at 08:03

1 Answers1

2

In general no, but sometimes yes, that is it's always safest to delete but then slower as it may take more runs to resolve cross references, but it is always possible that in some cases it errors and you need to delete so in those cases it's quicker to delete first.

Personally I don't delete unless there is an error.


The most common reason for errors in "old" aux files when you switch the engine is not so much the change of engine as a change of package or options which have taken different defaults having detected the engine in use.

This file for example works with pdflatex or lualatex (or xelatex) but you need to delete the aux and toc file when switching from pdflatex to luatex as the table of contents information is written using inputenc internal commands not defined in the luatex/xetex case.

Here there is a fairly obvious explicit test for the engine in use and a branch loading inputenc and fontenc, but in other cases the code branch can be hidden inside some package code and not be visible in the document, but have similar effects in the aux file.

\documentclass{article}

\ifx\Umathchar\undefined
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\fi

\begin{document}
\tableofcontents

\section{hellö world}

\end{document}
David Carlisle
  • 757,742