1

Working on my thesis template and need help understanding titletoc. I've found an example of a TOC i liked, copy/paste, looks wonderful, but my sections that have roman numerals are missing their numering.

this is what it looks like

The code that does things with the TOC looks like this:

\usepackage[nottoc]{tocbibind}
\usepackage{titletoc}
\titlecontents{chapter}
                [0.0cm]             % left margin
                {\vspace{1cm}}      % above code
                {%                  % numbered format
                {{\scshape Kapittel} \thecontentslabel---}%
                }%
                {}         % unnumbered format
                {}         % filler-page-format, e.g dots

I've tried reading the manual but i'm just a simple composer... What am i missing?

EDIT: Full code of main body

%===============Supernødvendige==================================
\documentclass[12pt,twoside]{report}
\usepackage[utf8]{inputenc} % ØÆÅ
\usepackage[norsk]{babel} % Norske ord og uttrykk i automatisk generert materiale.
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry} % A4 og margdetaljer.
%\linespread{1.5} % Linjeavstand, om nødvendig (det er det ikke).
\usepackage{graphicx} % For å importere grafikk
    \graphicspath{ {grafikk/} }
\usepackage{pdfpages} % Importere pdf-filer
\usepackage{csquotes} % Enkel og grei måte å sitere tekst på. Ex.:\begin{displayquote}Tekst\end{displayquote}
\usepackage{wrapfig} % Tabellting
\usepackage{multirow} % "-"
\usepackage{booktabs} % "-"
\usepackage{hyperref} % Gjør lenker og referanser klikkbare
\usepackage{apacite} % Denne gjør siteringen om til APA, som er kravet satt av HiNESNA
\tolerance = 5000 % Norsk bruker noe lengre ord enn engelsk, 
\hbadness = \tolerance % derfor bruker vi denne for å hindre LATEX å bryte ord på hi-
\pretolerance = 2000 % nsides plasser.
%===============PYNTETING==================================
%=========Header og footer============
\usepackage[Conny]{fncychap} % Fæncy overskrift. Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
\usepackage{fancyhdr} % Dette er header og footer.
    \pagestyle{fancy}
        \fancyhead{}
        \fancyhead[LO,RE]{Kapittel \thechapter}
        \fancyfoot{}
        \fancyfoot[LE,RO]{\thepage}
        \fancyfoot[LO,CE]{}
        \fancyfoot[CO,RE]{}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
%=========Modifiserer Innholdslista============
\usepackage[nottoc]{tocbibind}
\usepackage{titletoc}
\titlecontents{chapter}
                [0.0cm]             % left margin
                {\vspace{1cm}}      % above code
                {%                  % numbered format
                {{\scshape Kapittel} \thecontentslabel---}%
                }%
                {}         % unnumbered format
                {}         % filler-page-format, e.g dots
%\addtocontents{toc}{~\hfill\textif{Side}\par} % Legger til "side" i innholdsfortegnelsen.
%=========Typografiske tillegg============
\usepackage{lettrine} % Stor bokstav i starten av paragraf. Ex.: \lettrine[lines=3]{L}{ook}
\usepackage{fix-cm} % Nødvendig fiksepakke for \lettrine
\usepackage{epigraph} % Sitat i starten av et kapittel. Ex.: \epigraph{TEXT}{\textit{UNDERTEXT\\UNDERUNDERTEXT}}
\usepackage{lipsum} 
%===============Selve dokumentet==================================
\begin{document}

\include{kapittel/tittel}
        \setcounter{page}{0} % Ingen telling av forsiden.
        \pagenumbering{roman} % Nullstiller sidetelleren og bruker romertall for alt som ikke er selve oppgaven.

\include{kapittel/sammendrag}

\include{kapittel/introduksjon}

\tableofcontents % Innholdsfortegnelse.
        \thispagestyle{plain}
            \clearpage 
        \pagenumbering{arabic}
        \thispagestyle{empty}

\include{kapittel/kapittel01}

\include{eksempelkoder}

%\include{kapittel/kapittel02}

%\include{kapittel/kapittel03}

%\include{kapittel/konklusjon}

\bibliographystyle{apacite}
\bibliography{bibliografi.bib}

\listoffigures % Legger til listene over figurer og tabeller i TOC.

\listoftables

\include{kapittel/vedlegg01} % Eventuelle vedlegg legges til her.

%\include{kapittel/vedlegg02}
%========================================
\end{document} 

I dont know if this will run because the chapters are embeded, but you guys are the smart ones, i trust it will sort it self out.

Buschmann
  • 943
  • 1
    Welcome to TeX.SX! Please help us to help you and add a full minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. You might also want to add to your question how you're including the pdfs etc. – Aradnix Oct 22 '14 at 07:02
  • Where are you defining roman numbered chapters? I can't see it in the example. One of our members wrote some notes on preparing a minimal working example – Johannes_B Oct 22 '14 at 07:22
  • Concerning your change of the pagination, please have a look at How to use pagenumbering in the document? – Johannes_B Oct 22 '14 at 07:23
  • btw: hyperref is usually loaded last. – Johannes_B Oct 22 '14 at 07:25
  • My pagination works just fine -without the titletoc, thats my problem. Look at the code, bottom half, 4. line of code after \begin{document}. – Buschmann Oct 22 '14 at 07:26
  • 1
    @Buschmann: Could you please provide the community with a minimal example that replicates your problem so that we can copy-and-paste-and-compile and see exactly what the problem is. As it stands, we don't have the included files, and have to mock up something ourselves... if you want to be helped quicker, then make something we can consume quickly. Helping us really does help yourself. – Werner Oct 22 '14 at 07:35
  • @Buschmann As Werner says, an MWE doesn't means the whole mainfile.tex simply the minimal quantity of lines (and packages) to can reproduce your situation, and of course those lines must include the issue. – Aradnix Oct 22 '14 at 07:50
  • I understand this, but please understand that this is a thesis project and its getting quite big. I also use include so that there is not a singel file, but several. I think its impossible to make this code work without making a whole new document from scratch and then whats the point? I have narrowed down the problem to the titletoc, and if comment out just that part i have a fully working TOC, but not with the formating i want. – Buschmann Oct 22 '14 at 07:54
  • To be superexact; \titlecontents{chapter} is causing the problem. – Buschmann Oct 22 '14 at 08:00
  • There is not a single chapter command in your example. How shall we see what you see in the other files? Try to reproduce it in the main file. – Johannes_B Oct 22 '14 at 08:03
  • If none of you can look at the first bit of code i posted and tell me whats doing what and why my pages with roman pageination is missing when i invoke {titletoc} and \titlecontents then there is no point in this exercise. Either you know how to use it or you dont. Trial and error i do just fine on my own. Back to business: Since i dont know what {titletoc} really does i have tried commenting those two out. When i do everything runs fine, no errors and my TOC returns to "normal". My chapters have nothing fancy, have tried commenting out everything extra, to no affect. – Buschmann Oct 22 '14 at 08:15
  • I think i just understood your problem. The list of tables/figures, are unnumbered by design because they use \chapter* internally. Is that what you mean? – Johannes_B Oct 22 '14 at 08:23
  • So your chapters aren't numbered with roman numerals, but your pages are. – Johannes_B Oct 22 '14 at 08:24
  • Yes! Thank you for spending brainpower on this. – Buschmann Oct 22 '14 at 08:26
  • It does the same as \usepackage[nottoc]{tocbibind}, but thank you. I have narrowed it further down: {{\scshape Kapittel} \thecontentslabel---} is causing everything with in numbered to reformat. Obviously this overwrites my roman numbering. – Buschmann Oct 22 '14 at 08:36
  • I just found out sharelatex allows for sharing: https://www.sharelatex.com/project/54460bcdd71bd8c254939ac4 – Buschmann Oct 22 '14 at 08:38
  • Please rephrase your problem by editing the question. – Johannes_B Oct 22 '14 at 08:49
  • 3
    I am not sure if I understand your question: Are you missing the page numbers for the chapters in your table of contents? Then you have to add \hfill\contentspage in the last argument: \titlecontents{chapter}[0.0cm]{\vspace{1cm}}{{\scshape Kapittel} \thecontentslabel---}{}{\hfill\contentspage} – esdd Oct 22 '14 at 08:53
  • YES! YES! I LOVE YOU! – Buschmann Oct 22 '14 at 08:55

1 Answers1

1

The solution: add \hfill\contentspage in the last argument: \titlecontents{chapter}[0.0cm]{\vspace{1cm}}{{\scshape Kapittel} \thecontentslabel---}{}{\hfill\contentspage}

Tata!

Buschmann
  • 943