4

I'd like to have a small table of contents in two columns. Everything looks as expected, except the pagenumbers in the toc: they are still at normalsize, instead of footnotesize, and still in rmfamily, instead of sffamily.

\documentclass{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blindtext}
\usepackage{multicol}

\BeforeStartingTOC[toc]{\begin{multicols}{2}\sffamily\footnotesize}%
\AfterStartingTOC[toc]{\end{multicols}}

\begin{document}
\tableofcontents{}

\blinddocument{}

\end{document}

Here is a screenshot from the PDF:

enter image description here

Any ideas how to tame the pagenumbers in the toc?

4

Since KOMA-Script version 3.20 there are new possiblities to format the TOC and list entries. You can use

\newcommand\fontintoc[1]{\sffamily\footnotesize #1}

\RedeclareSectionCommands[
    tocentryformat=\usekomafont{disposition}\fontintoc,
    tocpagenumberformat=\usekomafont{disposition}\fontintoc
]{part,section}

\RedeclareSectionCommands[
    tocentryformat=\fontintoc,
    tocpagenumberformat=\fontintoc
]{subsection,subsubsection,paragraph,subparagraph}

enter image description here

Code:

\documentclass{scrartcl}[2016/05/10]

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blindtext}
\usepackage{multicol}

\BeforeStartingTOC[toc]{\begin{multicols}{2}}%
\AfterStartingTOC[toc]{\end{multicols}}

\newcommand\fontintoc[1]{\sffamily\footnotesize #1}

\RedeclareSectionCommands[
    tocentryformat=\usekomafont{disposition}\fontintoc,
    tocpagenumberformat=\usekomafont{disposition}\fontintoc
]{part,section}

\RedeclareSectionCommands[
    tocentryformat=\fontintoc,
    tocpagenumberformat=\fontintoc
]{subsection,subsubsection,paragraph,subparagraph}

\begin{document}
\tableofcontents{}
\blinddocument{}
\end{document}
  • It took some time to find the information that I have to add a "toc" as a prefix to all the options of tabular 15.1 in scrguide. Instead of "indent=..." it is "tocindent=..." However, thank you! – Keks Dose Jun 10 '16 at 13:26

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.