3

When using a multicolumn table of contents, the column breaks commonly occur between subsections which is ugly as hell.

Solution from esdd which allows several permutations was this:

%Two column ToC: comment lines to get combination of v.kern and column break you want
\usepackage{multicol}
\BeforeStartingTOC[toc]{\begin{multicols}{2} }  %this keeps heading "Contents" out of two column block
%\AfterStartingTOC[toc]{\end{multicols}} %keep cols equal i.e. vertical kern
\AfterStartingTOC[toc]{\null\end{multicols}} %2nd column is shorter, no v.kern
\RedeclareSectionCommand[toconstartsamelevel={}]{subsection} %Only break Column at Section,not sub-section.

See: Prevent column break in multicolumn index , except I am trying to do it for Table of Contents...

enter image description here

I am trying to put the ToC at the bottom of the 1st page thus )...

\begin{table}[!b]
\rule[0.5ex]{1\columnwidth}{0.5pt}
\BeforeStartingTOC[toc]{\begin{multicols}{2}} %could be in preamble...
\AfterStartingTOC[toc]{\end{multicols}}
\tableofcontents{}
\end{table}

Is there a direct way to make the toc float at bottom of page (i.e. not using table)?

Note: \BeforeStartingTOC makes the heading "Contents" above the two columns section, so it looks better that example above.

MWE

\documentclass[english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%Two column ToC: comment lines to get combination of v.kern and column break you want
\usepackage{multicol}

\BeforeStartingTOC[toc]{\begin{multicols}{2} }  %this keeps heading "Contents" out of two column block
%\AfterStartingTOC[toc]{\end{multicols}} %keep cols equal  vertical kerns
\AfterStartingTOC[toc]{\null\end{multicols}} %2nd column is shorter, no v.kern
\RedeclareSectionCommand[toconstartsamelevel={}]{subsection} %Only break Column at Section,not sub-section.


\makeatother

 \usepackage{babel}
 \begin{document}

 \title{A Koma Article}

 \maketitle
 \tableofcontents{}

 \section{First}
 \subsection{F1}
 \subsection{F2}
 \section{Second}
 \subsection{S1}
 \subsection{S2}
 \subsection{S3}
 \subsection{S4}
 \section{Third}
 \section{Fourth}

 \end{document}
  • 1
    Why a table float? Also, why also setting the chapter title in two-column mode? Also, why not posting a minimal working example? It is very hard to constuct something that matches your output, and we still cannot be sure it matches your code and a solution will work for you. In case it does not work, because your code is different, one of use would have wasted his/her time. – Johannes_B Dec 1 '16 at 7:43
  • How else to float the toc to the bottom of the page? Is there a neater way (like a koma option for position)? – Henry Crun Dec 1 '16 at 11:14
2

The result of your MWE is

enter image description here

scrartcl avoids a break between a section entry and its first subsection entry.

I am not sure if you really want no break between subsection entries. The result could be really ugly:

\RedeclareSectionCommand[
    toconstartsamelevel={}
]{subsection}

enter image description here

Or

\RedeclareSectionCommand[
    toconstartsamelevel={},
    tocbeforeskip=0pt
]{subsection}

enter image description here

Code:

\documentclass[english]{scrartcl}[2016/05/10]
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%Two column ToC
\usepackage{multicol}
\BeforeStartingTOC[toc]{\begin{multicols}{2} }
\AfterStartingTOC[toc]{\end{multicols}}

\RedeclareSectionCommand[
    toconstartsamelevel={},
    tocbeforeskip=0pt
]{subsection}

 \usepackage{babel}
 \begin{document}
 \title{A Koma Article}
 \maketitle
 \tableofcontents
 \section{First}
 \subsection{F1}
 \subsection{F2}
 \section{Second}
 \subsection{S1}
 \subsection{S2}
 \subsection{S3}
 \subsection{S4}
 \section{Third}
 \section{Fourth}
 \end{document}

Or

enter image description here

Code:

\documentclass[english]{scrartcl}[2016/05/10]
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%Two column ToC
\usepackage{multicol}
\BeforeStartingTOC[toc]{\begin{multicols}{2} }
\AfterStartingTOC[toc]{\null\end{multicols}}

\RedeclareSectionCommand[
    toconstartsamelevel={},
]{subsection}

 \usepackage{babel}
 \begin{document}
 \title{A Koma Article}
 \maketitle
 \tableofcontents
 \section{First}
 \subsection{F1}
 \subsection{F2}
 \section{Second}
 \subsection{S1}
 \subsection{S2}
 \subsection{S3}
 \subsection{S4}
 \section{Third}
 \section{Fourth}
 \end{document}
  • Looks like what I want, but I get error - Package scrbase Error: unknown option ` toconstartsamelevel={} '. Member .dsc' of family KOMAarg' cannot handle option `toconstartsamelevel'. So it cannot be set. (Komascript is V3.15, jan2015) – Henry Crun Dec 1 '16 at 19:01
  • Option toconstartsamelevel needs at least KOMA version 3.20. Current version is 3.21 – esdd Dec 1 '16 at 20:33
  • Thanks it works great[my bad, I assumed miktex packagemanager showed current versions]. Is there any option to force position to bottom of page, or better way that using a table float? BTW It would be great if you commented the key lines. for example I have no idea why /null/end is doing what it does. I have updated my MWE. – Henry Crun Dec 1 '16 at 22:45

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.