3

The solution of LOF+LOT+BIB in TOC with numbered chapter does not work in my case.

Admittedly I used a template of some other person - when I produce a Pdf with his code all above mentioned sections are numbered. However, when I produce the Pdf of my code, these sections remain unnumbered - which is undesired. Can anybody help me on, please? I suspect to depends on some counterproductive usepackage

Here is the code:

\documentclass[10pt,a4paper,bibliography=totocnumbered,listof=totocnumbered]{scrartcl}
\usepackage[tocbibind]
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage[subfigure,titles]{tocloft}
\usepackage{caption}

\setcounter{tocdepth}{2}
\renewcommand\cftchapafterpnum{\vskip8pt}
\renewcommand\cftsecafterpnum{\vskip10pt}

\usepackage{listings}
\lstset{basicstyle=\footnotesize, captionpos=b, breaklines=true, showstringspaces=false, tabsize=2, frame=lines, numbers=left, numberstyle=\tiny, xleftmargin=3em, framexleftmargin=3.0em}
\makeatletter
\def\l@lstlisting#1#2{\@dottedtocline{1}{0em}{1em}{\hspace{2,0em} Lst. #1}{#2}}
\makeatother

\geometry{a4paper, top=28mm, left=31mm, right=28mm, bottom=26mm, headsep=4mm, footskip=4mm}

\begin{document}

\titlespacing{\section}{0pt}{12pt plus 4pt minus 2pt}{2pt plus 2pt minus 2pt}
\renewcommand{\contentsname}{II Contents}
\phantomsection

\addtocounter{section}{1}
\tableofcontents
\pagebreak
\listoffigures
\pagebreak
\listoftables
\pagebreak


\noindent\section{List of Acronyms}
\begin{acronym} 
\setlength{\itemsep}{-\parsep} 
\acro{CEO}{Chief Executive Officer}     
\end{acronym}
\newpage


\setcounter{section}{0}
\renewcommand\refname{0. Introduction}
\section{{\Large Introduction}}
\markright{Introduction}
\phantomsection
\addcontentsline{toc}{section}{0. Introduction}
\addtocontents{toc}{\vspace{-0.5em}}

Lorem ipsum...

\newpage
\setcounter{section}{1}
\renewcommand\refname{Chapter 1}
\section*{{\Large Chapter 1}}
\markright{Chapter 1}
\phantomsection
\addcontentsline{toc}{section}{Chapter 1}
\addtocontents{toc}{\vspace{-0.5em}}

Lorem Ipsum again

\end{document}
Petra
  • 31
  • 1
    Hi and welcome, using templates or files by another file is discouraged (should be punished i think). You are loading several packages, that destroy KOMAs work. For example package tocloft. Package titlesec also whacks down KOMA internals. There are some more oddities. – Johannes_B Feb 16 '15 at 19:40
  • Rule of thumb, load as many packages as needed but as few as possible. I bet of all the packages loaded you are actually using 5, the rest is just junk messing about. – Johannes_B Feb 16 '15 at 19:41
  • Hi Johannes, thanks for replying. It truly happens that I need all of these packages. And the mixture of KOMA, tocloft and titlesec is being adapted from the template. As numbering works for the template it still does not explain, why it doesn't for my coding. If have any other advice, I'd be grateful. – Petra Feb 16 '15 at 21:36
  • Your example isn't complable, please follow how to make a minimal working example and fix it. This is too much to do on my own at this time of day. – Johannes_B Feb 16 '15 at 21:56
  • The Q/A you linked to is the plain version, tocloft breaks that as well, as it does its own stuff. The modularity of LaTeX is a blessing and a curse. – Johannes_B Feb 16 '15 at 21:59
  • Your point with modularity seems absolutely true. The point is that the entire document is ready and this is my only problem. Would there be no way to force Latex produce an output with numbered indices in the ToC and let it have its 'true modular' value for all the rest? In the sense of some sort of overwriting the output? I'd be very grateful for recommendations. Time is running...thanks – Petra Feb 21 '15 at 09:15
  • Package tocbibind is in your code, it is another packages that breaks KOMA. It adds the lists and stuff to the toc, but in a rather inexperienced way. Kick it out, everything is back to normal. One thing to add, i really doubt, that you need tocbibind, tocloft and/or titlesec. KOMA alone has all the capabilities of those packages. – Johannes_B Feb 21 '15 at 19:03
  • If you really desire to have the toc in the toc, use \setuptoc{toc}{totoc}. But i cannot recommend that. – Johannes_B Feb 21 '15 at 19:04
  • We could of course provide a patch, but think about it. Breaking the legs of a guy just to put in some extra stuff, and later replace it with some other junk. You can just as well get the right guy in the first place. – Johannes_B Feb 21 '15 at 19:06
  • Thanks Johannes, I will try to adapt these points and see how I go. Otherwise in that instance I must admit that I would commit the sin pf 'patching'. But lets see first. Thanks! – Petra Feb 22 '15 at 14:35
  • You would rather patch a package, that only destroys the wanted functionality and does not add anything useful? Instead of just getting rid of it? – Johannes_B Feb 22 '15 at 14:48
  • All right, I removed 'bibliography=totocnumbered, listof=totocnumbered' from the package. But now th LoF and LoT are missing in the ToC, but funnily the list of acronyms is there, however unnumbered (for which reason ever). Any ideas how to add LoF and LoT to ToC again while having them numbered? – Petra Feb 22 '15 at 18:42
  • 1
    You just deleted the working part!! – Johannes_B Feb 22 '15 at 18:44
  • Admittedly I am not a professional in latex, no doubts. I got all the formating as requested which cost some time (just with KOMA I had troubles). So now all is about getting the ToC right - which way ever - with patching or without. Thank you so much so far, Johannes! – Petra Feb 22 '15 at 18:45
  • Kick out this freaking tocbibind and it should work. Your example doesn't have acronyms. Do a proper Minimal Working Example! This saves time for all of us. ;-) – Johannes_B Feb 22 '15 at 18:45
  • Where is 'tocbibind' normally? It is nowhere explicitly stated in the codes. – Petra Feb 22 '15 at 18:57
  • Please test the code above, as you have given it to us. – Johannes_B Feb 22 '15 at 19:04
  • I tried to reproduce your problem and added tocbibind myself. If i add a toc and a lof and a caption, the lof appears numbered in the toc. Just as requested. That why we are asking for a minimal working example. – Johannes_B Feb 22 '15 at 19:08
  • And why is the freaking system no suggesting to drag this to chat? – Johannes_B Feb 22 '15 at 19:08
  • Thank you so much, I will see whether your solution can be reproduced. My apologies for not having inserted a MWE so far, never done that before... – Petra Feb 22 '15 at 19:50
  • http://texwelt.de/wissen/fragen/569/was-ist-ein-vollstandiges-minimalbeispiel-oder-kurz-vm-und-wie-erstelle-ich-dieses http://theoval.cmp.uea.ac.uk/~nlct/latex/minexample/index.html – Johannes_B Feb 22 '15 at 20:01
  • Hello Johannes, I edited the code above and hope it serves the purpose now. I tried to repoduce your recommendation, lamentably unsuccessfully. I inserted 'tocbibind', but probably inserted the caption the wrong way. All hints on how to precisely add the caption are warmly welcomed. Thanks a lot! – Petra Feb 26 '15 at 21:02
  • Not looking at the code, tocbibind with a KOMA class is always wrong (sorry). Let me take a look at it. Bit busy right now, might take an hour. – Johannes_B Feb 26 '15 at 21:05
  • You are using Chapters in an article class ... everything so far indicates that you want to use a class with real chapter. Are you up for getting a new template (may god have mercy on my soul) that might be more suited for you? It is a lot easier than debugging the stuff above. A lot. – Johannes_B Feb 26 '15 at 21:59
  • Well, they are only verbally called 'Chapters' in the headings, but they are marked as 'sections' within latex. I tried the book format before, but could had troubles with it. – Petra Feb 26 '15 at 22:03
  • 1
    @Petra You can now talk in the chat, it would be easier to discuss it there: http://chat.stackexchange.com/rooms/41/tex-latex-and-friends – yo' Feb 26 '15 at 22:08
  • Yeah, doing this in our nice little chat room might be a lot easier to find a personalised solution. – Johannes_B Feb 26 '15 at 22:09
  • Okay, will come... – Petra Feb 26 '15 at 22:13
  • http://chat.stackexchange.com/rooms/21478/petras-personalized-template – Johannes_B Feb 26 '15 at 22:18
  • Are there any news here? Did we find a solution? – Johannes_B Oct 07 '15 at 16:58

1 Answers1

1

The packages tocbibind, tocloft, titlesec and fancyhdr are not recommended with a KOMA class. They offer capabilities that the standard classes miss. KOMA-script provides the capabilities, but they are overrun by the aforementioned packages. Not using them is the solution.


It was stated, that the above code was found in a template. The code does so many many strange things, that i can't advice anybody to use it.
Be careful, many templates are bad.

Johannes_B
  • 24,235
  • 10
  • 93
  • 248