目录:如何删除 LaTex 中子部分的页码?

目录:如何删除 LaTex 中子部分的页码?

有人能帮我删除页码子部分吗?只想

在此处输入图片描述

像这样

在此处输入图片描述

非常感谢。

这是我的代码

\documentclass[a4paper,12pt]{article} 
\date{} % Leave date blank 
\pagestyle{myheadings}   
\usepackage[top=1in,bottom=1in,left=1.05in,right=1.05in]{geometry} 

\usepackage[titles,subfigure]{tocloft} 
\usepackage{titletoc}  
\setcounter{tocdepth}{2}   
\titlecontents{section}[0ex]  
              {\addvspace{-0.4ex}\filright}  
              {\contentspush{\thecontentslabel\ \  }} 
              {}{\titlerule*[1em]{.}\contentspage}
\titlecontents{subsection}[14pt]   
              {\addvspace{-0.8ex}\filright \small}   
              {\contentspush{\thecontentslabel\ \ }} 
              {\empty}{\titlerule*[-0ex]{.}\contentspage}   

\usepackage{titlesec} 
\titlespacing{\section}{0ex}{*1.1}{*0}   
\titlespacing{\subsection}{0ex}{*0.8}{*0}   
\titleformat*{\section}{\large \bfseries}  
\titleformat*{\subsection}{\normalsize \bfseries}   

\usepackage{graphicx}
\usepackage{subfigure}  


\begin{document} 
\tableofcontents

\section{Three levels}
Computer vision

\section{Dating back}
\subsection{First}
\subsection{Second}

\end{document}

答案1

只需改变

\titlecontents{subsection}[14pt]   
              {\addvspace{-0.8ex}\filright \small}   
              {\contentspush{\thecontentslabel\ \ }} 
              {\empty}{\titlerule*[-0ex]{.}\contentspage}   

\titlecontents{subsection}[14pt]
              {\addvspace{-0.8ex}\filright \small}
              {\contentspush{\thecontentslabel\ \ }}
              {}{}

平均能量损失

\documentclass[a4paper,12pt]{article}
\date{} % Leave date blank
\pagestyle{myheadings}
\usepackage[top=1in,bottom=1in,left=1.05in,right=1.05in]{geometry}

\usepackage[titles,subfigure]{tocloft}
\usepackage{titletoc}
\setcounter{tocdepth}{2}
\titlecontents{section}[0ex]
              {\addvspace{-0.4ex}\filright}
              {\contentspush{\thecontentslabel\ \  }}
              {}{\titlerule*[1em]{.}\contentspage}
\titlecontents{subsection}[14pt]
              {\addvspace{-0.8ex}\filright \small}
              {\contentspush{\thecontentslabel\ \ }}
              {}{}

\usepackage{titlesec}
\titlespacing{\section}{0ex}{*1.1}{*0}
\titlespacing{\subsection}{0ex}{*0.8}{*0}
\titleformat*{\section}{\large \bfseries}
\titleformat*{\subsection}{\normalsize \bfseries}

\usepackage{graphicx}
\usepackage{subfigure}


\begin{document}
\tableofcontents

\section{Three levels}
Computer vision

\section{Dating back}
\subsection{First}
\subsection{Second}

\end{document} 

输出

在此处输入图片描述

tocloft但请注意,使用titlesec以下设置可以获得更好的结果:

\setlength{\cftbeforesecskip}{3pt plus.2pt}
\renewcommand{\cftsecfont}{\normalfont}
\renewcommand{\cftsecpagefont}{\normalfont}
\renewcommand{\cftsecleader}{\normalfont\cftdotfill{\cftsecdotsep}}
\renewcommand{\cftsecdotsep}{\cftdotsep}
\cftpagenumbersoff{subsection}

平均能量损失

\documentclass[a4paper,12pt]{article}
\date{} % Leave date blank
\pagestyle{myheadings}
\usepackage[top=1in,bottom=1in,left=1.05in,right=1.05in]{geometry}

\usepackage[titles,subfigure]{tocloft}
\setcounter{tocdepth}{2}
\setlength{\cftbeforesecskip}{3pt plus.2pt}
\renewcommand{\cftsecfont}{\normalfont}
\renewcommand{\cftsecpagefont}{\normalfont}
\renewcommand{\cftsecleader}{\normalfont\cftdotfill{\cftsecdotsep}}
\renewcommand{\cftsecdotsep}{\cftdotsep}
\cftpagenumbersoff{subsection}

\usepackage{titlesec}
\titlespacing{\section}{0ex}{*1.1}{*0}
\titlespacing{\subsection}{0ex}{*0.8}{*0}
\titleformat*{\section}{\large \bfseries}
\titleformat*{\subsection}{\normalsize \bfseries}

\usepackage{graphicx}
\usepackage{subfigure}


\begin{document}
\tableofcontents

\section{Three levels}
Computer vision

\section{Dating back}
\subsection{First}
\subsection{Second}

\end{document} 

输出:

在此处输入图片描述

相关内容