[Tex/LaTex] Small caps/small letters for TOC page numbering

koma-scripttable of contentstocstyle

I use both Arabic (1, 2, …) and Roman page numbering (I, II, …) in my document. However the normal Roman figures look too dominant in the table of contents (e.g. XXVIII). The lower-case Roman numbers don't look good to me either (xxviii).

I would like to achieve the following:

  • The Roman page numbering at the bottom of each page should be of standard-size capital letters.
  • The Arabic page numbering at the bottom of each page should be of standard-sized numbers.
  • The Roman page numbering in the table of contents should be of either standard-size small caps or of smaller capital letters. (They should not run as wide as regularly)
  • The Arabic page numbering in the table of contents should be of standard-sized numbers.

The following is a MWE which shows what I have now.

\documentclass{scrartcl}
\begin{document}
    \pagenumbering{Roman}
    \setcounter{page}{27}
    \tableofcontents
    \newpage
    \section{Section}
    \newpage
    \pagenumbering{arabic}
    \section{Section}
\end{document}

As you see, I use KOMA-Script. I'm open to using features from tocstyle, since I already use this package (see KOMA-Script: Wrong alignment of roman numbers).


NB: This question at first asked by mistake for a solution using tocloft. This is why there are some answers using that.

Best Answer

With the upcoming KOMA-Script version 3.20 tocstyle will not be needed. There is already a pre-release on the KOMA-Script website.

\documentclass{scrartcl}[2016/10/23]
\newcommand\pagenumbertocfont[1]{\ifisinteger{#1}{#1}{\tiny #1}}
\RedeclareSectionCommands[
    tocdynnumwidth,
    tocpagenumberbox=\hbox,
    tocpagenumberformat=\pagenumbertocfont
]{part,section,subsection,subsubsection,paragraph}
\RedeclareSectionCommands[
    tocpagenumberformat=\usekomafont{disposition}\pagenumbertocfont
]{part,section}


\usepackage{blindtext}

\begin{document}
    \pagenumbering{Roman}
    \setcounter{page}{27}
    \tableofcontents
    \clearpage
    \part{Part}
    \blinddocument

    \cleardoubleoddpage
    \pagenumbering{arabic}
    \blinddocument
\end{document}

Result:

enter image description here


With the current version 3.19a you can use pagenumberhook from package tocstyle.

\documentclass{scrartcl}

\usepackage[tocindentauto]{tocstyle}
\usetocstyle{KOMAlike}
\settocfeature{pagenumberbox}{\hbox}

\newcommand\pagenumbertocfont[1]{\ifisinteger{#1}{#1}{\tiny #1}}
\settocstylefeature{pagenumberhook}{\pagenumbertocfont}
\settocstylefeature[-1]{pagenumberhook}{\pagenumbertocfont}
\settocstylefeature[1]{pagenumberhook}{\pagenumbertocfont}

\usepackage{blindtext}

\begin{document}
    \pagenumbering{Roman}
    \setcounter{page}{27}
    \tableofcontents
    \clearpage
    \part{Part}
    \blinddocument

    \cleardoubleoddpage
    \pagenumbering{arabic}
    \blinddocument

\end{document}

This works also with the standard class article. But then you have to load package scrextend additionally.

\documentclass{article}
\usepackage{scrextend}
\usepackage{tocstyle}
\usetocstyle{standard}
\settocfeature{pagenumberbox}{\hbox}

\newcommand\pagenumbertocfont[1]{\ifisinteger{#1}{#1}{\tiny #1}}
\settocstylefeature{pagenumberhook}{\pagenumbertocfont}
\settocstylefeature[-1]{pagenumberhook}{\pagenumbertocfont}
\settocstylefeature[1]{pagenumberhook}{\pagenumbertocfont}

\usepackage{blindtext}

\begin{document}
    \pagenumbering{Roman}
    \setcounter{page}{27}
    \tableofcontents
    \clearpage
    \part{Part}
    \blinddocument

    \cleardoubleoddpage
    \pagenumbering{arabic}
    \blinddocument
\end{document}
Related Question