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.

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.

share|improve this question
4  
You can try deleting the various auxiliary files created by previous runs of latex. –  T. Verron Dec 11 '12 at 1:11
    
Try press r and return. –  Sigur Dec 11 '12 at 1:16
    
@T.Verron Thanks, indeed it helps. But first, I thought that the auxiliary files are overwritten each time I run LaTeX, second, I'm trying to learn new things, so I get error messages almost all the time, if I have to enter the folder to delete all auxiliary files after each compilation it starts to be a bit complicated. If there is no other solution, I'd have to, but why never before I had to do this? –  maria Dec 11 '12 at 1:16
3  
You can delete auxiliary files from within TeXworks: File->Remove Aux Files. –  Gonzalo Medina Dec 11 '12 at 2:10
4  
@maria The problem is exactly that you are copying arbitrary code into one and the same .tex file, but the auxiliary files "assume" that the preamble of your document stays the same between runs. For instance, package babel puts a marker into the .aux to signify the document language. So if you have babel in the preamble on one run, but not on the next, TeX will complain that the marker makes no sense if you haven't loaded babel. –  Stephan Lehmke Dec 11 '12 at 12:25

1 Answer 1

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.

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.