scrbook 中的参考书目

scrbook 中的参考书目

我正在使用 WinEdt QuickGuide.tex 作为模板,并尝试在我的序言中加入以下内容的参考书目:

\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{C:/Superstar/Desktop/HomeWork/References/chap1.bib}
 \defbibheading{bibempty}{}
 \newcommand*{\refname}{Bibliography}

然后在我使用的文档中:

\chapter*{Bibliography}
\addcontentsline{toc}{chapter}{Bibliography}
\section*{Books}
\addcontentsline{toc}{section}{Books}
\printbibliography[heading=bibempty,type=book,prefixnumbers={B}]
\section*{Articles}
\addcontentsline{toc}{section}{Articles}
\printbibliography[heading=bibempty,type=article,prefixnumbers={A}]
\section*{Online}
\addcontentsline{toc}{section}{Online}
\printbibliography[heading=bibempty,type=misc,prefixnumbers={O}]

但后来我得到了错误\protect...ing=bibempty,type=book,...

是不是因为我在课堂上 scrbook而不是在书本上使用了此命令?如果是这样,我该如何在课堂上解决这个问题scrbook

以下是出现问题的最小示例:

\documentclass{scrbook}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{expl3,xparse}
\ExplSyntaxOn% syntax of expl3 on
%
\cs_new_eq:Nc \emph_old:n { emph~ } % Copying the old definition of `\emph`
\cs_new_eq:NN \emph_braces:n \textup % Braces should be typeset upright.
%
\cs_new:Npn \emph_new:n #1 {
  \tl_set:Nn \l_emph_tl {#1}
  \tl_replace_all:Nnn \l_emph_tl {(}{\emph_braces:n{(}}
  \tl_replace_all:Nnn \l_emph_tl {)}{\emph_braces:n{)}}
  \tl_replace_all:Nnn \l_emph_tl {[}{\emph_braces:n{[}}
  \tl_replace_all:Nnn \l_emph_tl {]}{\emph_braces:n{]}}
  \exp_args:NV \emph_old:n \l_emph_tl
}
%
% \emph umdefinieren, Sternvariante mit altem (=kursivem) Verhalten
\RenewDocumentCommand {\emph} {sm} {
  \IfBooleanTF {#1} {\emph_old:n {#2}} {\emph_new:n {#2}}
}
%
\ExplSyntaxOff% syntax of expl3 on


\begin{document}


\backmatter
\printbibheading[heading=bibintoc,title=\bibname]
\printbibliography[heading=subbibintoc,type=book,prefixnumbers={B},title={Books}]
\printbibliography[heading=subbibintoc,type=article,prefixnumbers={A},title={Articles}]
\printbibliography[heading=subbibintoc,type=online,prefixnumbers={O},title={Online}]

\end{document}

这是我收到的错误:

Package biblatex Warning: Setting 'defernumbers=true' recommended.


Package biblatex Warning: Option 'prefixnumbers' requires global
(biblatex)                'defernumbers=true' on input line 33.

! Missing \endcsname inserted.
<to be read again> 
                   \protect 
l.33 ...type=book,prefixnumbers={B},title={Books}]

答案1

这段 LaTeX3 代码用于将强调部分内的括号和圆括号竖直放置沉重titlecase与机制(可能更多)的斗争biblatex

防止这种情况的一种方法是局部切换回正常行为。这当然意味着参考书目或引用中的括号和方括号将变为斜体。另一方面,每个带有可选参数的命令都将失败在新的范围内emph

乔·纽埃姆

\documentclass{article}
\usepackage[defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{expl3,xparse}
\usepackage{graphicx}
\ExplSyntaxOn% syntax of expl3 on

\cs_new_eq:Nc \emph_old:n { emph~ } % Copying the old definition of `\emph`
\cs_new_eq:NN \emph_braces:n \textup % Braces should be typeset upright.
\cs_new:Npn \emph_new:n #1 {
    \tl_set:Nn \l_emph_tl {#1}
    \tl_replace_all:Nnn \l_emph_tl {(}{\emph_braces:n{(}}
    \tl_replace_all:Nnn \l_emph_tl {)}{\emph_braces:n{)}}
    \tl_replace_all:Nnn \l_emph_tl {[}{\emph_braces:n{[}}
    \tl_replace_all:Nnn \l_emph_tl {]}{\emph_braces:n{]}}
    \exp_args:NV \emph_old:n \l_emph_tl
}
\RenewDocumentCommand {\emph} {sm} {
    \IfBooleanTF {#1} {\emph_old:n {#2}}
    {\emph_new:n {#2}}
}
          %
\AtEveryCitekey{\RenewDocumentCommand{\emph}{m}{%
    \emph_old:n {#1}}
}
\AtBeginBibliography{\RenewDocumentCommand{\emph}{m}{%
    \emph_old:n {#1}}
}
\ExplSyntaxOff% syntax of expl3 on


\begin{document}
\nocite{averroes/hercz}

\emph{(Vater und Sohn)}\par
\emph*{(Vater und Sohn)}
\printbibliography
\end{document}

joeBiblatexL3Emph

\documentclass{article}
\usepackage[defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{expl3,xparse}
\ExplSyntaxOn% syntax of expl3 on

\cs_new_eq:Nc \emph_old:n { emph~ } % Copying the old definition of `\emph`
\cs_new_eq:NN \emph_braces:n \textup % Braces should be typeset upright.
\cs_new:Npn \emph_new:n #1 {
    \tl_set:Nn \l_emph_tl {#1}
    \tl_replace_all:Nnn \l_emph_tl {(}{\emph_braces:n{(}}
    \tl_replace_all:Nnn \l_emph_tl {)}{\emph_braces:n{)}}
    \tl_replace_all:Nnn \l_emph_tl {[}{\emph_braces:n{[}}
    \tl_replace_all:Nnn \l_emph_tl {]}{\emph_braces:n{]}}
    \exp_args:NV \emph_old:n \l_emph_tl
}
\RenewDocumentCommand {\emph} {sm} {
    \IfBooleanTF {#1} {\emph_old:n {#2}}
    {\emph_new:n {#2}}
}
          %
\AtEveryCitekey{\RenewDocumentCommand{\emph}{m}{%
    \emph_old:n {#1}}
}
\AtBeginBibliography{\RenewDocumentCommand{\emph}{m}{%
    \emph_old:n {#1}}
}
\ExplSyntaxOff% syntax of expl3 on


\begin{document}
\fullcite{companion}

\emph{[test]}

\printbibliography

\nocite{*}

\printbibheading[heading=bibintoc,title=\bibname]
\printbibliography[heading=subbibintoc,type=book,prefixnumbers={B},title={Books}]
\printbibliography[heading=subbibintoc,type=article,prefixnumbers={A},title={Articles}]
\printbibliography[heading=subbibintoc,type=online,prefixnumbers={O},title={Online}]


\emph{[test)}\par
\emph*{[test)}

\end{document}

软件包biblatex提供了一组宏来帮您省去麻烦。它负责设置正确的标题,并将其放入目录中(如果您希望它在那里)。

\documentclass{scrbook}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{*}
\tableofcontents
\printbibheading[heading=bibintoc,title=\bibname]
\printbibliography[heading=subbibintoc,type=book, title={books}]
\printbibliography[type=online, heading=subbibintoc, title={Online}]
\printbibliography[heading=subbibintoc,type=article,title={Articles}]
\end{document}

相关内容