2

I want to wrap the page number with parentheses like:

1.1 Section 1.1 ......... (1)
1.2 Section 1.2 ......... (5)

I found the \renewcommand{\cftsecafterpnum}{)} can add text after page number. But how to add text before page number?

1

Use a redefined \cftsecpagefont for this, calling the old version after the ( then:

\documentclass{article}
\usepackage{tocloft}
\usepackage{blindtext}

\let\origcftsecpagefont\cftsecpagefont
\let\origcftsecafterpnum\cftsecafterpnum

\renewcommand{\cftsecpagefont}{(\origcftsecpagefont}
\renewcommand{\cftsecafterpnum}{\origcftsecafterpnum)}

\begin{document}
\tableofcontents
\section{First section}
\blindtext[5]
\section{Section section}
\blindtext[10]
\end{document}

The pnumwidth might have to be adjusted for larger page numbers.

enter image description here

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.