我正在使用下面的代码重新定义我的\part
样式。我想修改它,以便在目录中看到带有 \scshape 字体的“第一部分:测试...”。现在,在目录中我看到的是“IA 测试...”。我应该如何修改我的代码?
\documentclass{book}
\usepackage{epigraph}
\usepackage{titlesec}
\makeatletter
\titleformat{\part}[display]
{\Huge\scshape\filright}
{\partname~\thepart:}
{20pt}
{\thispagestyle{epigraph}}
\makeatother
\setlength\epigraphwidth{.6\textwidth}
\begin{document}
\epigraphhead[450]{Fairy tales are more than true: not because they tell us that dragons exist, but because they tell us dragons can be beaten.\par\hfill\textsc{C.K. Chesterton}}
\part{A Test Part Title}
\end{document}
答案1
合并并调整其他问题的答案(重新定义 \part 样式和\part 标题样式)并添加目录中部分条目的格式,这可能是您想要的:
\documentclass{book}
\usepackage[table]{xcolor}
\usepackage{epigraph}
\setlength\epigraphwidth{.6\textwidth}
\makeatletter
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
\thispagestyle{epigraph}
\refstepcounter{part}%
\addcontentsline{toc}{part}{\partname~\thepart:\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
\markboth{}{}%
\reset@font
\parindent \z@
\vspace*{-400\p@}%
\hbox{%
\vbox{%
\hsize=7mm%
\begin{tabular}{@{}p{7mm}@{}}
\makebox[7mm]{\scshape\strut\small\partname}\\
\makebox[7mm]{\cellcolor{black}\Huge\color{white}\bfseries\strut\thepart\rule[-4cm]{0pt}{4cm}}%
\end{tabular}%
\makebox(0,0){\put(-10,-100){\fbox{\phantom{\rule[-4cm]{7mm}{4cm}}}}}
}%
\kern-2pt
\vbox to 0pt{%
\tabular[t]{@{}p{1cm}>{\raggedright\arraybackslash}p{\dimexpr\hsize-2.1cm}@{}}\hline
& \Huge\itshape\rule{0pt}{1.5\ht\strutbox}#1\endtabular}%
}%
\cleardoublepage
% \vskip 100\p@
}
\makeatother
\begin{document}
\tableofcontents
\cleardoublepage
\epigraphhead[450]{Fairy tales are more than true: not because they tell us that dragons exist, but because they tell us dragons can be beaten.\par\hfill\textsc{C.K. Chesterton}}
\part{A Test Part Title}
\end{document}
生成的文档:
ToC 的特写:
反转在部分标题中绘制装饰元素的顺序,并且可以使用任何颜色代替黑色:
\documentclass[draft]{book}
\usepackage[table]{xcolor}
\usepackage{epigraph}
\setlength\epigraphwidth{.6\textwidth}
\makeatletter
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
\thispagestyle{epigraph}
\refstepcounter{part}%
\addcontentsline{toc}{part}{\partname~\thepart:\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
\markboth{}{}%
\reset@font
\parindent \z@
\vspace*{-400\p@}%
\hbox{%
\vbox{%
\hsize=7mm%
\makebox(0,0){\put(10,-100){\fbox{\phantom{\rule[-4cm]{7mm}{4cm}}}}}%
\begin{tabular}{@{}p{7mm}@{}}
\makebox[7mm]{\scshape\strut\small\partname}\\
\makebox[7mm]{\cellcolor{gray}\Huge\color{white}\bfseries\strut\thepart\rule[-4cm]{0pt}{4cm}}%
\end{tabular}%
}%
\kern6pt
\vbox to 0pt{%
\tabular[t]{@{}p{1cm}>{\raggedright\arraybackslash}p{\dimexpr\hsize-2.55cm}@{}}\hline
& \Huge\itshape\rule{0pt}{1.5\ht\strutbox}#1\endtabular}%
}%
\cleardoublepage
% \vskip 100\p@
}
\makeatother
\begin{document}
\tableofcontents
\cleardoublepage
\epigraphhead[450]{Fairy tales are more than true: not because they tell us that dragons exist, but because they tell us dragons can be beaten.\par\hfill\textsc{C.K. Chesterton}}
\part{A Test Part Title}
\end{document}