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 a template called Legrand Orange Book from http://www.latextemplates.com

It compiles fine with TeXShop (part of the MacTeX distribution), but I'm not sure I'm doing it exactly right. I have to compile it several times to get the index and bibliography (I'm assuming that's expected behaviour). What method should I be using (if any, besides using the compile button) to ensure it compiles correctly (i.e., how do I know for certain how many times to run compile)?

The instructions in the template say:

% Compiling this template:
% This template uses biber for its bibliography and makeindex for its index.
% This means that to update the bibliography and index in this template you
% will need to run the following sequence of commands in the template
% directory:
%
% 1) pdflatex main
% 2) makeindex main.idx -s StyleInd.ist
% 3) biber main
% 4) pdflatex main

And I see the following references in the template, so I assume TeXShop is calling the necessary programs internally(?):

% Bibliography
\usepackage[style=alphabetic,sorting=nyt,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{bibliography.bib} % BibTeX bibliography file
\defbibheading{bibempty}{}

% Index
\usepackage{calc} % For simpler calculation - used for spacing the index letter headings correctly
\usepackage{makeidx} % Required to make an index
\makeindex % Tells LaTeX to create the files required for indexing
share|improve this question

2 Answers 2

up vote 9 down vote accepted

The cool automation tool arara helps in situations like this. If you can afford to use it, here is what should be done.

If you don't have arara installed already (It comes bundled with texlive), download it from github and install. It needs java. Now let us assume that your file is main.tex. Put the following just before the \documentclass{...}:

% arara: pdflatex 
% arara: makeindex: { style: StyleInd }
% arara: biber
% arara: pdflatex 
\documentclass{...}
..
..
..
..

Now open the command and issue arara main (from the same folder where your main.tex is and arara should be in system path). Entire job will be taken care by arara and you should have your pdf file ready.

For details on how to integrate arara with texshop see:

this answer

this answer

and the excellent arara manual.

share|improve this answer
    
Or may be I didn't understand the question properly! –  Harish Kumar Jul 24 '13 at 8:15

To get the order of compilations correct you should think about the informations the external tool needs to know.

As an example: biber needs only to know all citations you used in your document. This information is stored on the first pdflatex run in a .bcf file. So the correct order for biber is:

  1. pdflatex % to create the bcf
  2. biber % to create the bbl
  3. more pdflatex runs (normally at least 2) to use the information in the bbl

makeindex on the other side not only needs to know the words you want to put in the index but also their pages! So the compilation order for makeindex is much more complicated:

  1. enough runs of pdflatex + all tools which can affect page numbers of indexed words (this includes biber as the expansion of citations changes the pages) so that pdflatex can create a correct input file for makeindex
  2. makeindex
  3. pdflatex to include the index
  4. perhaps everything again in case the index itself affected pages numbers of indexed words

So imho the compilation order described in your template is wrong. Naturally if you repeat it two or thrice on your final document it will come out correct at the end (at the small price of having run biber to often).

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.