我的参考书目细分为 2 个部分(已出版/在线参考)。我希望自动本地化这两个子标题,这由 babel 包的设置控制。
例如\usepackage[english]{babel}
:
参考书目
已发表参考文献列表
作者,A。(2013)——这是标题。
作者,B。(2013)——这是第二个标题。
在线参考文献列表
作者,A.(2013)- URLhttp://www.test.com
例如\usepackage[ngerman]{babel}
:
目录
文学目录
作者,A。(2013)——这是标题。
作者,B。(2013)——这是第二个标题。
互联网列表
作者,A.(2013)- URLhttp://www.test.com
我设置参考书目的命令如下:
\printbibheading[title={\bibname}]
\printbibliography[heading=subbibliography,title={\pubname},nottype=online]
\printbibliography[heading=subbibliography,title={\unpubname},type=online]
命令\pubname
和\unpubname
现在尚未定义。我不知道该怎么做。
我认为最好使用新的书目字符串,因为 的本地化\bibname
就是这样进行的。因此,我引入了 2 个书目字符串publishedSources
,unpublishedSources
然后针对不同的语言对其进行了定义。不幸的是,我不知道如何将这些值放入title
的键中\printbibliography
:
\NewBibliographyString{publishedSources,unpublishedSources}
\DefineBibliographyStrings{english}{%
publishedSources = {List of Published References},
unpublishedSources = {List of Online References},
}
\DefineBibliographyStrings{ngerman}{%
bibliography = {Quellenverzeichnis},
publishedSources = {Literaturverzeichnis},
unpublishedSources = {Liste der Internetquellen},
}
答案1
好吧,我找到了一种方法,但它需要破解一些biblatex
内部代码。
保留你的定义:
\NewBibliographyString{publishedSources,unpublishedSources}
\DefineBibliographyStrings{english}{%
publishedSources = {List of Published References},
unpublishedSources = {List of Online References},
}
\DefineBibliographyStrings{ngerman}{%
bibliography = {Quellenverzeichnis},
publishedSources = {Literaturverzeichnis},
unpublishedSources = {Liste der Internetquellen},
}
然后添加你的序言
\makeatletter
\def\blx@defbibstrings#1#2{%
\def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}%
\abx@dostrings
\csuse{abx@strings@#1}%
\setkeys{blx@lbx}{#2}%
\let\do\blx@defbibstrings@i
\csxdef{abx@strings@#1}{\abx@dostrings}%
\csgappto{abx@strings@#1}{%
\ifcsdef{\abx@str @bibliography}
{\letcs\bibname{\abx@str @bibliography}}
{\let\bibname\@empty}%
\ifcsdef{\abx@str @references}
{\letcs\refname{\abx@str @references}}
{\let\refname\@empty}%
\ifcsdef{\abx@str @shorthands}
{\letcs\losname{\abx@str @shorthands}}
{\let\losname\@empty}
\ifcsdef{\abx@str @publishedSources}
{\letcs\pubname{\abx@str @publishedSources}}
{\let\pubname\@empty}
\ifcsdef{\abx@str @unpublishedSources}
{\letcs\unpubname{\abx@str @unpublishedSources}}
{\let\unpubname\@empty}
}
}
\makeatother
因此,MWE
\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[style=authortitle,backend=biber]{biblatex}
\usepackage[ngerman]{babel}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}
\NewBibliographyString{publishedSources,unpublishedSources}
\DefineBibliographyStrings{english}{%
publishedSources = {List of Published References},
unpublishedSources = {List of Online References},
}
\DefineBibliographyStrings{ngerman}{%
bibliography = {Quellenverzeichnis},
publishedSources = {Literaturverzeichnis},
unpublishedSources = {Liste der Internetquellen},
}
\makeatletter
\def\blx@defbibstrings#1#2{%
\def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}%
\abx@dostrings
\csuse{abx@strings@#1}%
\setkeys{blx@lbx}{#2}%
\let\do\blx@defbibstrings@i
\csxdef{abx@strings@#1}{\abx@dostrings}%
\csgappto{abx@strings@#1}{%
\ifcsdef{\abx@str @bibliography}
{\letcs\bibname{\abx@str @bibliography}}
{\let\bibname\@empty}%
\ifcsdef{\abx@str @references}
{\letcs\refname{\abx@str @references}}
{\let\refname\@empty}%
\ifcsdef{\abx@str @shorthands}
{\letcs\losname{\abx@str @shorthands}}
{\let\losname\@empty}
\ifcsdef{\abx@str @publishedSources}
{\letcs\pubname{\abx@str @publishedSources}}
{\let\pubname\@empty}
\ifcsdef{\abx@str @unpublishedSources}
{\letcs\unpubname{\abx@str @unpublishedSources}}
{\let\unpubname\@empty}
}
}
\makeatother
\begin{document}
\cite{itzhaki}\cite{wassenberg}\cite{aksin}\cite{angenendt}
\printbibheading[title={\bibname}]
\printbibliography[heading=subbibliography,title={\pubname},nottype=online]
\printbibliography[heading=subbibliography,title={\unpubname},type=online]
\end{document}
产量