如何将前导点添加到页码

如何将前导点添加到页码

我试图模仿前导点,使其类似于 目录示例

我现在的版本是这样的 当前目录

这是我的代码

\documentclass[]{report}

\usepackage[titles]{tocloft} 
\usepackage{tocbasic}

\usepackage{etoolbox}% used to fix the spacing in the LoT and LoF
\makeatletter
\patchcmd{\@chapter}{\addtocontents{lof}{\protect\addvspace{10\p@}}}{}{}{}% LoF
\patchcmd{\@chapter}{\addtocontents{lot}{\protect\addvspace{10\p@}}}{}{}{}% LoT
\makeatother


\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} % for parts
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3} 


\renewcommand\cftsecafterpnum{\vskip-.5\baselineskip}
\renewcommand\cftsubsecafterpnum{\vskip-.5\baselineskip}
\renewcommand\cftsubsubsecafterpnum{\vskip-.5\baselineskip}

\begin{document}
\vspace{-6\baselineskip}
\renewcommand{\contentsname}{TABLE OF CONTENTS} 
\tableofcontents

\chapter*{LIST OF SYMBOLS}
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}LIST OF SYMBOLS}

\chapter*{LIST OF ABBREVIATIONS}
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}LIST OF ABBREVIATIONS}



\chapter{INTRODUCTION}

\end{document}

谢谢

答案1

对您的 MWE 进行修订和扩展。

% tocdotsprob.tex  SE 634639

\documentclass[]{report}

\usepackage[titles]{tocloft} 
\usepackage{tocbasic}

\usepackage{comment}

\begin{comment}
\usepackage{etoolbox}% used to fix the spacing in the LoT and LoF
\makeatletter
\patchcmd{\@chapter}{\addtocontents{lof}{\protect\addvspace{10\p@}}}{}{}{}% LoF
\patchcmd{\@chapter}{\addtocontents{lot}{\protect\addvspace{10\p@}}}{}{}{}% LoT
\makeatother
\end{comment}

%% as described in the tocloft manual to fix the spacing
\renewcommand*{\addvspace}[1]{}

% reduce space between dots
\renewcommand{\cftdotsep}{3.3}

% left align page numbers
\renewcommand{\cftpnumalign}{l}

\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} % for parts
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3} 


\renewcommand\cftsecafterpnum{\vskip-.5\baselineskip}
\renewcommand\cftsubsecafterpnum{\vskip-.5\baselineskip}
\renewcommand\cftsubsubsecafterpnum{\vskip-.5\baselineskip}

\begin{document}
\vspace{-6\baselineskip}
\renewcommand{\contentsname}{TABLE OF CONTENTS} 
\tableofcontents

%%%% originally SYMBOLS and ABBREVIATIONS overwrote each other

\chapter*{LIST OF SYMBOLS}
\addcontentsline{toc}{part}{%\vspace{-.5\baselineskip}
  LIST OF SYMBOLS}

\chapter*{LIST OF ABBREVIATIONS}
%\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}LIST OF ABBREVIATIONS}
\addcontentsline{toc}{part}{%\vspace{-.5\baselineskip}
  LIST OF ABBREVIATIONS}

%% added
\listoffigures


%% most of the rest is added
\chapter{INTRODUCTION}
\section{Alpha}
\begin{figure}
  \centering
  AN ILLUSTRATION
  \caption{Illustration}
\end{figure}
\begin{figure}
  \centering
  A GRAPHIC
  \caption{Graphic}
\end{figure}

\chapter{FIRST}
\section{Beta}
\begin{figure}
  \centering
  AN ILLUSTRATION
  \caption{Illustration}
\end{figure}
\begin{figure}
  \centering
  A GRAPHIC
  \caption{Graphic}
\end{figure}

\end{document}

在此处输入图片描述

对我来说,从你的问题中看不出你是否希望在靠近页码的点之间减少间距。我认为我已经处理了这两个问题,并且还消除了 LoF 和 LoT 中的章节间距,所有这些都是通过该tocloft软件包实现的。

页码通常在给定宽度的框中右对齐,并且点在该框之前结束。我已将页码设置为左对齐,以便虚线的结束位置更靠近页码。

请阅读tocloft手册以获取更多信息。

相关内容