9

I have a document in two column mode. All works fine (all in two columns) -- except the table of contents (toc). Strangely I found a solution:

\unsettoc{toc}{onecolumn}

This leads to a toc in two columns?! I do not understand since it says literally onecolumn in the command.

enter image description here (screenshot; taken from the manual)

\documentclass[
    twoside = false,
    twocolumn = true,
    listof=totoc,
    ]{scrbook}

% Comment in/out to see effect
\unsettoc{toc}{onecolumn}

\begin{document}

\tableofcontents

\chapter{Chapter}
Test

\section{Section}
Test

\subsection{SubSection}
Test

\subsubsection{SubSubSection}
Test

\paragraph{Paragraph}
Test

\subparagraph{SubParagraph}
Test

\end{document}

\unsettoc{toc}{onecolumn} active

enter image description here

\unsettoc{toc}{onecolumn} NOT active

enter image description here

After the Solution

Be aware that there is a UNset (unsettoc) command and set (setuptoc) command. I didn't read carefully enough!

7
  • 1
    I think that \unsettoc switches an option off. So by default the option onecolumn seems to be set and by \unsettoc{toc}{onecolumn} you switch it off.
    – Christian
    Commented Jul 9, 2016 at 10:29
  • @Christian Maybe you are right - but I do not think that this is intuitive. Commented Jul 9, 2016 at 10:43
  • So, where is the question here? You might want to edit for clarity. If asking "how does the unsettoc command work to influence toc columns in the Koma class that should be explicitly asked. Might also put something to that effect in the title.
    – A Feldman
    Commented Jul 9, 2016 at 10:51
  • @AFeldman Am I using the proper command or is this a lucky coincidence? (in addition the listof=totoc smmes not to work) Commented Jul 9, 2016 at 10:53
  • Then ask that question explicitly. In your question of course, not just here in the comments.
    – A Feldman
    Commented Jul 9, 2016 at 10:57

1 Answer 1

10

While the command \setuptoc{<extension>}{<feature list>} sets the features for an file extension like toc or lof, the command \unsettoc{<extension>}{<feature list>} unsets the listed features. Note that these are tocbasic commands and the file extension must be controlled by package tocbasic.

Each of the KOMA-Script classes scrartcl, scrreprt and scrbook loads package tocbasic and their ToC and the default lists are controlled by tocbasic automatically. scrreprt and scrbook also set the feature onecolumn for the TOC and the lists of owner float as default. So if you do not want a onecolumn TOC with scrreprt or scrbook you have to use

\unset{toc}{onecolumn}

to deactivate the onecolumn feature for the TOC.

If the lists (controlled by tocbasic) should alse be twocolumn, you can use

\makeatletter
\doforeachtocfile{\unsettoc{\@currext}{onecolumn}}
\makeatother

listof=totoc is an option of the KOMA-Script classes which does the same as

\makeatletter
\doforeachtocfile[float]{\setuptoc{\@currext}{totoc}}
\makeatother

So it effects only lists of the owner float like lof or lot and not toc. Note that an entry of the TOC in the TOC is not recommended. But it is possible with

\setuptoc{toc}{totoc}

enter image description here

enter image description here

Code:

\documentclass[
    twoside = false,
    twocolumn = true,
    listof=totoc,
    ]{scrbook}

\setuptoc{toc}{totoc}

\makeatletter
\doforeachtocfile{\unsettoc{\@currext}{onecolumn}}
\makeatother

\begin{document}

\tableofcontents
\listoffigures
\chapter{Chapter}
Test
\section{Section}
Test
\subsection{SubSection}
Test
\subsubsection{SubSubSection}
Test
\paragraph{Paragraph}
Test
\subparagraph{SubParagraph}
Test
\captionof{figure}{A Figure}
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .