如何更改目录中“部分”的名称

如何更改目录中“部分”的名称

我正在写一篇很长的文档,有两个主要部分和附录,我正在努力自定义目录。我有以下代码:

\documentclass[12pt,twoside,a4paper,openright]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\usepackage[bindingoffset=1.5cm,margin=2.5cm]{geometry}
\setlength{\textwidth}{14,5cm}
\setlength{\textheight}{23.5cm}
\setlength{\topmargin}{0cm}

\usepackage{tabularx}
\usepackage{fancyhdr}
\usepackage{emptypage}
\usepackage{nonumonpart}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage[width=0.9\textwidth]{caption}
\usepackage{subcaption}
\usepackage{notoccite}
\usepackage{cite}
\usepackage{afterpage}
\usepackage{epstopdf}
\usepackage{float}
\usepackage{bigstrut}
\usepackage{subfigure}
\usepackage{easylist}
\usepackage{courier}
\usepackage{color}
\usepackage{resizegather}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage{CJK}
\usepackage{relsize}
\usepackage{cancel}
\usepackage{sidecap}

\usepackage{hyperref}
\usepackage{titlepic}
\usepackage{titling}
\usepackage[toc,page]{appendix}
\usepackage{pdfpages}
\usepackage{textcomp}
\usepackage{rotating}
\usepackage{bookmark}
\bookmarksetup{open,numbered}

\usepackage[none]{hyphenat}%avoid word breaking

\usepackage[compact]{titlesec}

\setlength\textfloatsep{2.5\baselineskip}% space after a figure

\titlespacing{\section}{0pt}{2ex plus .2ex minus .2ex}{2ex plus .2ex}
\titlespacing{\subsection}{0pt}{2ex plus .2ex minus .2ex}{2ex plus .2ex}

\usepackage{palatino}

\allowdisplaybreaks
\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\newcommand{\atoc}[1]{\addtocontents{toc}{#1\par}}
\newcommand{\me}{\mathrm{e}}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}

\newcommand{\vect}[1]{\boldsymbol{#1}}%vector bold but italic

\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{\clearpage{\pagestyle{empty}\origdoublepage}}

\setlength{\parskip}{0.8em}% distance between paragraphs

\renewcommand{\baselinestretch}{1.1}%distance between lines

\setlength{\belowcaptionskip}{-10pt}

\frenchspacing

\renewcommand{\partname}{Results. Part}

\title{Bla bla bla}
\author{Bla bla bla}
\date{Bla bla bla}

\begin{document}

\includepdf{COVER}

\newpage\null\thispagestyle{empty}\newpage

\includepdf{LOGO}

\newpage\null\thispagestyle{empty}\newpage

\pagenumbering{roman}

\input{Laburpena/Laburpena}

\input{Abstract/Abstract}

\tableofcontents

\input{Chapters/Chapter1/Chapter1.tex}
\input{Chapters/Chapter2/Chapter2.tex}
\input{Chapters/Chapter3/Chapter3.tex}

\part{Bla bla}

\input{Chapters/Chapter4/Chapter4.tex}
\input{Chapters/Chapter5/Chapter5.tex}

\part{Bla bla}

\input{Chapters/Chapter6/Chapter6.tex}
\input{Chapters/Chapter7/Chapter7.tex}
\input{Chapters/Chapter8/Chapter8.tex}

\input{Chapters/Chapter9/Chapter9.tex}

\bookmarksetupnext{level=part}

\appendix
\part*{Appendices}
\addcontentsline{toc}{part}{Appendices}

\input{Appendices/AppendixA/AppendixA.tex}
\input{Appendices/AppendixB/AppendixB.tex}
\input{Appendices/AppendixC/AppendixC.tex}

\bibliographystyle{h-physrev}
\bibliography{biblio}

\bookmarksetupnext{level=part}

\input{Publications/Publications}

\bookmarksetupnext{level=part}

\input{Acknowledgements/Acknowledgements}

\end{document}

通过此代码,我获得了如下目录,其中各部分显示为

“我 Bla bla bla……(页码)”。

[...]

“II Bla bla bla......(页码)”。

[...]

“附录..........(页码)”。

我想要的是类似这样的内容:

“结果。第一部分

啦啦啦”

[...]

“结果。第二部分

啦啦啦”

[...]

附录

所有这些文件都没有点和页码,前两个文件分两行。我已经尝试了几种方法;例如,我尝试使用以下方法删除页码和点:

\usepackage{tocloft}
\addtocontents{toc}{\cftpagenumbersoff{part}}
\renewcommand{\cftdot}{}

但出于某种原因,它对我来说不起作用。我真的很感激有人能帮我。我想我已经发布了完整的代码,但如果需要一些额外的信息,请告诉我。

提前谢谢了!

答案1

那就可以了。

texsxPartsInToc

\documentclass{report}

\makeatletter
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries Results. Part #1\hfill\null}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
\makeatother

\begin{document}

\tableofcontents

\part{Wombat}
\part{Capybara}
\end{document}

相关内容