0

Until a few days ago, I only ever used Texstudio (on windows) to create LaTeX documents, relying entirely on the build and compile button to sort everything out for me. I've been trying to understand how one might compile a latex document without an IDE, and have discovered that this is achieved simply by typing pdflatex filename.tex into a command line, provided that the appropriate binaries folder is in included in the "PATH" environment variable. However, citations and bibtex/biber require that you run bibtex and pdflatex in the order latex>bibtex>latex>latex. So I hypothesised that this is exactly what the build part of the Texstudio button "build and view" does. But this doesn't seem to be the case. This is my messagelog after pressing build and compile on my template.tex file:

Process started: bibtex.exe "template"

This is BibTeX, Version 0.99d (MiKTeX 2.9)
The top-level auxiliary file: template.aux
The style file: biblatex.bst
Database file #1: template-blx.bib
Database file #2: testbib.bib
Biblatex version: 3.0

Process exited normally





Process started: pdflatex.exe -synctex=1 -interaction=nonstopmode "template".tex

Process exited normally

So Texstudio seemingly runs bibtex followed by pdflatex. I tried doing this manually via the command prompt but bibtex responded "I couldn't open the file template.aux", which is a file created only after having run pdflatex at least once. This implies that Texstudio is running pdflatex before running bibtex even though it doesn't mention so in the message log. I have not changed Texstudio settings to add anything extra to the compilation order. So I'm stumped as to what's going on. Thanks for any help.

Lammey
  • 135
  • 1
    I don't have texstudio, but certainly you need to run latex first. However it is possible for IDE to spot that the tex file has not been edited since the previous run and so just run bibtex or whatever using the existing aux file, so perhaps that is happening in your case. – David Carlisle Aug 24 '15 at 21:19
  • I thought that might be the case, so I copied the .tex and .bib file and put them in their own sub-directory and compiled with tex studio, it still only ran bibtex>latex. I tried again but with renaming both the .tex and .bib file, but with the same result. – Lammey Aug 24 '15 at 22:56
  • Often these editors and IDEs do not call a hard-coded sequence of LaTeX/BibTeX runs, but rely on tools such as texify (TeXworks with MikTeX does). Those tools can determined the runs necessary themselves (I'm not too sure if and how texfiy does it, but latexmk can certainly do such a thing). And so some runs might be skipped, because they are not needed. But, as David Carlisle points out, you really need that first LaTeX run in order to create the aux file, without an aux file BibTeX doesn't know what to do. So it is necessary to run LaTeX first – moewe Aug 25 '15 at 04:59
  • Another theory is that your IDE only shows the log of the BibTeX run and the last LaTeX run. Showing log files of earlier LaTeX runs might confuse the user, because they might ask to rerun BibTeX or warn about page boundaries having changed, all of which are (normally) resolved by running the commands the appropriate number of times. – moewe Aug 25 '15 at 05:01
  • Did you do any more tests? I am not quite sure what to do with this question. Prima facie I would have thought it a duplicate of Question mark instead of citation number. Though that does not go deep into the technicalities of .aux files it explains the problem very, very well. – moewe Aug 28 '15 at 07:27
  • @moewe Well your comments definitely provide a satisfactory answer for me, but I'm not sure how to tag the question as answered. – Lammey Sep 11 '15 at 17:45
  • It has already been done :-) – moewe Sep 11 '15 at 18:38
  • Because the default configuration set of TeXstudio is like that: txs:///bibtex | txs:///compile | txs:///view. Options > Configure TeXstudio > Check Show Advanced Options and look into the Build section, the Meta command for "Build&View" there only consist of one compilation round following one bibtex round. You can change it to txs:///compile | txs:///bibtex | txs:///compile | txs:///compile | txs:///view – Jim Raynor Feb 23 '16 at 16:27

0 Answers0