
我想更改附錄的對齊方式。我在用著
\documentclass[12pt]{report}
...
\usepackage{titletoc}
\usepackage[toc,titletoc]{appendix}
\usepackage{tocloft}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters
\renewcommand{\cftchapfont}{\uppercase}
\renewcommand{\cftchappagefont}{}
\renewcommand{\cfttoctitlefont}{\hfill\uppercase}
\renewcommand{\cftaftertoctitle}{\hfill}
\setlength{\cftbeforetoctitleskip}{-3em}
\renewcommand{\cftloftitlefont}{\hfill\uppercase}
\renewcommand{\cftafterloftitle}{\hfill}
\setlength{\cftbeforeloftitleskip}{-3em}
\renewcommand{\cftlottitlefont}{\hfill\uppercase}
\renewcommand{\cftafterlottitle}{\hfill}
\setlength{\cftbeforelottitleskip}{-3em}
我必須修改其他一些東西。這就是我所擁有的。
APPENDICES................. 10
APPENDIX A ................ 13
APPENDIX B ................ 15
這就是我需要的。
APPENDICES................. 10
APPENDIX A ............. 13
APPENDIX B ............. 15
答案1
\titlecontents
一種可能性是使用titletoc
包裹。
評論:
請注意,不再需要
titletoc
該包的選項。appendix
\uppercase
是一個 TeX 指令,不應在 LaTeX 文件中使用;可以用它\MakeUppercase
來代替;但是,這兩個命令都會收到一個參數,因此在問題中提供的範例中使用\uppercase
(或) 會產生錯誤。\MakeUppercase
另請注意,在我的答案中,一些原始設定被替換為一些重新定義和補丁;特別是,我使用了重新定義來
\l@chapter
使用點線領導者並使用大寫來設定章節條目的樣式。內部命令\@cftmaketoctitle
、\@cftmakeloftitle
和\@cftmakelottitle
fromtocloft
已修補(在包的幫助下etoolbox
),以分別使用大寫字體作為 ToC、LoF 和 LoT 的標題。
代碼:
\documentclass{report}
\usepackage[toc]{appendix}
\usepackage{titletoc}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage{textcase}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
\advance\leftskip\@tempdima
\hskip -\leftskip
\MakeTextUppercase{#1}\nobreak\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\patchcmd{\@cftmaketoctitle}{\cfttoctitlefont\contentsname}{\cfttoctitlefont\MakeUppercase{\contentsname}}{}{}
\patchcmd{\@cftmakeloftitle}{\cftloftitlefont\listfigurename}{\cftloftitlefont\MakeUppercase{\listfigurename}}{}{}
\patchcmd{\@cftmakelottitle}{\cftlottitlefont\listtablename}{\cftlottitlefont\MakeUppercase{\listtablename}}{}{}
\makeatother
\renewcommand{\cfttoctitlefont}{\hfill}
\renewcommand{\cftaftertoctitle}{\hfill}
\setlength{\cftbeforetoctitleskip}{-3em}
%
\renewcommand{\cftloftitlefont}{\hfill}
\renewcommand{\cftafterloftitle}{\hfill}
\setlength{\cftbeforeloftitleskip}{-3em}
%
\renewcommand{\cftlottitlefont}{\hfill}
\renewcommand{\cftafterlottitle}{\hfill}
\setlength{\cftbeforelottitleskip}{-3em}
\begin{document}
\tableofcontents
\chapter{Test Regular Chapter}
\begin{appendices}
\titlecontents{chapter}[10em]
{\addvspace{10pt}}
{\contentslabel[\MakeUppercase{\appendixname~\thecontentslabel}]{8em}\MakeUppercase}
{\hspace*{-8em}}{\titlerule*[.754em]{.}\contentspage}
\chapter{First Test Appendix}
\chapter{Second Test Appendix}
\end{appendices}
\end{document}
作為最後的評論(並且只是作為建議),我認為目錄中的條目最好使用小寫大寫字體而不是大寫字體;這還有一個額外的優點:實施起來會容易得多。