![如何刪除目錄中的參考頁碼](https://rvso.com/image/420749/%E5%A6%82%E4%BD%95%E5%88%AA%E9%99%A4%E7%9B%AE%E9%8C%84%E4%B8%AD%E7%9A%84%E5%8F%83%E8%80%83%E9%A0%81%E7%A2%BC.png)
我還沒有在網路上找到解決方案,也不知道它叫什麼,但我想刪除我的小節目錄右側的數字
這是我到目前為止的目錄程式碼
%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}