我知道还有其他类似的问题,但我没有找到我的特定问题的答案。
请考虑下面的 MWE。虽然章节编号包含在第一章的标题中,但它不适用于参考书目。我过去常常renewenvironment
阻止参考书目创建自己的章节,因为我需要章节编号和目录中的条目。
\documentclass{scrartcl}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\leftmark} % 1. sectionname
\fancyfoot[C]{\thepage}
\usepackage{filecontents}
\bibliographystyle{plain}
\usepackage[english]{babel}
\begin{filecontents}{\jobname.bib}
@article{DBLP:journals/corr/abs-1008-2849,
author = {Jan Wassenberg and Peter Sanders},
title = {Faster Radix Sort via Virtual Memory and Write-Combining},
eprinttype = {arxiv},
eprintclass = {cs.DS},
eprint = {1008.2849},
date = {2010-09-06},
pages = {1-8},
}
\end{filecontents}
\makeatletter
\renewenvironment{thebibliography}[1]
{ %\section{\bibname}% <-- this line was commented out
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\makeatother
\begin{document}
\section{first section}
some content
\nocite{*}
\newpage
\section{Bibliography}
\bibliography{\jobname}
\end{document}
您知道我可以做什么更改,以便在书目的 fancyhdr 标题中也包含章节号吗?它在所有其他章节中都正确显示。
答案1
bibliography=totocnumbered
这不是在 KOMA 课程中拥有编号参考书目的正确方法。您可以在加载时简单地添加选项scrartcl
:
\documentclass[bibliography=totocnumbered]{scrartcl}
如果您想将参考书目的标题从“参考文献”更改为“参考书目”,请在序言中添加以下行:
\AtBeginDocument{\renewcommand*{\refname}{Bibliography}}
fancyhdr
此外,不鼓励将 与 KOMA 类一起使用。scrlayer-scrpage
而应使用专为这些类设计的。
您的序言部分fancyhdr
可以替换为:
\usepackage[automark,headsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead[\headmark]{\headmark}
\cfoot[\pagemark]{\pagemark}
\pagestyle{scrheadings}
梅威瑟:
\documentclass[bibliography=totocnumbered]{scrartcl}
\usepackage[automark,headsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead[\headmark]{\headmark}
\cfoot[\pagemark]{\pagemark}
\pagestyle{scrheadings}
\usepackage{filecontents}
\bibliographystyle{plain}
\usepackage[english]{babel}
\begin{filecontents}{\jobname.bib}
@article{DBLP:journals/corr/abs-1008-2849,
author = {Jan Wassenberg and Peter Sanders},
title = {Faster Radix Sort via Virtual Memory and Write-Combining},
eprinttype = {arxiv},
eprintclass = {cs.DS},
eprint = {1008.2849},
date = {2010-09-06},
pages = {1-8},
}
\end{filecontents}
\AtBeginDocument{\renewcommand*{\refname}{Bibliography}}
\begin{document}
\section{first section}
some content
\nocite{*}
\newpage
\bibliography{\jobname}
\end{document}
输出: