章節標題出現在附錄中

章節標題出現在附錄中

我使用\fancyhdr包作為標題和報告作為文檔類範例程式碼如下所示

\documentclass[a4paper,11pt]{report} 
\usepackage[toc,page]{appendix}
\usepackage{fancyhdr}


\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
\markboth{\chaptername
\ \thechapter.\ #1}{}}
\fancyhf{}
\fancyhead[LE,LO]{\slshape \leftmark}
\rhead{\thepage}
\cfoot{}

\begin{document}
\pagenumbering{arabic}

\input{chap_01}
\input{chap_02}
\input{chap_03}

\begin{appendices}

\input{Appendix_01}
\end{appendices}
\end{document}

現在一切似乎都正常,但在附錄頁面上我得到: 在此輸入影像描述

我想要「附錄 A.參數定義」而不是章節。

建議?

答案1

你可以簡單地把線

\renewcommand\chaptername{Appendix}

就在該行之後

\begin{appendices}

在此輸入影像描述

樣本文件:

\documentclass[a4paper,11pt]{report}
\usepackage[toc,page]{appendix}
\usepackage{fancyhdr}


\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
\markboth{\chaptername
\ \thechapter.\ #1}{}}
\fancyhf{}
\fancyhead[LE,LO]{\slshape \leftmark}
\rhead{\thepage}
\cfoot{}

\begin{document}
\pagenumbering{arabic}

\begin{appendices}

\renewcommand\chaptername{Appendix}

\chapter{Parameter Definition}
\newpage
\setcounter{page}{35}
some text
\end{appendices}
\end{document} 

答案2

LaTeX 已經有一種在\chaptername和之間進行轉換的方法\appendixname;該命令\@chapapp通常擴展為\chaptername但被重新定義為表示\appendixnameafter \appendix

我從你的例​​子中刪除了一些不需要的東西。

\documentclass[a4paper,11pt]{report}

\usepackage{kantlipsum} % just for the example

\usepackage[toc,page]{appendix}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\slshape \leftmark}
\fancyhead[R]{\thepage}
\makeatletter % necessary for using \@chapapp
\renewcommand{\chaptermark}[1]{%
  \markboth{\@chapapp\ \thechapter.\ #1}{}}
\makeatother

\begin{document}
\pagenumbering{arabic}

\chapter{One}
\kant

\chapter{Two}
\kant


\begin{appendices}

\chapter{Again}
\kant

\end{appendices}
\end{document}

在此輸入影像描述

相關內容