
附錄產生 2 個標題是否有原因?
\documentclass[12pt,oneside]{report}
\begin{document}
test
\appendix
\chapter{\textrm\bfseries Appendixtest2}\label{append}
\end{document}
我可以強製附錄標題(使用 \chapter,而不是 \section)採用以下格式:
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\huge}
答案1
(1)\appendix
不產生任何標題,僅將行為變更\chapter
為列印「附錄 A」而非「第 1 章」。
(2) 標題只有一個,由 生成\chapter
,一行包含\chaptertitlename
(附錄) 和\thechapter
(A),另一行包含章節參數 (附錄測驗 2)。
\titleformat
(3) 您可以使用該指令使用套件強制章節標題的格式titlesec
:
\documentclass[12pt,oneside]{report}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\huge}
\begin{document}
\appendix
\chapter{The title of the appendix}
\end{document}
但請注意,您正在嘗試將預設格式強制為...預設格式!所以,你不會看到任何效果。
您可以注意到,它實際上只使用任何其他格式即可工作,例如,一行中僅包含一個標題:
\documentclass[12pt,oneside]{report}
\usepackage{titlesec}
\titleformat{\chapter}{\Large}{\chaptertitlename\ \thechapter:}{1em}{\bfseries}
\begin{document}
\appendix
\chapter{The title of the appendix}
\end{document}
或有兩條線或更多...
\documentclass[12pt,oneside]{report}
\usepackage{titlesec}
\titleformat{\chapter}{\huge}{\chaptertitlename\ \thechapter}{0pt}{\hrule\bigskip\hfill\bfseries\sffamily}
\begin{document}
\appendix
\chapter{The title of the appendix}
\end{document}
或者甚至是這樣,有點棘手:
\documentclass[12pt,oneside]{report}
\usepackage[explicit]{titlesec}
\titleformat{\chapter}{\Large}{}{1em}{\bfseries #1 (\chaptertitlename\ \thechapter)}
\begin{document}
\appendix
\chapter{The title of the appendix}
\end{document}