我的论文页脚有两个主要问题。在我的整个文档中,我的文本在每一页上都会切换 - 它可以正常工作。但是当读者看到最后两个“章节”时:1)参考文献和 2)附录 - 系统将无法正常工作。
如果有人能帮助我,我将不胜感激!
我的序言如下:
\documentclass[12pt,a4paper,twoside]{report}
% Page layout
\usepackage[bindingoffset=0mm]{geometry}
% Random text
\usepackage{lipsum}
% Page style
\usepackage{fancyhdr}
% References
\usepackage[round, colon, sort, authoryear]{natbib}
% Defining the DEFAULT style
\fancypagestyle{MyStyle}{%
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO]{\small{\leftmark} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \small{\thepage}}
\fancyfoot[LE]{\small{\thepage} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \lsstyle\small{\MakeUppercase{\chaptername}}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\lsstyle\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}
\fancyfoot[LE]{\thepage \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
\begin{document}
\pagestyle{plain}
...pages in plain style...
\pagestyle{MyStyle}
\chapter{Introduction}
\chaptermark*{Introduction}
\section{First section}
\lipsum
\section{Second section}
\lipsum
\chapter{Second chapter title}
\section{Third section}
\lipsum
\section{Fourth section}
\lipsum
\bibliography{References}
\addcontentsline{toc}{chapter}{References}
\chaptermark*{References}
\bibliography{References}
\addcontentsline{toc}{chapter}{References}
\chaptermark*{References}
\clearpage
\appendix
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\chaptermark*{Appendix A}
\end{document}
用红色标记的文本 - 是我想要放置文本的地方 - 这有意义吗?
- - 编辑 - -
在@cfr 的大力帮助下,我现在可以在页脚中输入“参考文献”,但对于附录,它不允许在两个标记上都输入“附录 A”。在论文的第一部分,我使用的是 MyStyle,这就是为什么定义了三种不同的样式。
在我的序言中,我添加了@cfr 的代码并将其放入其中 - 但我真的不知道为什么它不能在页脚中显示附录?
% Page style
\usepackage{fancyhdr}
\pagestyle{fancy}% <- !
% Defining MyStyle
\fancypagestyle{MyStyle}{%
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO]{\small{\leftmark} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \small{\thepage}}
\fancyfoot[LE]{\small{\thepage} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \lsstyle\small{\MakeUppercase{\chaptername}}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\lsstyle\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}
\fancyfoot[LE]{\thepage \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
\fancypagestyle{ref}{%
\fancyhf{}%
\fancyfoot[RO]{\small\rightmark \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}%
\fancyfoot[LE]{\small\thepage \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \leftmark}%
\renewcommand{\headrulewidth}{0pt}% % Remove header rule
\renewcommand{\chaptermark}[2][\chaptername~\thechapter]{\markboth{\lsstyle\MakeUppercase{##1}}{\lsstyle\uppercase{##2}}}%
}
\clearpage
\pagestyle{ref}
\bibliographystyle{apalike}
\bibliography{ref}
\addcontentsline{toc}{chapter}{References}
\markboth{\MakeUppercase{References}}{\MakeUppercase{References}}
%\restoregeometry
\clearpage
\pagestyle{ref}
\appendix
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\chaptermark[Appendix A]{Appendix A}
\markboth{\MakeUppercase{Appendix A}}{\MakeUppercase{Appendix A}}
编辑-几乎完整的序言
\documentclass[a4paper,11pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{layout}
\usepackage[protrusion=true,expansion=true]{microtype}
% Different usepackages
\usepackage[T1]{fontenc}
\usepackage[lf]{MinionPro} %% MinionPro
\usepackage{icomma}
\usepackage{setspace}
\setstretch{1.10}
\usepackage{siunitx,booktabs}
\usepackage{graphicx}
%% \usepackage{tocloft} - add if customize TOC
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\usepackage{tabu}
% Chapter
\usepackage[pagestyles ,newparttoc, explicit]{titlesec}%
\usepackage{titletoc}
\SetTracking[no ligatures = {f}]{encoding = }{100}
\usepackage[explicit]{titlesec}
\titleformat{name=\chapter}[display]{ \figureversion{lining}}{\lsstyle\Large\MakeUppercase\chaptername\enspace \LARGE\thechapter}{2ex}{\LARGE\bfseries#1}%\uppercase
\titleformat{name=\chapter, numberless}{\lsstyle\LARGE}{}{0pt}{\MakeUppercase{#1}} \titlespacing{\chapter}{0pt}{2.5ex}{6ex}
\raggedbottom
% Table of Contents
\titlecontents{chapter}[0em]{\large\bfseries\protect\addvspace{15pt}}%\thecontentslabel\brlap[1.25\baselineskip]
{\textssc{\mdseries\MakeLowercase\chaptername~{\footnotesize\thecontentslabel}}\\\medskip}
{}%
{\hfill\contentspage}%
\addtocontents{toc}{\protect\thispagestyle{empty}}
% item / enumerate
\usepackage{enumitem}
% HTML code
\usepackage{listings}
\usepackage{xcolor}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=Java,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=3
}
% Figure & Table names (1, 2, 3, 4 etc.)
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{equation}{chapter}
% More pdf-pages at same site
\usepackage{pdfpages}
% References
\usepackage[round, colon, sort, authoryear]{natbib}
\setlength{\bibsep}{0.0pt}
\setlength{\bibhang}{2em}
\bibpunct{(}{)}{;}{a}{}{}
\setcitestyle{notesep={: }}
\def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}
% Quotes
\usepackage{csquotes}
\MakeOuterQuote{"}
% Page margins
\usepackage[left=3.5cm,right=3.5cm,top=3.4cm,bottom=3.4cm]{geometry}
% PDF background
\usepackage{eso-pic}
% Random text
\usepackage{lipsum}
% Page style
\usepackage{fancyhdr}
\pagestyle{fancy}% <- !
% Defining MyStyle
\fancypagestyle{MyStyle}{%
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO]{\small{\leftmark} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \small{\thepage}}
\fancyfoot[LE]{\small{\thepage} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \lsstyle\small{\MakeUppercase{\chaptername}}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\lsstyle\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}
\fancyfoot[LE]{\thepage \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
\fancypagestyle{ref}{%
\fancyhf{}%
\fancyfoot[RO]{\small\rightmark \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}%
\fancyfoot[LE]{\small\thepage \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \leftmark}%
\renewcommand{\headrulewidth}{0pt}% % Remove header rule
\renewcommand{\chaptermark}[2][\chaptername~\thechapter]{\markboth{\lsstyle\MakeUppercase{##1}}{\lsstyle\uppercase{##2}}}%
}
% Margin
\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}
% Tabular
\usepackage{threeparttable}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\includepdfset{pagecommand=\thispagestyle{plain}}
\renewcommand{\TPTnoteSettings}{\footnotesize}
\renewcommand{\TPTnoteLabel}[1]{#1}
\usepackage{float}
% Rotate
\usepackage{pdflscape}
答案1
这可能是一个有用的开始,我根据您参考书目的附加信息对其进行了一些扩展。请注意,我必须大大扩展您的示例才能重现这一点,因为您的示例没有提供所需的资源。此外,我必须为 发明一个定义\lsstyle
。
据我所知,这会根据要求定制页脚。\leftmark
并\rightmark
用于此,并\chaptermark
重新定义为接受可选参数,该参数用于指定未编号章节的第二个标记。
请注意,\chaptermark*{Introduction}
设置*
为标记,然后打印Introduction
在文档正文中。这可能不是您想要的。因此,我删除或修改了这些命令。
\clearpage
据我所知,-> 添加到目录并设置标记 -> 打印参考书目运行良好。请注意,参考书目是默认创建的,因此\chapter
您不需要做任何特殊的事情。
使用 LaTeX 对附录进行编号会更有意义,但它确实是以这种方式工作的 - 只是需要比所需的更多的手动标记,因此您必须小心保持一致。
请注意,这些\section
命令还会在原始示例和此示例中设置标记 - 我不清楚您是否想要这样做。
\begin{filecontents*}{refs.bib}
@book{bk1,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk2,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk3,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk4,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk5,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk6,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk7,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk8,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk9,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk10,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk11,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
@book{bk12,
author = {Aardvark, A. N.},
year = 1978,
title = {Favourite Yards and Parks},
publisher = {Varks 'R Us},
address = {Here, There and Everywhere, Planet Earth, Solar System, Milky Way Galaxy, This Universe}}
\end{filecontents*}
\documentclass[12pt,a4paper,twoside]{report}
% Page layout
\usepackage[bindingoffset=0mm]{geometry}
% Random text
\usepackage{lipsum}
% Page style
\usepackage{fancyhdr}
% References
\usepackage[round, colon, sort, authoryear]{natbib}
\DeclareRobustCommand\lsstyle{\normalfont}
% Defining the DEFAULT style
\fancypagestyle{MyStyle}{%
\fancyhf{}%
\fancyfoot[RO]{\small\rightmark \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}%
\fancyfoot[LE]{\small\thepage \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \leftmark}%
\renewcommand{\headrulewidth}{0pt}% % Remove header rule
\renewcommand{\chaptermark}[2][\chaptername~\thechapter]{\markboth{\lsstyle\MakeUppercase{##1}}{\lsstyle\uppercase{##2}}}%
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{}% %Clean headers
\fancyfoot{}% %Clean footers
\fancyfoot[RO]{{\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}%
\fancyfoot[LE]{\thepage \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt}}%
\renewcommand{\headrulewidth}{0pt}% % Remove header rule
}
\begin{document}
\pagestyle{plain}
...pages in plain style...
\tableofcontents
\clearpage
\pagestyle{MyStyle}
\chapter{Introduction}
\section{First section}
\lipsum
\section{Second section}
\lipsum
\chapter{Second chapter title}
\section{Third section}
\lipsum
\section{Fourth section}
\lipsum
\nocite{*}
\clearpage
\renewcommand*\bibname{References}
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{plainnat}
\bibliography{refs}
\clearpage
\appendix
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\chaptermark[Appendix A]{Appendix A}
\lipsum\lipsum
\end{document}
编辑 编辑
这是同一个示例,但包含更新的序言的最小化和修改版本。也就是说,我最小化了重现问题所需的代码(或多或少 - 可能不是完全最小化),然后对其进行了更正以避免报告的问题。
主要变化如下:
不要定义
ref
pagestyle,因为这不是必需的,因为\chaptermark
在我之前的代码中重新定义了它,以适应论文正文以及参考文献和附录的样式;不要传递
pagestyles
给titlesec
并仅加载titlesec
一次 - 如果重新开始,最好保留titleps
并删除fancyhdr
,但由于代码已经根据您的需要定制,这似乎是不必要的工作。
因此:
\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=3.5cm,right=3.5cm,top=3.4cm,bottom=3.4cm]{geometry}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage[lf]{MinionPro} %% MinionPro
\usepackage[protrusion=true,expansion=true]{microtype}
\SetTracking[no ligatures = {f}]{encoding = }{100}
% Chapter
\usepackage[newparttoc, explicit]{titlesec}%
\usepackage{titletoc}
\titleformat{name=\chapter}[display]{\figureversion{lining}}{\lsstyle\Large\MakeUppercase\chaptername\enspace \LARGE\thechapter}{2ex}{\LARGE\bfseries#1}%\uppercase
\titleformat{name=\chapter, numberless}{\lsstyle\LARGE}{}{0pt}{\MakeUppercase{#1}} \titlespacing{\chapter}{0pt}{2.5ex}{6ex}
% Table of Contents
\titlecontents{chapter}[0em]{\large\bfseries\protect\addvspace{15pt}}%\thecontentslabel\brlap[1.25\baselineskip]
{\textssc{\mdseries\MakeLowercase\chaptername~{\footnotesize\thecontentslabel}}\\\medskip}
{}%
{\hfill\contentspage}%
\addtocontents{toc}{\protect\thispagestyle{empty}}
% References
\usepackage[round, colon, sort, authoryear]{natbib}
\setlength{\bibsep}{0.0pt}
\setlength{\bibhang}{2em}
\bibpunct{(}{)}{;}{a}{}{}
\setcitestyle{notesep={: }}
\def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}
% Page style
\usepackage{fancyhdr}
% Defining the DEFAULT style
\fancypagestyle{MyStyle}{%
\fancyhf{}%
\fancyfoot[RO]{\small\rightmark \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}%
\fancyfoot[LE]{\small\thepage \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \leftmark}%
\renewcommand{\headrulewidth}{0pt}% % Remove header rule
\renewcommand{\chaptermark}[2][\chaptername~\thechapter]{\markboth{\lsstyle\MakeUppercase{##1}}{\lsstyle\uppercase{##2}}}%
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhf{}% %Clean headers, footers
\fancyfoot[RO]{{\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}%
\fancyfoot[LE]{\thepage \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt}}%
\renewcommand{\headrulewidth}{0pt}% % Remove header rule
}
\begin{document}
\pagestyle{plain}
...pages in plain style...
\tableofcontents
\clearpage
\pagestyle{MyStyle}
\chapter{Introduction}
\section{First section}
\lipsum
\section{Second section}
\lipsum
\chapter{Second chapter title}
\section{Third section}
\lipsum
\section{Fourth section}
\lipsum
\nocite{*}
\clearpage
\renewcommand*\bibname{References}
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{plainnat}
\bibliography{refs}
\clearpage
\appendix
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\chaptermark[Appendix A]{Appendix A}
\lipsum\lipsum
\end{document}
答案2
由于这个问题使用了我之前答案中的代码,而 OP 仍然没有在他的文档中运行的代码,所以我会尝试一下。
首先,我不完全理解你的序言(例如正如@Cfr所述,没有定义\lsstyle
),因此我将根据你最初的代码来回答。
在我之前的回答中(包含正文的页码(不同面)) 我pagestyle
为整个文档定义了一个默认值,并plain
为了保持一致性而重新定义了。对于参考文献和附录,我做了同样的事情。这可能不是最好的方法,甚至可能是多余的,但通过这种方式,人们可以轻松地在同一个地方找到文档的所有样式。
产生所需输出的代码是:
\documentclass[12pt,a4paper,twoside]{report}
% Page layout
\usepackage[bindingoffset=0mm]{geometry}
% Random text
\usepackage{lipsum}
% Page style
\usepackage{fancyhdr}
% Defining the DEFAULT style
\fancypagestyle{MyStyle}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{\leftmark \ {\vrule height 13pt width 1pt} \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt} \MakeUppercase{\chaptername}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 13pt width 1pt} \ \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
% Defining the REFERENCES style
\fancypagestyle{Ref}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{\uppercase{References} \ {\vrule height 13pt width 1pt} \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt} \ \uppercase{References}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
% Defining the APPENDIX style
\fancypagestyle{App}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{\uppercase{Appendix A} \ {\vrule height 13pt width 1pt} \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt} \ \uppercase{Appendix A}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
\begin{document}
\pagestyle{plain}
...pages in plain style...
\pagestyle{MyStyle}
\chapter{Introduction}
\chaptermark{Introduction}
\section{First section}
\lipsum
\section{Second section}
\lipsum
\chapter{Second chapter title}
\section{Third section}
\lipsum
\section{Fourth section}
\lipsum
\clearpage
\pagestyle{Ref}
\chapter*{References}
\addcontentsline{toc}{chapter}{References}
\lipsum %...your bibliography goes here
\clearpage
\appendix
\pagestyle{App}
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\lipsum
\end{document}
不过,我有一些看法:
- 用作
\chapter*{}
参考文献是可以的,因为它们不是合适的章节,而且最重要的是,你通常只会使用它一次; - 相反,附录是一个章节,即通常它有自己的标题,并且可能有多个附录;在这种情况下,上述代码将不起作用,因为即使在附录 B 中,页脚也将是“附录 A”,依此类推。
当然,这些只是我的观点,因为如果你只有一个附录,代码就可以正常工作。但是,如果不是这种情况,你可能想要使用此代码:
\documentclass[12pt,a4paper,twoside]{report}
% Page layout
\usepackage[bindingoffset=0mm]{geometry}
% Random text
\usepackage{lipsum}
% Page style
\usepackage{fancyhdr}
% Defining the DEFAULT style
\fancypagestyle{MyStyle}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{\leftmark \ {\vrule height 13pt width 1pt} \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt} \MakeUppercase{\chaptername}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 13pt width 1pt} \ \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
% Defining the REFERENCES style
\fancypagestyle{Ref}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{\uppercase{References} \ {\vrule height 13pt width 1pt} \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt} \ \uppercase{References}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
% Defining the APPENDIX style
\fancypagestyle{App}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{\leftmark \ {\vrule height 13pt width 1pt} \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt} \MakeUppercase{\chaptername}\ \thechapter}
\renewcommand{\chaptername}{Appendix}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\uppercase{##1}}{}}
}
\begin{document}
\pagestyle{plain}
...pages in plain style...
\pagestyle{MyStyle}
\chapter{Introduction}
\chaptermark{Introduction}
\section{First section}
\lipsum
\section{Second section}
\lipsum
\chapter{Second chapter title}
\section{Third section}
\lipsum
\section{Fourth section}
\lipsum
\clearpage
\pagestyle{Ref}
\chapter*{References}
\addcontentsline{toc}{chapter}{References}
\lipsum %...your bibliography goes here
\cleardoublepage
\pagestyle{App}
\appendix
\chapter{First appendix title}
\lipsum
\chapter{Second appendix title}
\lipsum
\end{document}
您可以在您的文档中尝试使用带有完整序言的代码,看看它是否运行良好。