如何在编号和零件名称后添加点,但仅限于 TOC、TOF 和 TOT?

如何在编号和零件名称后添加点,但仅限于 TOC、TOF 和 TOT?

我想在数字部分(罗马数字)后以及部分名称后添加一个点,但仅限于 TOC、TOF 和 TOT。

我可以在部分的标题和目录中添加或删除点,但不仅仅是在目录中。

梅德韦杰夫 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

\documentclass[a4paper,14pt,twoside,reqno]{extbook}
\usepackage[margin=28mm
]{geometry}
\usepackage{amsmath,amssymb,amsthm,mathpazo}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{times}
\usepackage{pstricks}
\usepackage{titlesec}
\usepackage{secdot}

% -----<<< Set up TOC (optimized by Simon Dispa) >>>----
\usepackage{tocloft, etoolbox}
\titleformat{\chapter}{\large \bfseries}{\filright \fboxrule 3pt \framebox[1.8em][c]{\thechapter}}{16pt}{\large}

\newlength{\chapternW}\setlength{\chapternW}{3.0em}% width of the chapter number box <<<<<<<<<<<<   

\renewcommand\cftchapnumwidth{\chapternW}% changed <<<<<<<<<<
\renewcommand\cftsecindent{\chapternW} %changed <<<<<<<<<<
\renewcommand\cftsubsecindent{\chapternW} %changed <<<<<<<<<<

\renewcommand\cftsecpresnum{\S \hspace{6pt}}
\renewcommand\cftsubsecpresnum{$ \bullet $ \hspace{2pt}}
\renewcommand\cftsecnumwidth{4em}
\renewcommand\cftsubsecnumwidth{4em} %Sets the spacing of the title after the subsection number

\renewcommand{\cftpartfont}{\bfseries\Large\hrule}%add line above part
\renewcommand{\cftbeforepartskip}{5mm}
\renewcommand{\cftpartafterpnum}{\\\hrule}%add line below part
\cftpagenumbersoff{part}%get rid of part page numbers
\renewcommand{\cftparskip}{4mm}%control line spacing

%******************** added <<<<<<<<<<<<<<<<<<<<<<<<<<
\usepackage{xpatch}
\tracingpatches
\makeatletter
\xpatchcmd\@chapter{\protect\numberline{\thechapter}#1}
{\protect\numberline{\setlength{\fboxrule}{2pt} \framebox[2em]{\thechapter}}#1}{}{}
% END _____________________________________________

% Section style definition
\titleformat{\section}[runin]
{\normalsize \bfseries}
{\color{black} \S \hspace{.6pt} \thesection}
{1ex}{\color{black}}[\quad]

% Subsection style definition
\titleformat{\subsection}[runin]
{\normalsize \bfseries}
{\color{black} $ \bullet $ \thesubsection}
{1ex}{\color{black}}[\quad]

   % Enabling this line we get a dot after parts num, both in the titles and in the TOC.\\
\renewcommand\thepart{\Roman{part}.}

 % Disabling it, we remove the dot in both sides:**\\

  %\renewcommand\thepart{\Roman{part}.}\\

\renewcommand\thesection{\thechapter.\arabic{section}.}
\renewcommand\thesubsection{\thesection\arabic{subsection}.}

\setcounter{page}{0}

\titlespacing*{\section}{0pt}{3ex}{2ex} %Espacio a la izquierda, space before title, space after title.

\titlespacing*{\subsection}{0pt}{3ex}{2ex}

\titleformat{\chapter}{\large \bfseries}{\filright \fboxrule 3pt \framebox[1.8em][c]{\thechapter}}{16pt}{\large}

\def\hrulefill{\leavevmode\leaders\hrule height 6pt\hfill\kern 0pt}

\usepackage{emptypage}

\usepackage{imakeidx}
\indexsetup{othercode=\small}
\makeindex[program=makeindex,options=-s alphabetic_index, columns=2,intoc=true]

%Configuration for parts (Jonathan Komar)_____________.
\renewcommand{\cftpartfont}{\bfseries\Large\hrule}%add line above part
\renewcommand{\cftbeforepartskip}{5mm}

\renewcommand{\cftpartafterpnum}{\\\hrule}%add line below part
\cftpagenumbersoff{part}%get rid of part page numbers
\renewcommand{\cftparskip}{4mm}%control line spacing

\usepackage{tocloft}

% Formating part section >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

\titleclass{\part}{top} % make part like a chapter
\titleformat{\part}
[display]
{\centering\huge\bfseries}
{\gray \hrulefill \hspace{.3cm}{}  \thepart\hspace{.4cm}\hrulefill \\ \vspace{6pt} \titlerule[3pt]}
{-33pt}
{\gray \huge}
[{\titlerule[3pt]}]
%
\titlespacing*{\part}{0pt}{0pt}{25pt}
%

% ------------------------oOo-----------------------------

\begin{document}
    \pagestyle{plain}
    \tableofcontents
    \addtocontents{toc}{~\hfill\textbf{\underline{Page}}\par}
    \listoffigures
    \addcontentsline{toc}{chapter}{LIST OF FIGURES.}
    \listoftables
    \addcontentsline{toc}{chapter}{LIST OF TABLES.} 
    \addtocontents{lof}{~\hfill\textbf{\underline{Page}}\par}
    \addtocontents{lot}{~\hfill\textbf{\underline{Page}}\par}
    \addcontentsline{toc}{chapter}{FOREWORD.}   
    \part{Title of a part}
    \chapter{Title of a chapter}
    \section{Title of a section}
    \subsection{Title of a subsection}
    \part{Title of other part}
    \chapter{Title of other chapter}
    \section{Title of other section}
    \subsection{Title of other subsection}
\end{document}

答案1

要在数字部分(罗马数字)后以及部分名称后添加句点,但仅限于目录中,请在之前添加\begin{document}

\makeatletter
\def\ttl@tocpart{\def\ttl@a{\parbox{2.0em}{\thepart.}}} 
\xpatchcmd{\l@part}{#1}{#1.}{}{}
\makeatother

b

相关内容