0

My tex file isn’t producing a table of contents, when ran in bash:

pdflatex myfile.tex

I have tested compiling the same tex file in overleaf, using pdflatex as a compiler, and it produces the TOC as expected. Here is my tex file. Thanks for any help

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage{textcomp}
\usepackage{lastpage}

\usepackage{geometry} 
\geometry{%
  paperheight=16cm, 
  paperwidth=21.3cm,
%  landscape,
  top=0.8cm,
  bottom=0.8cm,
  left=0.8cm,
  right=0.8cm,
  includehead,includefoot,
  heightrounded
}

\usepackage{fancyhdr} 
\pagestyle{fancy}
\fancyhf{}
\rhead{{\scriptsize This_Document}}
\cfoot{\thepage}
\setlength{\headheight}{14pt} % 
\renewcommand{\footrulewidth}{0.4pt} %Adds a line above the footer
\setlength{\headheight}{17.5pt} %Corrects header issue

\setlength\parindent{0pt}%

\title{Title}
\author{me}


\begin{document}

\maketitle
\newpage

\tableofcontents
\newpage

\section{One}
Hello world!\\
\section{Two}
Hello world2!\\

\end{document}
  • 1
    Did you compile twice or just once? The table of contents is usually just produced after the second compilation. – leandriis Mar 23 '20 at 19:29
  • So I have just added another line to my python file (which compiles the tex via pdflatex): os.system('pdflatex ' + tex_file ) —— and it worked, would you mind telling me why compiling twice makes it work? Thanks – tedioustortoise Mar 24 '20 at 11:07
  • https://tex.stackexchange.com/a/314823/134144 contains a nice explanation. Does this answer your question? – leandriis Mar 24 '20 at 11:09

0 Answers0