将页码放在目录中章节名称的旁边

将页码放在目录中章节名称的旁边

在目录中,我想将页码放在章节名称的旁边,如下所示:

在此处输入图片描述

/我最好在章节名称和页码之间添加,如下所示:

1. Intro / 2

我读了一两篇教程,尝试了几种方法,但都无法做到。该怎么做?请注意,我想在不改变课程extbook和不放弃multitoc包的情况下做到这一点

\documentclass[a4paper,openany,14pt]{extbook}

\usepackage[titles]{tocloft}
\usepackage[toc]{multitoc}
\renewcommand*{\multicolumntoc}{2}
\setlength{\columnseprule}{0.5pt} % remove vertical column line
% \addtocontents{toc}{\cftpagenumbersoff{chapter}} % remove page no
\renewcommand{\cftdot}{} % remove dots

\begin{document}

\tableofcontents

\pagebreak

\chapter{Intro}
Some text
\pagebreak
\chapter{Unit with more and more text}
Some text

\pagebreak

Some more text

\pagebreak

Some more and more text
\chapter{Termination Unit}
Some text
\pagebreak

\end{document}

答案1

使用包tocloft你可以使用

\renewcommand{\cftchapleader}{\:/\:}
\renewcommand{\cftchapafterpnum}{\cftparfillskip}
\renewcommand{\cftpnumalign}{l}

例子:

\documentclass[a4paper,openany,14pt]{extbook}
\usepackage[titles]{tocloft}
\usepackage[toc]{multitoc}
\renewcommand*{\multicolumntoc}{2}
\setlength{\columnseprule}{0.5pt}
\renewcommand{\cftchapleader}{\:/\:}
\renewcommand{\cftchapafterpnum}{\cftparfillskip}
\renewcommand{\cftpnumalign}{l}

\begin{document}
\tableofcontents
\chapter{Intro}
Some text
\chapter{Unit with more and more text}
Some text
\clearpage
Some more text
\clearpage
Some more and more text
\chapter{Termination Unit}
Some text
\end{document}

在此处输入图片描述

相关内容