목차에서 참조 페이지 번호를 제거하는 방법

목차에서 참조 페이지 번호를 제거하는 방법

온라인에서 이에 대한 해결책을 찾지 못했고 이름도 확실하지 않습니다. 그러나 내 하위 섹션의 목차 오른쪽에 있는 숫자를 제거하고 싶습니다.여기에 이미지 설명을 입력하세요

여기 내 ToC에 대해 지금까지 가지고 있는 코드가 있습니다.

%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}

관련 정보