我知道還有其他類似的問題,但我沒有找到我的特定問題的答案。
請考慮下面的 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
這不是 KOMA 課程中編號參考書目的正確方法。您只需bibliography=totocnumbered
在加載時添加選項即可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}
輸出: