在 biblatex 中更改主标题和标题之间的分隔符

在 biblatex 中更改主标题和标题之间的分隔符

我已经想出了如何biblatex使用来更改标题和副标题之间的分隔符\subtitlepunct(如下面的 Larsen 1907 的条目所示),但是我如何才能对主标题和标题之间的分隔符进行相同的调整(如下面的 Bülbring 1902 的条目所示)?

\documentclass{article}
\usepackage{fontspec}
\usepackage[style=authoryear]{biblatex}
\renewcommand{\subtitlepunct}{\addcolon\addspace}
\begin{filecontents}{\jobname.bib}
@BOOK{bulbring1902,
    AUTHOR = "Karl D. Bülbring",
    TITLE = "Lautlehre",
    YEAR = "1902",
    LOCATION = "Heidelberg",
    MAINTITLE = "Altenglisches Elementarbuch",
    NUMBER = "4",
    PART = "1",
    PUBLISHER = "Carl Winter's Universitätsbuchhandlung",
    SERIES = "Sammlung germanischer Elementarbücher. I. Reihe: Grammatiken"}
@BOOK{larsen1907,
    AUTHOR = "Amund B. Larsen",
    TITLE = "Kristiania bymål",
    YEAR = "1907",
    LOCATION = "Kristiania",
    PUBLISHER = "Cammermeyers boghandel",
    SUBTITLE = "Vulgærsproget med henblik på den utvungne dagligtale"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{bulbring1902}\nocite{larsen1907}
\printbibliography
\end{document}

在此处输入图片描述

答案1

maintitle和之间title(或maintitlevolume和之间)的标点符号title被硬编码到 中biblatex(您会在 中找到默认值standard.bbx),因此我们必须修改打印 的命令maintitle

首先我们定义一个新的标点符号\maintitlepunct

\providecommand{\maintitlepunct}{\itshape\addcolon\addspace}
\renewcommand{\maintitlepunct}{\itshape\addcolon\addspace}

然后我们可以在宏中使用它。第一个宏现在将 放在和\maintitlepunct之间(如果没有指定音量),并将 标准放在和/之间,后面跟着 ,前面是。第二个宏基本上做同样的事情,但是代替。maintitletitle\newunitmaintitlevolumeparttitle\maintitlepunctbooktitletitle

\renewbibmacro*{maintitle+title}{%
  \iffieldsequal{maintitle}{title}
    {\clearfield{maintitle}%
     \clearfield{mainsubtitle}%
     \clearfield{maintitleaddon}}
    {\iffieldundef{maintitle}
       {}
       {\usebibmacro{maintitle}%
        %\newunit\newblock % commented out
        \iffieldundef{volume}
          {\setunit{\maintitlepunct}}% was empty
          {\newunit\newblock% this is new
           \printfield{volume}%
           \printfield{part}%
           \setunit{\addcolon\space}}}}%
  \usebibmacro{title}%
  \newunit}

\renewbibmacro*{maintitle+booktitle}{%
  \iffieldundef{maintitle}
    {}
    {\usebibmacro{maintitle}%
     %\newunit\newblock % commented out
     \iffieldundef{volume}
       {\setunit{\maintitlepunct}}% was empty
       {\newunit\newblock% this is new
        \printfield{volume}%
        \printfield{part}%
        \setunit{\addcolon\space}}}%
  \usebibmacro{booktitle}%
  \newunit}

数学家协会

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{bulbring1902,
    AUTHOR = "Karl D. Bülbring",
    TITLE = "Lautlehre",
    YEAR = "1902",
    LOCATION = "Heidelberg",
    MAINTITLE = "Altenglisches Elementarbuch",
    NUMBER = "4",
    PART = "1",
    PUBLISHER = "Carl Winter's Universitätsbuchhandlung",
    SERIES = "Sammlung germanischer Elementarbücher. I. Reihe: Grammatiken"}
@BOOK{larsen1907,
    AUTHOR = "Amund B. Larsen",
    TITLE = "Kristiania bymål",
    YEAR = "1907",
    LOCATION = "Kristiania",
    PUBLISHER = "Cammermeyers boghandel",
    SUBTITLE = "Vulgærsproget med henblik på den utvungne dagligtale"}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\renewcommand{\subtitlepunct}{\addcolon\addspace}

\providecommand{\maintitlepunct}{\itshape\addcolon\addspace}
\renewcommand{\maintitlepunct}{\itshape\addcolon\addspace}

\renewbibmacro*{maintitle+title}{%
  \iffieldsequal{maintitle}{title}
    {\clearfield{maintitle}%
     \clearfield{mainsubtitle}%
     \clearfield{maintitleaddon}}
    {\iffieldundef{maintitle}
       {}
       {\usebibmacro{maintitle}%
        %\newunit\newblock % commented out
        \iffieldundef{volume}
          {\setunit{\maintitlepunct}}% was empty
          {\newunit\newblock% this is new
           \printfield{volume}%
           \printfield{part}%
           \setunit{\addcolon\space}}}}%
  \usebibmacro{title}%
  \newunit}

\renewbibmacro*{maintitle+booktitle}{%
  \iffieldundef{maintitle}
    {}
    {\usebibmacro{maintitle}%
     %\newunit\newblock % commented out
     \iffieldundef{volume}
       {\setunit{\maintitlepunct}}% was empty
       {\newunit\newblock% this is new
        \printfield{volume}%
        \printfield{part}%
        \setunit{\addcolon\space}}}%
  \usebibmacro{booktitle}%
  \newunit}

\begin{document}
\nocite{bulbring1902,larsen1907,knuth:ct:a,knuth:ct:b}
\printbibliography
\end{document}

产量

在此处输入图片描述

相关内容