[Tex/LaTex] LaTeX is compiling the file from before changes

compilingerrors

I'm using LaTeX under OSX 10.8.2, TeXworks as an editor.

Searching solution for my problem I'm trying to compile differet codeds posted here in questions or answers. I've created few test files where I copy-paste the code I want to try. I've realised that if I delete all and paste completly new code, LaTeX gives me errors like it was trying to compile a new document together with the old one. Saving file after delete but before copy new content, even closing it and opening again, doesn't help, I have to create each time a new test file.

I have never encounter this problem working "normaly" on my documents, only now when I often get error messages (when I try to change the code as it fits my needs).

As an example, when I try to compile this:

\documentclass[twocolumn]{article}
\usepackage{fontspec}
 \usepackage{polyglossia}

\newcommand*{\glossaryname}{Dictionary}
\usepackage[nonumberlist,xindy]{glossaries}
\newcommand{\dictentry}[3]{%
 \newglossaryentry{#1}%
{%
name=#1,
description={#2 & #3}}%
\glslink{#1}{}%
}

 \makeglossaries
\setmainlanguage{polish}

\begin{document}
\dictentry{on}{bal}{ggg} %
\dictentry{ja}{ccc}{ddd} %
\dictentry{pies}{zzzz}{abc} %

\printglossary[style=super]%
\end{document}

I get the following error:

(./15.gls

! Undefined control sequence.

Dr.\space \DTLinitials

{Aardvark}\space Foobar

l.5 …etentrycounter[]{page}\glsnumberformat{1}}}

%

?

I'm not saying that the file I'm trying to compile is fine, but Dr.\space\DTLinitials{Aardvark}\space Foobar is not part of this file at all, but of the previous one…

I thought it's maybe because LaTeX is stil reffering to the files created by makeglossaries, so I wanted to run it again, but it was impossible since LaTeX failed to compile the file.

Probably I'm just omiting something obvious, but I have no idea why it happens.

EDIT:

Trying advices given to me in comments, I've tried:

  1. Delete all auxiliary files before running LaTeX. Indeed it works, but looks a bit complicated for me for testing solutions – since I'm learning, so doing a lot of misteakes, I should delete auxiliary files after each attempt of improveing the code.

  2. Type r when LaTeX stops compilation. Than LaTeX continue compiling, but first – I have to retype it each time I run LaTeX again on the same file, even if I didn't change it, second – the output is not the output that should be generated – two different files with exactly the same input gives different output.

Best Answer

This is a property of LaTeX itself. Some of the information in .aux file is sensitive to changes in the document, especially changes in:

  • babel loading and languages
  • hyperref loading

If you consider it simplest to use the same file name, I recommend you to always run LaTeX on this simple document in between:

\batchmode
\documentclass{article}
\begin{document}
Hello World!
\end{document}

It should clear the information in the auxiliary files and everything should run smoothly.


Obviously, much simpler solution is to use the TeXworks built-in command

File -> Remove Aux Files...

whenever you paste a new MWE.

Related Question