我使用biblatex
和csquotes
包babel
。有时标题中的单词会放在引号中。通常我使用\enquote
引号。我希望参考书目中的引号样式取决于字段langid
。我该如何实现?
最小示例
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, ngerman]{babel}
\usepackage[autostyle=true]{csquotes}
\usepackage[style=apa, autolang=hyphen]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Maximini2018,
author = {Dominik Maximini},
title = {Scrum -- Einführung in der Unternehmenspraxis: Von \enquote{starren} Strukturen zu agilen Kulturen},
year = {2018},
publisher = {Springer},
address = {Berlin},
langid = {ngerman},
}
@Book{SchwaberSutherland2017,
author = {Schwaber, Ken and Sutherland, Jeff},
title = {The Scrum Guide\textsuperscript{TM}: The \enquote{Definitive} Guide to Scrum: The Rules of the Game},
year = {2017},
langid = {english},
url = {https://www.scrumguides.org/docs/scrumguide/v2017/2017-Scrum-Guide-US.pdf},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
答案1
在这种情况下,对引号进行硬编码确实可能更安全。无论如何……可以csquotes
自动更改其引号。
csquotes
响应当前语言,如 中所示\languagename
。并且hyphenation
环境不再设置\languagename
(请参阅BibLaTeX langid 和 autolang=hyphen 使 csquotes 使用本地化引号)。因此,\enquote
在您的示例中,仍然使用文档语言的引号。情况会有所不同,autolang=other
因为该设置使用的环境会更改\languagename
。但它也会改变 bibstring 的本地化,因此“Zugriff unter”将被翻译成英语,这可能是不理想的。
如果你想告诉在条目中csquotes
使用langid
引号,可以使用
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, ngerman]{babel}
\usepackage[autostyle=true]{csquotes}
\usepackage[style=apa, autolang=hyphen]{biblatex}
\makeatletter
\def\blxcsq@resetstyle@langid{%
\ifnum\csq@reset=\@ne
\iffieldundef{langid}
{\let\blxcsq@tempa\languagename}
{\edef\blxcsq@tempa{\thefield{langid}}}%
\ifx\csq@currentstyle\blxcsq@tempa
\else
\ifcsundef{csq@qstyle@\blxcsq@tempa}
{\csq@warn@style\blxcsq@tempa
\csq@setstyle{fallback}}
{\csq@setstyle{\blxcsq@tempa}}%
\fi
\fi}
\AtEveryBibitem{\let\csq@resetstyle\blxcsq@resetstyle@langid}
\makeatletter
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Maximini2018,
author = {Dominik Maximini},
title = {Scrum -- Einführung in der Unternehmenspraxis: Von \enquote{starren} Strukturen zu agilen Kulturen},
year = {2018},
publisher = {Springer},
address = {Berlin},
langid = {ngerman},
}
@Book{SchwaberSutherland2017,
author = {Schwaber, Ken and Sutherland, Jeff},
title = {The Scrum Guide\textsuperscript{TM}: The \enquote{Definitive} Guide to Scrum: The Rules of the Game},
year = {2017},
langid = {english},
url = {https://www.scrumguides.org/docs/scrumguide/v2017/2017-Scrum-Guide-US.pdf},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{Maximini2018,SchwaberSutherland2017}
\printbibliography
\end{document}