[Tex/LaTex] LaTex performs multiple runs when compiling

compilingtexstudio

I use TexStudio to write my PhD thesis (large document), and I have set up the compiler options on: txs:///pdflatex | txs:///biber | txs:///pdflatex | txs:///pdflatex

However, when I ask TexStudio to compile my file, it runs this whole sequence (pdflatex/biber/pdflatex/pdflatex) multiple times before finally producing the pdf file. It can sometimes repeat it 6 or 7 times, with no particular error message displayed.
Do you have any suggestion as to what is happening and how to solve this as it takes an awfully long time to run the whole document?
I am fairly new to LaTex and probably doing something wrong, so would welcome any suggestion.
My preamble is as follows (prety long sorry):

\documentclass[a4paper,12pt,oneside]{report}

\usepackage[utf8]{inputenc}

\usepackage{graphicx}

\usepackage{sectsty}

\usepackage{mathptmx}

\usepackage[a4paper,left=4cm,right=2cm,bottom=3cm,headheight=14.5pt]{geometry}

\usepackage{tocloft}

\setlength{\cftbeforechapskip}{10pt}

\setlength{\cftbeforesecskip}{10pt}

\setlength{\cftbeforesubsecskip}{10pt}

\renewcommand\cftfigafterpnum{\vskip10pt\par}

\renewcommand\cfttabafterpnum{\vskip10pt\par}

\usepackage{fancyhdr}

\pagestyle{fancy}

\fancyhead{}

\fancyhead[R]{Chapter \thechapter}

\fancyfoot{}

\fancyfoot[R]{\thepage}

\usepackage{textcomp}

\usepackage[font={color=blue(pigment),small},labelfont=it,bf]{caption}

\usepackage{subcaption}

\captionsetup[subfigure]{hangindent=0pt, indention=0pt,position=top,labelfont=bf,textfont=normalfont,singlelinecheck=off,justification=raggedright}

\DeclareCaptionLabelFormat{blank}{}

\usepackage{booktabs}

\usepackage{multirow}

\usepackage{rotating}

\usepackage{pdflscape}

\usepackage{float}

\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}

\usepackage{colortbl}

\usepackage{array}

\usepackage{mathtools}

\usepackage{nicefrac}

\usepackage{anyfontsize}

\definecolor{ceruleanblue}{rgb}{0.16, 0.32, 0.75}

\definecolor{darkcerulean}{rgb}{0.03, 0.27, 0.49}

\definecolor{blue(pigment)}{rgb}{0.2, 0.2, 0.6}

\definecolor{beaublue}{rgb}{0.74, 0.83, 0.9}

\definecolor{palecornflowerblue}{rgb}{0.67, 0.8, 0.94}

\definecolor{babyblue}{rgb}{0.54, 0.81, 0.94}

\definecolor{babyblueeyes}{rgb}{0.63, 0.79, 0.95}

\chapterfont{\fontsize{28}{30}\selectfont\color{darkcerulean}}

\sectionfont{\fontsize{14}{16.8}\selectfont}

\subsectionfont{\fontsize{12}{14.4}\selectfont}

\usepackage[compact]{titlesec}    

\titlespacing*{\subsection}{0cm}{0.5\baselineskip}{0.5\baselineskip}


\usepackage[backend=biber, style=authoryear-comp, citestyle=authoryear-comp, isbn=false, url=false, doi=false, uniquelist=false ,uniquename=false, maxcitenames=2]{biblatex}

\usepackage[british]{babel}

\usepackage{csquotes}

\addbibresource{Thesis.bib}

\usepackage{setspace}

\overfullrule=2cm

Build tab options 1

Build tab options 2

Many thanks for your help!

Best Answer

A few things to try (in the order I think they might solve your problem)

  • As already suggested by TeXnician: For the default compiler: to make the compilation sequence non-repeatable, click on the green arrow/triangle to make it change its colour from green to grey.

enter image description here

  • Remove the checkbox check and update bibliography before compiling

  • decrease the number of maximum compile repetitions from 5 to e.g. 1

  • a dirty hack: I once had the problem, that the internal precompile got in my way. Unfortunately just removing the command does not seem to work, so I replaced it with a quick and harmless command, on linux based systems I use echo " ".

enter image description here


Furthermore I suggest to not invoke txs:///pdflatex | txs:///biber | txs:///pdflatex | txs:///pdflatex each time you compile, but to use an automation tool like latexmk, ltx2any, ... which are smart enough to know which compilation steps are currently necessary and do only them.

Related Question