我想在我使用 LaTex 类编写的书中采用这种样式。我该如何实现?
这是我的代码:
\documentclass[10pt]{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{hyperref}
\setlength{\parskip}{0pt}
\setlength{\parindent}{12pt}
\singlespacing
\frenchspacing
\usepackage{microtype} % for better justification
%-------------
% To customize parts, chapters, sections, subsections:
\usepackage[center,sc]{titlesec}
\titleformat{\chapter}[display]{\centering\bfseries}{\centering \huge\thechapter}{0.5em}{\huge}
%--------------
\renewcommand\thepart{\ifcase\value{part}\or ONE\or TWO\or THREE\fi}
\renewcommand{\contentsname}{\vspace*{-2.5cm}CONTENT}%
%in talbe of contents:
\usepackage[titles]{tocloft}
\renewcommand{\cftpartfont}{\normalfont\bfseries\partname~\thepart}
\renewcommand{\cftchapfont}{\MakeLowercase\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\numberline}[1]{}
\renewcommand{\cftdot}{.}
\renewcommand{\cftchapdotsep}{\cftdotsep}
% To customize parts, chapters, sections, subsections:
\usepackage[center,sc]{titlesec}
\titleformat{\chapter}[display]{\centering\bfseries}{\centering \huge\thechapter}{0.5em}{\huge}
% Custom pagestyle creation:
\fancypagestyle{custom}{
\fancyhf{}
\fancyhead[CO]{\normalfont \itshape \partname \ \thepart}
\fancyhead[CE]{\itshape\leftmark}
\fancyfoot[C]{\thepage}
\setlength{\headheight}{15pt}
\renewcommand{\headrulewidth}{0pt}
}
\pagestyle{custom}
%------------
% TO reduce overfull \hbox{} warnings:
\sloppy
\begin{document}
\thispagestyle{empty}
\clearpage
\tableofcontents
\newpage
\part{PART TITE}
\newpage
\chapter{Chapter 1 title}
\lipsum[1-5]
\chapter{Chapter 2 tite}
\lipsum[6-10]
\end{document}
答案1
感谢您的 MWE,但我已经使用了一些仅处理 ToC 条目的东西。
% booktocprob.tex SE 565361
\documentclass{book}
\usepackage{tocloft}
%%%%%% new title name and position
\renewcommand{\contentsname}{CONTENTS}
\renewcommand{\cfttoctitlefont}{\hfill\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hfill}
%%%%% try the part entry re-formbatting
\renewcommand{\cftpartpresnum}{Part }
\setlength{\cftpartnumwidth}{5em} %% space for ``Part num'' and indents title text
\cftpagenumbersoff{part} %% no part page numbers
%%%\newcommand{\mypart}[1]{\part{\mbox{}\\ #1}}
\let\oldpart\part
\renewcommand{\part}[1]{\oldpart{\mbox{}\\ #1}} %% split part and title for ToC
%%%%% change chapter entry formatting
\renewcommand{\cftchapdotsep}{\cftdotsep} %% dotted leader
\renewcommand{\cftchapaftersnum}{.} %% a . after chapter number
\begin{document}
\tableofcontents
\part{Part title}
\chapter{Chapter 1 title}
\chapter{Chapter 2 title}
\end{document}
我的主要困难是获取目录中的两行部分条目。最终我通过重新定义\part
为第二行显示标题解决了这个问题。(您可能想尝试注释掉的\mypart
宏,看看它是否更适合您。)