使用自定义章节样式将 bib 添加到目录中

使用自定义章节样式将 bib 添加到目录中

使用 biblatex 时,我在目录中出现参考书目时遇到了一个简单的问题。我想要一个没有章节号的条目。使用heading=bibintoc默认布局选项可以正常工作。但是,如果我更改章节标题的定义(参见示例),目录中的条目是正确的,但章节本身以前一章的编号开头。

toc=bibliography此外,使用 koma 选项时也会发生同样的情况,但toc=listof效果很好。我认为过去它也适用于参考书目。

顺便说一句,这些软件包是最新的(biblatex 2015/04/19 v3.0,scrbook 2015/07/02 v3.18)。

这是 tex 文件:

\documentclass[oneside]{scrbook}

\usepackage[backend=bibtex]{biblatex}
\bibliography{MWE}

% For normal chapter
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
  \vspace*{20\p@}
  {\parindent \z@
    {\centering \reset@font
      \scshape  \large \@chapapp{} \thechapter\par\nobreak}
    \par\nobreak
    \vspace*{18\p@}
    \interlinepenalty\@M
    {\centering \Huge \bfseries #1\par\nobreak}
    \par\nobreak
    \vskip 35\p@
  }}

 % For list of contents etc.
\def\@makeschapterhead#1{%
  \vspace*{20\p@}%
  {\parindent \z@
    {\centering \reset@font
      \scshape \vphantom{\@chapapp{} \thechapter}\par\nobreak}%
    \par\nobreak
    \vspace*{18\p@}
    \interlinepenalty\@M
    {\centering \Huge \bfseries #1\par\nobreak}%
    \par\nobreak
    \vskip 33\p@
  }}
\makeatother

\begin{document}

\tableofcontents

\chapter{First Chapter}
Test text \cite{einstein}.

%\printbibliography[heading=bibliography]
\printbibliography[heading=bibintoc]
\end{document}

下面是一个 bib 文件示例:

@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
        [{On} the electrodynamics of moving bodies]",
    journal =      "Annalen der Physik",
    volume =       "322",
    number =       "10",
    pages =        "891--921",
    year =         "1905",
    DOI =          "http://dx.doi.org/10.1002/andp.19053221004"
}

答案1

不要重新定义内部命令\@makechapterhead\@makeschapterhead。您可以改用\RedeclareSectionCommand和重新定义\raggedchapter。如果没有\autodot仅适用于章节的,您还必须重新定义\chapterformat

\begin{filecontents*}{MWE.bib}
@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
        [{On} the electrodynamics of moving bodies]",
    journal =      "Annalen der Physik",
    volume =       "322",
    number =       "10",
    pages =        "891--921",
    year =         "1905",
    DOI =          "http://dx.doi.org/10.1002/andp.19053221004"
}
\end{filecontents*}
\documentclass[oneside
  ,chapterprefix
]{scrbook}

\usepackage[backend=bibtex]{biblatex}
\addbibresource{MWE.bib}

\RedeclareSectionCommand[
  beforeskip=34pt,
  innerskip=18pt,
  afterskip=35pt,
  font=\Huge\rmfamily,
  prefixfont=\normalfont\large\scshape
]{chapter}
\renewcommand*\raggedchapter{\centering}
\renewcommand*\raggedchapter{\centering}
\renewcommand*{\chapterformat}{% only if \autodot should be removed for chapters
  \mbox{\chapappifchapterprefix{\nobreakspace}\thechapter\IfUsePrefixLine{}{\enskip}}%
}

\begin{document}
\tableofcontents
\chapter{First Chapter}
Test text \cite{einstein}.
\printbibliography[heading=bibintoc]
\end{document}

在此处输入图片描述

相关内容