
使用 tocloft 包,我可以在乳膠文件開頭的“Z 列表”標題下添加文字:
\renewcommand{\cftafterZtitle}{\par\noindent \textnormal{Z} \hfill \textnormal{PAGE}}
使用以下內容我可以將標題“List of Z”居中:
\renewcommand{\cftZtitlefont}{\hfill\bfseries}
\renewcommand{\cftafterZtitle}{\hfill}
但是當我嘗試組合這兩個命令時,它將文字移動到右邊距而不是中心:
\renewcommand{\cftloftitlefont}{\hfill\bfseries}
\renewcommand{\cftafterloftitle}{\hfill\par\noindent \textnormal{Z} \hfill \textnormal{PAGE}}
有誰知道如何將標題“List of Z”居中並在標題下方放置文字?
答案1
您可以\hbox
在第二個之後新增一個空\hfill
(請參閱艾格雷格的回答到什麼是 \null 以及我們什麼時候需要使用它?):
\documentclass{article}
\usepackage{tocloft}
\renewcommand{\cftloftitlefont}{\hfill\bfseries}
\renewcommand{\cftafterloftitle}{\hfill\null\par\noindent\textnormal{Z}\hfill \textnormal{PAGE}}
\begin{document}
\listoffigures
\noindent X\hrulefill Y% for coparison only
\end{document}
另一個選擇是使用\hfil
:
\renewcommand{\cftloftitlefont}{\hfil\bfseries}
\renewcommand{\cftafterloftitle}{\hfil\par\textnormal{Z}\hfill \textnormal{PAGE}}