多语言文献中的标点符号规则

多语言文献中的标点符号规则

我想要一个(biblatex)参考书目,其中:

  • 无论条目的语言是什么,参考书目的语言始终相同。我不想翻译或本地化以下内容:页码或卷号、译者或编辑数据、作者姓名布局...
  • 作品标题遵循作品语言的标点间距规则。通常:英文中“?”前无空格,法文中“?”前不可间断空格。

我已经测试了 biblatex 的各种组合languageautolang参数,但目前尚未成功。例如,在下面的 MWE 中:

  • autolang=other
    • 更正标点符号间距以切换标点符号规则,遵循langid每个条目的。
    • 不需要的本地化,如:“Trans. by”/“Trad. par”、“p.”/“pp.”、作者姓名是否为小写大写……
  • autolang=hyphen
    • 为参考书目提供正确的单一语言(两种情况下均为“Trad. par”)
    • 错误的印刷字体:法语中“?”之前的空格丢失。
\documentclass{article}
\usepackage[english,french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{filecontents}

\begin{filecontents}{biblio.bib}
@book{compagnon,
  author     = {Compagnon, Antoine},
  translator = {Même, Moi},
  date       = {1998},
  title      = {Titre: aléatoire?},
  pages      = {306-723},
  langid     = {french},
}
@book{glashow,
  author       = {Glashow, Sheldon},
  title        = {Random: title?},
  translator   = {Self, My},
  date         = {1961},
  pages        = {579-588},
  langid       = {english},
}
\end{filecontents}

\usepackage[backend=biber,
    style=verbose-trad2,
    singletitle=true,
    autolang=other,
]{biblatex}  
\addbibresource{biblio.bib}

\begin{document}
\footcite{compagnon}
\footcite{glashow}
\printbibliography
\end{document}

潜在的关闭问题:

  • 经常有人建议添加\foreignlanguage{...}标题字段。我再也找不到用户 moewe 的一篇非常有教育意义的帖子,他解释了 biblatex 没有针对每个字段的语言选项,并提出了不同的策略。
  • 正确的标点,但在入门级方面存在不必要的本地化。
  • 正确的连字,但不受标点符号规则的限制。
  • 潜在的解决方案在 lualatex 中?不确定为什么它会有所不同。

答案1

正如所讨论的https://github.com/plk/biblatex/issues/757根据字段更改语言,第 2 部分:字体、大小写转换和排序这是相当棘手的问题,最好在biblatex核心中解决。但这需要大量的基础工作,目前仍在进行中。

以下是基于答案babel的版本polyglossia根据字段更改语言,第 2 部分:字体、大小写转换和排序这应该会让你走得更远一些。

\documentclass{article}
\usepackage[english,french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[backend=biber,
    style=verbose-trad2,
    singletitle=true,
]{biblatex}

\makeatletter
\def\blx@thefakelangenv{otherlanguage}%

\def\blx@beglang@fake{%
  \blx@clearlang
  \begingroup
  \ifdef\abx@field@langid
    {\def\blx@endlang@fake{%
       \end{otherlanguage*}%
       \endgroup}%
     \begin{otherlanguage*}{\abx@field@langid}}
    {}}

\let\blx@endlang@fake\relax

\renewrobustcmd*{\blx@imc@printfield}[2][]{%
  \blx@imc@iffieldundef{#2}
    {\blx@nounit}
    {\blx@getformat\blx@theformat{ffd}{#1}{#2}%
     \ifdefvoid\blx@theformat
       {\blx@nounit}
       {\blx@begunit
        \let\blx@theformat@outer\blx@theformat
        \def\blx@theformat##1{\blx@theformat@outer{\blx@beglang@fake ##1\blx@endlang@fake}}%
        \edef\currentfield{#2}%
        \expandafter\expandafter
        \expandafter\blx@theformat
        \expandafter\expandafter
        \expandafter{\csname abx@field@#2\endcsname}%
        \blx@endunit}}}

\long\def\blx@nameparser@i#1#2{%
  \begingroup
  \ifblank{#1}
    {}
    {\setkeys{blx@opt@name}{#1}}%
  \setkeys{blx@opt@namepart}{#2}%
  \blx@beglang@fake\blx@theformat{#2}\blx@endlang@fake
  \endgroup}

\long\def\blx@listparser#1{%
  \ifblank{#1}
    {\blx@listbreak}
    {\ifnum\c@listcount<\c@liststart
     \else
       \blx@beglang@fake\blx@theformat{#1}\blx@endlang@fake
     \fi
     \advance\c@listcount\@ne
     \ifnum\c@listcount>\c@liststop
       \expandafter\blx@listbreak
     \fi
     \blx@listparser}}
\makeatother


\begin{filecontents}{\jobname.bib}
@book{compagnon,
  author     = {Compagnon, Antoine and Someone Else},
  translator = {Même, Moi},
  date       = {1998},
  title      = {Titre: aléatoire?},
  pages      = {306-723},
  langid     = {french},
}
@book{glashow,
  author       = {Glashow, Sheldon and Someone Else},
  title        = {Random: title?},
  translator   = {Self, My},
  date         = {1961},
  pages        = {579-588},
  langid       = {english},
}
\end{filecontents} 
\addbibresource{\jobname.bib}

\begin{document}
\footcite{compagnon}
\footcite{glashow}
\printbibliography
\end{document}

“Compagnon,Antoine 等。标题:随机?由 Moi Même 翻译。1998 年,306-723。” (冒号和问号前有空格)“Glashow, Sheldon et Someone Else。随机:标题?Trad. par My Self。1961,579-588。” (冒号和问号前没有空格)


正如评论中所讨论的,这种方法存在一些缺点,因为将语言切换代码直接应用于字段内容并不总是可取的。

我无法提供一个很好的替代方法,因为在应用字段格式等之后更改语言会影响 bibstring(它们应该保持不变)。我可以提供一个临时解决方案,允许您免除某些字段的语言切换(当然,如果这对您来说更好,您可以反转逻辑,只对某些字段进行语言切换)。

\documentclass{article}
\usepackage[english,french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[backend=biber,
    style=verbose-trad2,
    singletitle=true,
]{biblatex}

\makeatletter
\newcommand*{\mblx@exemptfields}{}
\newrobustcmd*{\ExemptFromLanguageSwitching}{%
  \forcsvlist{\listgadd\mblx@exemptfields}}

\def\blx@thefakelangenv{otherlanguage}%

\def\blx@beglang@fake{%
  \blx@clearlang
  \begingroup
  \ifdef\abx@field@langid
    {\def\blx@endlang@fake{%
       \end{otherlanguage*}%
       \endgroup}%
     \begin{otherlanguage*}{\abx@field@langid}}
    {}}

\let\blx@endlang@fake\relax

\renewrobustcmd*{\blx@imc@printfield}[2][]{%
  \blx@imc@iffieldundef{#2}
    {\blx@nounit}
    {\blx@getformat\blx@theformat{ffd}{#1}{#2}%
     \ifdefvoid\blx@theformat
       {\blx@nounit}
       {\blx@begunit
        \ifinlist{#2}{\mblx@exemptfields}
          {}
          {\let\blx@theformat@outer\blx@theformat
           \def\blx@theformat##1{\blx@theformat@outer{\blx@beglang@fake ##1\blx@endlang@fake}}}%
        \edef\currentfield{#2}%
        \expandafter\expandafter
        \expandafter\blx@theformat
        \expandafter\expandafter
        \expandafter{\csname abx@field@#2\endcsname}%
        \blx@endunit}}}


\catcode`\&=3
\def\blx@printnames#1#2#3#4{%
  \blx@imc@ifnameundef{#4}
    {\blx@nounit}
    {\def\mblx@currentname{#4}%
     \blx@getformat\blx@thewrapperformat{nwd}{#1}{#4}%
     \ifdefvoid\blx@thewrapperformat
       {\blx@nounit}
       {\blx@getformat\blx@theformat{nfd}{#1}{#4}%
        \ifdefvoid\blx@theformat
          {\blx@nounit}
          {\blx@begunit
           \blx@namesetup{#2}{#3}{#4}%
           \blx@thewrapperformat{\expandafter\blx@nameparser\blx@thedata{}&}%
           \blx@endunit}}}}

\def\blx@indexnames#1#2#3#4{%
  \blx@imc@ifnameundef{#4}
    {}
    {\def\mblx@currentname{#4}%
     \blx@getformat\blx@theformat{nid}{#1}{#4}%
     \ifdefvoid\blx@theformat
       {}
       {\begingroup
        \blx@namesetup{#2}{#3}{#4}%
        \blx@indexnamesetup
        \expandafter\blx@nameparser\blx@thedata{}&%
        \endgroup}}}

\long\def\blx@nameparser@i#1#2{%
  \begingroup
  \ifblank{#1}
    {}
    {\setkeys{blx@opt@name}{#1}}%
  \setkeys{blx@opt@namepart}{#2}%
  \expandafter\ifinlist\expandafter{\mblx@currentname}{\mblx@exemptfields}
    {\blx@theformat{#2}}
    {\blx@beglang@fake\blx@theformat{#2}\blx@endlang@fake}%
  \endgroup}


\def\blx@printlist#1#2#3#4{%
  \blx@imc@iflistundef{#4}
    {\blx@nounit}
    {\def\mblx@currentlist{#4}%
     \blx@getformat\blx@thewrapperformat{lwd}{#1}{#4}%
     \ifdefvoid\blx@thewrapperformat
       {\blx@nounit}
       {\blx@getformat\blx@theformat{lfd}{#1}{#4}%
        \ifdefvoid\blx@theformat
          {\blx@nounit}
          {\blx@begunit
           \blx@listsetup{#2}{#3}{#4}%
           \blx@thewrapperformat{\expandafter\blx@listparser\blx@thedata{}&}%
           \blx@endunit}}}}

\def\blx@indexlist#1#2#3#4{%
  \blx@imc@iflistundef{#4}
    {}
    {\def\mblx@currentlist{#4}%
     \blx@getformat\blx@theformat{lid}{#1}{#4}%
     \ifdefvoid\blx@theformat
       {}
       {\begingroup
        \blx@listsetup{#2}{#3}{#4}%
        \expandafter\blx@listparser\blx@thedata{}&%
        \endgroup}}}

\long\def\blx@listparser#1{%
  \ifblank{#1}
    {\blx@listbreak}
    {\ifnum\c@listcount<\c@liststart
     \else
       \expandafter\ifinlist\expandafter{\mblx@currentlist}{\mblx@exemptfields}
         {\blx@theformat{#1}}
         {\blx@beglang@fake\blx@theformat{#1}\blx@endlang@fake}%
     \fi
     \advance\c@listcount\@ne
     \ifnum\c@listcount>\c@liststop
       \expandafter\blx@listbreak
     \fi
     \blx@listparser}}
\makeatother
\catcode`\&=4

\ExemptFromLanguageSwitching{url,doi,eprint,pages}


\begin{filecontents}[force]{\jobname.bib}
@book{compagnon,
  author     = {Compagnon, Antoine and Someone Else},
  translator = {Même, Moi},
  date       = {1998},
  title      = {Titre: aléatoire?},
  pages      = {306-723},
  langid     = {french},
  url        = {https://example.com/~stuff/more.pdf},
}
@book{glashow,
  author       = {Glashow, Sheldon and Someone Else},
  title        = {Random: title?},
  translator   = {Self, My},
  date         = {1961},
  pages        = {579-588},
  langid       = {english},
  url          = {https://example.com/~stuff/more.pdf},
}
\end{filecontents} 
\addbibresource{\jobname.bib}

\begin{document}
\footcite{compagnon}
\footcite{glashow}
\printbibliography
\end{document}

相关内容