BibLaTeX langid 和 autolang=hyphen 使 csquotes 使用本地化引号

BibLaTeX langid 和 autolang=hyphen 使 csquotes 使用本地化引号

autolang=hyphen

将条目封闭在环境中。这将加载 条目字段hyphenrules中指定的语言的连字模式(如果可用)。 (手册,第 3.1.1 节)hyphenation
biblatex

这似乎只会影响连字,而不会影响其他语言设置。是这样吗?

langid

参考书目条目的语言 ID。hyphenation提供别名是为了向后兼容。
biblatex手册,第 2.2.3 节)

autostyle=true

不断调整引用样式以适应当前文档语言
csquotes手册,第 2.1 节)

理想情况下,将它们组合起来只会导致参考书目条目的连字符规则发生变化。相反,它还会导致引号更改为值langid。为什么会发生这种情况?可以解决吗?

文学

[1] 汉娜·穆勒。“拐角处”。 在:一本书。人力资源托拜厄斯·施密特 (Tobias Schmidt) 著。 Ein Verlag,2017年。

[2] 汉娜·穆勒。“齐塔特”。 在:屈勒杂志17.4(2031)。

[3] 简·史密斯.“哀歌”。 在:一些书。人力资源由史蒂文·史密斯 (Steven Smith) 撰写。出版商,1917 年。

[4] 简·史密斯。“引语”。 在:酷杂志13.7(2019)。

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british,german]{babel}
\usepackage[autostyle=true]{csquotes}
\usepackage[autolang=hyphen]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@incollection{wehklagen,
  author = {Müller, Hannah}, editor = {Schmidt, Tobias},
  title = {Wehklagen},       booktitle = {Einige Buch},
  year = {2017},             publisher = {Ein~Verlag},
  langid = {german},
}
@article{zitate,
  author = {Müller, Hannah}, title = {Zitate},
  year = {2031},             journal = {Kühle Zeitschrift},
  volume = {17},             number = {4},
  langid = {german},
}
@incollection{lamentations,
  author = {Smith, Jane},    editor = {Smith, Steven},
  title = {Lamentations},    booktitle = {Some book},
  year = {1917},             publisher = {A~Publisher},
  langid = {british},
}
@article{quotations,
  author = {Smith, Jane},    title = {Quotations},
  year = {2019},             journal = {Cool Journal},
  volume = {13},             number = {7},
  langid = {british},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

答案1

csquotes\languagename使用提供的命令来babel了解当前语言。

与文档中的代码解释目前声称的相反(第 102 页babel文档v. 3.14),hyphenrules环境实际上设置了\languagename

维护者babel确认解释正确,代码错误。该问题将在下一个babel版本中修复。

在此期间,您可以使用以下修改后的版本,hyphenrules该版本不设置\languagename。它只是原始版本的副本,并\languagename用以下版本替换\bbl@hyph@languagename

\makeatletter
\def\hyphenrules#1{%
  \edef\bbl@hyph@languagename{#1}%
  \bbl@fixname\bbl@hyph@languagename
  \bbl@iflanguage\bbl@hyph@languagename{%
    \expandafter\bbl@patterns\expandafter{\bbl@hyph@languagename}%
    \languageshorthands{none}%
    \expandafter\ifx\csname\bbl@hyph@languagename hyphenmins\endcsname\relax
      \set@hyphenmins\tw@\thr@@\relax
    \else
      \expandafter\expandafter\expandafter\set@hyphenmins
      \csname\bbl@hyph@languagename hyphenmins\endcsname\relax
    \fi}}
\let\endhyphenrules\@empty
\makeatother

通过此重新定义,您的 MWE 可以按预期工作

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british,german]{babel}
\usepackage[autostyle=true]{csquotes}
\usepackage[autolang=hyphen]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@incollection{wehklagen,
  author = {Müller, Hannah}, editor = {Schmidt, Tobias},
  title = {Wehklagen},       booktitle = {Einige Buch},
  year = {2017},             publisher = {Ein~Verlag},
  langid = {german},
}
@article{zitate,
  author = {Müller, Hannah}, title = {Zitate},
  year = {2031},             journal = {Kühle Zeitschrift},
  volume = {17},             number = {4},
  langid = {german},
}
@incollection{lamentations,
  author = {Smith, Jane},    editor = {Smith, Steven},
  title = {Lamentations},    booktitle = {Some book},
  year = {1917},             publisher = {A~Publisher},
  langid = {british},
}
@article{quotations,
  author = {Smith, Jane},    title = {Quotations},
  year = {2019},             journal = {Cool Journal},
  volume = {13},             number = {7},
  langid = {british},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\makeatletter
\def\hyphenrules#1{%
  \edef\bbl@hyph@languagename{#1}%
  \bbl@fixname\bbl@hyph@languagename
  \bbl@iflanguage\bbl@hyph@languagename{%
    \expandafter\bbl@patterns\expandafter{\bbl@hyph@languagename}%
    \languageshorthands{none}%
    \expandafter\ifx\csname\bbl@hyph@languagename hyphenmins\endcsname\relax
      \set@hyphenmins\tw@\thr@@\relax
    \else
      \expandafter\expandafter\expandafter\set@hyphenmins
      \csname\bbl@hyph@languagename hyphenmins\endcsname\relax
    \fi}}
\let\endhyphenrules\@empty
\makeatother

\begin{document}
\nocite{*}
\printbibliography
\end{document}

在此处输入图片描述

相关内容