我添加了以下包:
\usepackage{scrlayer-scrpage}
\automark{chapter}
\clearpairofpagestyles
\setkomafont{pagehead}{\small\upshape}
\ohead{\rightmark}
\cfoot*{\pagemark}
\renewcommand*\chaptermarkformat{}
然而,这导致我的参考书目(参考文献)在目录中显示为章节而不是章节。有人知道为什么会这样吗?我已经试过了
\addcontentsline{toc}{chapter}{Bibliography}
这会将参考文献添加为章节,但是将参考文献添加为章节仍然保留。
有谁知道如何解决这个问题?
谢谢你!
答案1
根据您的第一个问题和上面给出的代码片段(最好向我们展示一个完整的简短文本代码,用于构建您的参考书目和目录,这样我们就不必猜测您在做什么......)首先是仅适用于 KOMA-Script 的解决方案。请注意,我添加了类选项bibliography=totoc,
(scrreprt
章节或所需scrbook
):
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Goossens,
author = {Goossens, Michel and Mittelbach, Frank and
Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980},
}
\end{filecontents}
\documentclass[%
fontsize=12pt,
titlepage,
paper=a4,
twoside,
bibliography=totoc, % <===============================================
]{scrreprt}
\usepackage{xurl}
\usepackage{scrlayer-scrpage}
\automark{chapter}
\clearpairofpagestyles
\setkomafont{pagehead}{\small\upshape}
\ohead{\rightmark}
\cfoot*{\pagemark}
\renewcommand*\chaptermarkformat{}
\begin{document}
\tableofcontents % <====================================================
\chapter{Chapter one}
\section{Section one}
\cite{Goossens} and \cite{adams}.
\urlstyle{same}
\bibliographystyle{plain} % <===========================================
\bibliography{\jobname} % <=============================================
\end{document}
及其结果:
请注意,参考书目以章节样式添加到目录中(红色箭头;与Chapter one
上面比较)。
在您的第一个问题中,您使用了apacite
。请注意,您必须[nosectionbib]
在调用中添加选项apacite
才能以章节样式获取目录中的参考书目:
\usepackage[nosectionbib]{apacite} % <=================================
请参阅以下完整 mwe
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Goossens,
author = {Goossens, Michel and Mittelbach, Frank and
Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980},
}
\end{filecontents}
\documentclass[%
fontsize=12pt,
titlepage,
paper=a4,
twoside,
bibliography=totoc, % <===============================================
]{scrreprt}
\usepackage[nosectionbib]{apacite} % <=================================
\bibliographystyle{apacite}
\usepackage{xurl}
\usepackage{scrlayer-scrpage}
\automark{chapter}
\clearpairofpagestyles
\setkomafont{pagehead}{\small\upshape}
\ohead{\rightmark}
\cfoot*{\pagemark}
\renewcommand*\chaptermarkformat{}
\begin{document}
\tableofcontents
\chapter{Chapter one}
\section{Section one}
\cite{Goossens} and \cite{adams}.
\urlstyle{same}
\bibliography{\jobname} % <=============================================
\end{document}
及其结果:
答案2
非常感谢您的快速回复。我改变了
\usepackage{apacite}
到
\usepackage[nosectionbib]{apacite}
现在它正在工作!