如何在目录中的章节号后添加点而不影响书籍类中主文档的章节?

如何在目录中的章节号后添加点而不影响书籍类中主文档的章节?

我已经制作了自己的文档格式和目录。

文档中章节标题格式如下:

第 1 章(下划线、全部大写且居中)章节名称或标题(下划线、全部大写且居中)

本章内容

然而,在目录中我希望它如下所示:

  1. 章节标题(全部大写,无粗体)1-1(页码格式为 -)

我想要我的 TOC

我遇到了一个特殊问题,上面提到的目录格式中章节编号后面应该有一个点。当我更改全局参数时,它会在主文档的章节编号上添加一个点。我只想要目录中章节编号后面的点。

我现在的目录

main.tex代码如下:

\documentclass[english,12pt,letterpaper,twoside,openright]{book}


\usepackage[total={6.5in,8.75in},top=1in, left=2.5cm,right=2.5cm]{geometry}


\usepackage{blindtext}
\usepackage{emptypage}

\usepackage{calc}
\usepackage{float}


\usepackage{ulem} 
\useunder{\uline}{\ulined}{}

\renewcommand{\ULdepth}{1.6pt} % can be used to set undelining depth

\usepackage[T1]{fontenc}

\usepackage{listings}

\usepackage{chngcntr}

\usepackage{tocloft}
\usepackage{url}

\usepackage{pdflscape} 

\usepackage{enumerate}
\usepackage{enumitem}

\usepackage{titlesec}   
\usepackage{titletoc}  
\usepackage{fancyhdr}  
\usepackage{array}

\usepackage{tabularx}
\usepackage{multicol}
\usepackage{multirow}

 
\usepackage{xcolor}  
\usepackage{graphicx}
 
\usepackage{wrapfig}
\usepackage{subcaption}


\usepackage{alphalph}
 
\usepackage{chappg}
\usepackage{refcount}
\usepackage{lastpage}




\renewcommand{\headrulewidth}{0pt} %for header line width
\renewcommand{\footrulewidth}{0pt} %for footer line width


 

\fancyhead{}
 


\fancyfoot{}
 


\fancyhead[c]{RESTRICTED}
 
 \fancyfoot[c]{\centering  \thepage \\ PBR- \hfill RESTRICTED \hfill  Draft}

\pagestyle{fancy}  
\pagenumbering{roman} 

 \newcommand{\partfnt}{\fontsize{12}{12}}
\newcommand{\chapfnt}{\fontsize{12}{12}}
\newcommand{\secfnt}{\fontsize{12}{12}}
\newcommand{\ssecfnt}{\fontsize{12}{12}}
 


 
 
\titleformat{\part}{\centering\normalsize \partfnt}{\underline{\Huge\ PART \thepart - }}{0em}{\Huge \uppercase \uline}


\makeatletter
\def\@makechapterhead#1{%
    \vspace*{0}% Space above number
    {\parindent \z@  \normalfont
    \interlinepenalty\@M
    \normalsize\centering \underline{\normalsize\ CHAPTER \thechapter}%
    \par\vspace{12pt}% Space between number and title
    \centering \underline{\MakeUppercase{#1}}%
    \par\vspace{12pt}% Space between title and text
}}
\makeatother

 

\titleformat{\section}{\centering\normalsize \secfnt}{\underline{\normalsize\ SECTION \thesection - }}{0em}{\uppercase \uline}

\titleformat{\subsection}{\normalfont \ssecfnt}{\thesubsection}{1em}{\uppercase \uline} %FINAL for unbold subsection
 


 





 
\usepackage[hidelinks]{hyperref} %Use hide links to remove boxes. Use [linktocpage=true] for keeping the link only on page number side instead of full section name 



\renewcommand\thesection{\arabic{section}}

\renewcommand\thesubsection{\ifnum\value{subsection}<10 010\fi\arabic{subsection}.}
 
 
 
\newlength{\mylen} % a "scratch" length
\settowidth{\mylen}{\normalfont \cftsecpresnum\cftsecaftersnum} % extra space
\addtolength{\cftsecnumwidth}{\mylen} % add the extra space


\usepackage{hyperref}

\begin{document}

\fancypagestyle{plain}


\renewcommand\contentsname{\underline{CONTENTS}}
\renewcommand{\cfttoctitlefont}{\hfill\normalsize\bfseries} 
\renewcommand{\cftaftertoctitle}{\hfill}

\setcounter{tocdepth}{1}

 
\renewcommand{\cftpartfont}{\uppercase \normalfont} % set part font
\renewcommand{\cftpartpagefont}{\normalfont}
\renewcommand{\cftpartdotsep}{100000000000} % adds dots between part name and page number but setting large value will remove dots
\renewcommand{\cftpartleader}{\cftdotfill{\cftpartdotsep}}
\renewcommand{\cftpartafterpnum}{\cftparfillskip} % add space after page number if needed
\renewcommand{\cftpartpresnum}{PART}  
\renewcommand{\cftpartaftersnum}{-} 
\renewcommand{\cftpartaftersnumb}{\\} 
\renewcommand{\cftbeforepartskip}{12}
 
 



\renewcommand{\cftchapfont}{\normalfont}  
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\cftchapdotsep}{100000000000}   
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
 
\renewcommand{\cftchapaftersnum}{.}  
\renewcommand{\cftchapaftersnumb}{\\} 
\renewcommand{\cftbeforechapskip}{12}
\renewcommand{\cftchapnumwidth}{3em}


\renewcommand{\cftsecfont}{\normalfont}
\renewcommand{\cftsecpagefont}{\normalfont}
\renewcommand{\cftsecdotsep}{100000000000}
\renewcommand{\cftsecleader}{\normalfont\cftdotfill{\cftsecdotsep}}  
 
\renewcommand{\cftsecpresnum}{SECTION\ }   
\renewcommand{\cftsecaftersnum}{\ -\ } 
\renewcommand{\cftsecaftersnumb}{\\}
\renewcommand{\cftsecindent}{5em}
 



 


\tableofcontents


\addtocontents{toc}{\textbf{CHAPTER}\hfill\textbf{SUBJECT}\hfill\textbf{PAGE NO}\par}
\addcontentsline{toc}{chapter}{\hspace{5em} \normalfont Promulgation}
\addcontentsline{toc}{chapter}{\hspace{5em} \normalfont Improvement}


\newpage
    




\clearpage


 
\renewcommand\thepage{\arabic{chapter}-\arabic{page}}


 
\setlist[enumerate, 1]{align=left, leftmargin=pt, labelindent=0pt,  listparindent=\parindent, labelwidth=20pt, itemindent=!}
\setlist[enumerate, 2]{align=left, leftmargin=24pt, labelindent=34pt,listparindent=26pt, labelwidth=28pt, itemindent=33}    
\setlist[enumerate, 3]{align=left, leftmargin=36pt, labelindent=34pt,listparindent=26pt, labelwidth=26pt, itemindent=33}    
\setlist[enumerate, 4]{align=left, leftmargin=36pt, labelindent=34pt,listparindent=26pt, labelwidth=26pt, itemindent=28}    

 
\part{General}
 

 
\include{ch1}

\part{Special}
 
\end{document}


%%% CHAPTERS ARE IN THIS FORMAT

% !TEX root = ./main.tex
%\setcounter{page}{1}

%\chapter{INTRODUCTION TO THE TOPIC} %% NEEDS TO BE CAPITAL AND UNDERLINED. CHAPTER 1 CENTER AND ON NEXT LINE THERE SHOULD BE CHAPTER NAME IN CAPS AND UNDERLINE

%\section{asdsadsad}

%\begin{enumerate}
%   \item abcd
%   \item edee
%\end{enumerate}

%\subsection{\uppercase name}

%\begin{enumerate}
%   \item abcd
%   \item edee
%\end{enumerate}


%\section{asdasd}

%\begin{enumerate}
%   \item abcd
%   \item edee
%\end{enumerate}

%\subsection{name}
%\begin{enumerate}
%   \item abcd
%   \item edee
%\end{enumerate}```

相关内容