上图显示了附录中标题的当前状态。附录的标题目前为“附录”,在目录中显示为“附录”。应该保持这种状态。但是,在附录的标题中,我希望只显示“Appenidx”,而不显示“附录 A”。因为我只有一个附录,不需要在标题中进行区分。
\documentclass[a4paper,11pt]{report}
\usepackage{fancyhdr}
\fancyhead[RO,RE]{\fontsize{10}{12}\selectfont\nouppercase\thepage}
\fancyhead[LO,LE]{\fontsize{10}{12}\selectfont\nouppercase\leftmark}
\fancyfoot{}
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt} % remove lines as well
\renewcommand{\footrulewidth}{0pt}
}
\makeatletter
\renewcommand*\@makechapterhead[1]{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\renewcommand*\@makeschapterhead[1]{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
\appendix
\titleformat{\chapter}{}{}{0pt}{\normalfont\Huge\bfseries}
\chapter{Appendix}
\end{document}
答案1
在\markboth{Appendix}{}
后面添加\chapter{Appendix}
\chapter{Appendix}
\markboth{Appendix}{}
代码:
\documentclass[a4paper,11pt]{report}
\usepackage{fancyhdr,titlesec}
\pagestyle{fancy} %% Added
\fancyhead[RO,RE]{\fontsize{10}{12}\selectfont\nouppercase\thepage}
\fancyhead[LO,LE]{\fontsize{10}{12}\selectfont\nouppercase\leftmark}
\fancyfoot{}
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt} % remove lines as well
\renewcommand{\footrulewidth}{0pt}
}
%% the following is better done with titlesec since you are loading it
%% Use \titlespacing command for better. I didn't change though.
\makeatletter
\renewcommand*\@makechapterhead[1]{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\renewcommand*\@makeschapterhead[1]{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
\tableofcontents
\appendix
\titleformat{\chapter}{}{}{0pt}{\normalfont\Huge\bfseries}
\chapter{Appendix}
\markboth{Appendix}{}
\begin{table}[htbp]
\centering
\caption{European gymnastics associations 1881 (incl. North America)}
\end{table}%
Some text
\clearpage
Some text
\end{document}