如何刪除目錄中的參考頁碼

如何刪除目錄中的參考頁碼

我還沒有在網路上找到解決方案,也不知道它叫什麼,但我想刪除我的小節目錄右側的數字在此輸入影像描述

這是我到目前為止的目錄程式碼

%align numbers and TOC
\titleformat{\section}{\normalfont\Large\bfseries}{\makebox[30pt][l]{\thesection}}{0pt}{} 
\titleformat{\subsection}{\normalfont\large\bfseries}{\makebox[30pt][l]{\thesubsection}}{0pt}{}

%TOC spacing
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftsubsecleader}{\hfill}
\setcounter{tocdepth}{2}
\renewcommand{\cftsecafterpnum}{\vspace{0pt}}
\setlength{\cftsecnumwidth}{30pt}
\setlength{\cftsubsecnumwidth}{30pt}
\setlength{\cftsubsecindent}{60pt}

答案1

添加

\makeatletter
\renewcommand{\cftsubsecpagefont}{\@gobble}
\makeatother

序言將使您實現格式化目標。


完整的 MWE:

在此輸入影像描述

\documentclass{article}
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftsubsecleader}{\hfill}
\makeatletter
\renewcommand{\cftsubsecpagefont}{\@gobble}
\makeatother
\renewcommand{\cftsecafterpnum}{\vspace{0pt}}
\setlength{\cftsecnumwidth}{30pt}
\setlength{\cftsubsecnumwidth}{30pt}
\setlength{\cftsubsecindent}{60pt}

\begin{document}
\tableofcontents

\section{Introduction}
\subsection{Goals of the Experiment}
\subsection{Background Information}
\section{Hypothesis}
\end{document}

相關內容