3

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.

  • You can use a scroman page numbering, defined in an answer I proposed here. – Bernard Mar 23 '16 at 11:09
  • 1
    Do you really use tocloft? Or tocstyle? Note that the usage of tocloft together with a KOMA-Script class is not recommended. – esdd Mar 23 '16 at 12:08
  • @esdd Oops... I read multiple times and read it always wrong... Should I keep this question as is and ask a new one for tocstyle since there are already some answers for tocloft or just change it here? What do you think? – KarlKlammer Mar 23 '16 at 12:27
1

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}
| improve this answer | |
2

Perhaps the easiest thing to do is use the tocloft package to set the appearance of the toc.

\documentclass{scrartcl}
\usepackage{tocloft}
\renewcommand\cftsecfont{\bfseries\sffamily}
\renewcommand\cftsecpagefont{\bfseries\small\sffamily}
\begin{document}
    \pagenumbering{Roman}
    \setcounter{page}{27}
    \tableofcontents
    \newpage
    \section{Section}
    \newpage
    \pagenumbering{arabic}
    \section{Section}
\end{document}

enter image description here

For comparison, this is without the tocloft settings:

enter image description here

| improve this answer | |
  • @Mico The OP asked to use "small caps or smaller letters" for the numbering. Since there is no bold small caps for that font, I opted for the latter. – Steven B. Segletes Mar 23 '16 at 11:11
2

Since you've set the tocloft tag, I assume you're interested in using the package to modify the appearance of the Table of Contents. The following code shows how this might be done. Note the use of \cftsetrmarg and \cftsetpnumwidth to increase the amount of space that's set aside for page numbers -- roman numerals tend to take up a lot more space than arabic numerals do.

The Computer Modern font family doesn't provide a sans-serif/small-caps/bold combination of font attributes. The code below therefore generates serif/non-bold small-cap page numbers in the ToC.

enter image description here

\documentclass{scrartcl}

\usepackage{tocloft}
\cftsetrmarg{4em} % set aside more space for roman numerals
\cftsetpnumwidth{3.5em}  
\renewcommand\cftsecfont{\bfseries\sffamily}
\renewcommand\cftsubsecfont{\bfseries\sffamily}
\renewcommand\cftsubsubsecfont{\bfseries\sffamily}
\renewcommand\cftsecpagefont{\scshape}

\begin{document}
    %%\pagenumbering{roman} 
    \renewcommand\thepage{\scshape\roman{page}} % <- new
    \setcounter{page}{37}
    \tableofcontents
    \newpage
    \section{Section}
    \subsection{Subsection}
    \subsubsection{A very very very very very  very very very very very very very very very very very very very very very very very very very very long subsubsection header}
    \newpage
    \pagenumbering{arabic}
    \section{Section}
\end{document}
| improve this answer | |

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.