3

i have a poor result when i try to add the introduction which is an unnumbered chapter to table of content through the command addcontentsline. LaTeX put the number of the page immediately next to the text "Introduction" resulting in something like "Introduction1" as i show in the pic. i provide the minimum compilable example which gives me that result. If I add other normal chapter they are represented normally in table of contents.

\documentclass[12pt,a4paper,oneside,openright]{book} %oneside versione segreteria
\usepackage[english,italian]{babel}
\usepackage[a4paper,top=2cm,bottom=2cm,left=3cm,right=2.5cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{bm}

\usepackage{graphicx}
\usepackage{hyperref}




\begin{document}

%-------------------------------------------------------------------------------------

\frontmatter

\pagestyle{plain}        
\tableofcontents

%-------------------------------------------------------------------------------------

\mainmatter

\pagestyle{plain} 

%Primo Capitolo
\addcontentsline{toc}{Chapter}{Introduzione}
\chapter*{Introduzione}

\end{document}

result whit that code

  • 3
    Welcome to TeX.SX! Use \addcontentsline{toc}{chapter}{Introduzione}, chapter, not Chapter. LaTeX is case-sensitive – user31729 May 31 '16 at 20:32
  • @ChristianHupfer Glad you saw it. These are these kind of mysterious bugs, you track down like forever, because you simply read over it. – MaestroGlanz May 31 '16 at 20:39
  • @ChristianHupfer Oh jesus, was it so banal? Thanks a lot it worked. Oh and I read you're an astrophysicists. I hope you're glad to know you helped a guy to properly write his bachelor degree thesis in astronomy! – Run like hell May 31 '16 at 20:39
  • @Angeloferrari: I was an Astrophysicist (well, I am still one by heart) ;-) – user31729 May 31 '16 at 20:44
  • @ChristianHupfer I didn't see your comment. Do you want this? – cfr May 31 '16 at 21:04
3

As Christian Hupfer pointed out, the problem is that the sectional division Chapter is unknown. Probably you meant chapter:

\documentclass[12pt,a4paper,oneside,openright]{book} %oneside versione segreteria
\usepackage[english,italian]{babel}
\usepackage[a4paper,top=2cm,bottom=2cm,left=3cm,right=2.5cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{bm}
\usepackage{graphicx}
\usepackage{hyperref}
\begin{document}
\frontmatter
\pagestyle{plain}
\tableofcontents

\mainmatter
\pagestyle{plain}

%Primo Capitolo
\addcontentsline{toc}{chapter}{Introduzione}
\chapter*{Introduzione}

\end{document}

correct contents line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.