在 biblatex 中将“inbook”条目的作者视为“incollection”条目的编辑者

在 biblatex 中将“inbook”条目的作者视为“incollection”条目的编辑者

这是在 biblatex 书目中移动编辑者姓名其中书目中的编辑字符串“edited by X”biblatex被替换为“X edited”(并将“edited”一词翻译为当地语言)。

接受的答案将其扩展到集合(@incollection条目)中存在文章的情况,参见下面 MWE 中的 Weinreich 1968 条目。

我也想要的是:当我引用一本书的一部分(有自己的标题和作者,即条目@inbook)时,我希望这本书的作者在书名后面加上字符串“X 写了”,与上面提到的“X 编辑”的情况类似。

对于下面 MWE 中的 Torp 1909 条目,我希望它看起来像这样:

托普,阿尔夫。 1909. 挪威语。加马尔诺斯克奥尔德博克。中新挪威语。Marius Hægstad 和 Alf Torp 著。克里斯蒂安尼亚:《挪威湖泊(Landsmaals-laget)》,第 xxviii-lxxi 页。

我怎样才能实现这个目标?

在此处输入图片描述

\documentclass{article}

\usepackage[backend=biber,
    style = authoryear-comp,
    language = nynorsk,
    sortlocale = nn_NO]{biblatex}

\renewbibmacro{in:}{} % don't print "in" for any entry
\DeclareFieldFormat[article,inbook,incollection]{title}{#1} % no quotes around titles in bibliography (print as is)

\DeclareFieldFormat{editortype}{\mkbibparens{#1}} % put editor in parenthesis when before publication year
\DeclareDelimFormat{editortypedelim}{\addspace}

\usepackage{xpatch}
    \xpatchbibmacro{date+extradate}{\printtext[parens]}{\setunit*{\addperiod\space}\printtext}{}{} % remove parenthesis around year in bibliography

\DefineBibliographyStrings{nynorsk}{
    bibliography = {Tilvisingar},
    editor = {styr\adddot},
    editors = {styr\adddot},
    founder = {grunnar},
    founders = {grunnarar},
    references = {Tilvisingar},
    byauthor = {skreiv},
    byeditor = {styrde},
    byfounder = {grunnade},
    volume = {band},
    volumes = {band},
}

\renewbibmacro*{byauthor}{%
  \ifboolexpr{
    test \ifuseauthor
    or
    test {\ifnameundef{author}}
  }
    {}
    {\printnames[byauthor]{author}%
     \setunit{\addspace}%
     \usebibmacro{bytypestrg}{author}{author}}}

\newbibmacro*{byeditorx:i}[1]{%
  \ifnameundef{#1}
    {}
    {\printnames[by#1]{#1}%
     \setunit{\addspace}%
     \usebibmacro{bytypestrg}{#1}{editor}%
     \newunit}}

\renewbibmacro*{byeditor}{%
  \usebibmacro{byeditorx:i}{editor}%
  \usebibmacro{byeditorx}}

\renewbibmacro*{byeditorx}{%
  \usebibmacro{byeditorx:i}{editora}%
  \usebibmacro{byeditorx:i}{editorb}%
  \usebibmacro{byeditorx:i}{editorc}}

\renewbibmacro*{bytranslator}{%
  \ifnameundef{translator}
    {}
    {\printnames[bytranslator]{translator}%
     \setunit{\addspace}%
     \bibstring{bytranslator}}}

\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\printnames[byeditor]{editor}%
     \setunit{\addspace}%
     \usebibmacro{byeditor+othersstrg}%
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

\renewbibmacro*{bytranslator+others}{%
  \ifnameundef{translator}
    {}
    {\printnames[bytranslator]{translator}%
     \setunit{\addspace}%
     \usebibmacro{bytranslator+othersstrg}%
     \clearname{translator}%
     \newunit}%
  \usebibmacro{withothers}}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}

@BOOK{flo1906,
    AUTHOR = "R. Flo",
    TITLE = "Midlandsmaal",
    YEAR = "1906",
    EDITOR = "Arne Garborg",
    LOCATION = "Kristiania",
    PUBLISHER = "Olaf Norlis forlag",
    SUBTITLE = "Etter framlegge fraa rettskrivingsnemndi i 1899"}

@BOOK{ordbogoverdetdanskesprog,
    TITLE = "Ordbog over det danske sprog",
    YEAR = "1919--56",
    EDITOR = "H. Juul-Jensen",
    EDITORA = "Verner Dahlerup",
    EDITORATYPE = "founder",
    LOCATION = "K{\o}benhavn",
    NOTE = "Udgivet af det danske sprog- og litteraturselskab",
    PUBLISHER = "Gyldendalske boghandel. Nordisk forlag",
    VOLUMES = "28"}

@INBOOK{torp1909,
    AUTHOR = "Alf Torp",
    BOOKTITLE = "Gamalnorsk ordbok",
    TITLE = "Gamalnorsk ordavleiding",
    YEAR = "1909",
    BOOKAUTHOR = "Marius H{\ae}gstad and Alf Torp",
    BOOKSUBTITLE = "Med nynorsk tyding",
    LOCATION = "Kristiania",
    PAGES = "xxviii--lxxi",
    PUBLISHER = "Det norske samlaget (Landsmaals-laget)"}

@INCOLLECTION{weinreich1968,
    AUTHOR = "Uriel Weinreich and William Labov and Marvin I. Herzog",
    BOOKTITLE = "Directions for historical linguistics",
    EDITOR = "W. P. Lehmann and Yakov Malkiel",
    TITLE = "Empirical foundations for a theory of language change",
    YEAR = "1968",
    BOOKSUBTITLE = "A symposium",
    LOCATION = "Austin, TX",
    PAGES = "95--195",
    PUBLISHER = "University of Texas Press"}

\end{filecontents*}
\addbibresource{\jobname.bib}

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

答案1

有问题的名称由需要重新定义的 bibmacro 打印,bybookauthor类似于byauthor

\renewbibmacro*{bybookauthor}{%
  \ifnamesequal{author}{bookauthor}
    {}
    {\printnames[bybookauthor]{bookauthor}%
     \setunit{\addspace}%
     \usebibmacro{bytypestrg}{bookauthor}{author}}}

默认情况下,在打印bybookauthor之前调用boobktitle。如果我们想在标题后打印名称,我们需要更改驱动程序中宏的位置。这可以xpatch通过\xpatchbibdriver

\xpatchbibdriver{inbook}
  {\usebibmacro{bybookauthor}%
   \newunit\newblock}
  {}
  {}{}

\xpatchbibdriver{inbook}
  {\usebibmacro{byeditor+others}}
  {\usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}

总共

\documentclass{article}

\usepackage[backend=biber,
    style = authoryear-comp,
    language = nynorsk,
    sortlocale = nn_NO]{biblatex}

\renewbibmacro{in:}{}
\DeclareFieldFormat[article,inbook,incollection]{title}{#1}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

\usepackage{xpatch}
\xpatchbibmacro{date+extradate}
  {\printtext[parens]}
  {\setunit*{\addperiod\space}\printtext}
  {}{}

\DefineBibliographyStrings{nynorsk}{
    bibliography = {Tilvisingar},
    editor = {styr\adddot},
    editors = {styr\adddot},
    founder = {grunnar},
    founders = {grunnarar},
    references = {Tilvisingar},
    byauthor = {skreiv},
    byeditor = {styrde},
    byfounder = {grunnade},
    volume = {band},
    volumes = {band},
}

\renewbibmacro*{bybookauthor}{%
  \ifnamesequal{author}{bookauthor}
    {}
    {\printnames[bybookauthor]{bookauthor}%
     \setunit{\addspace}%
     \usebibmacro{bytypestrg}{bookauthor}{author}}}

\xpatchbibdriver{inbook}
  {\usebibmacro{bybookauthor}%
   \newunit\newblock}
  {}
  {}{}

\xpatchbibdriver{inbook}
  {\usebibmacro{byeditor+others}}
  {\usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}

\renewbibmacro*{byauthor}{%
  \ifboolexpr{
    test \ifuseauthor
    or
    test {\ifnameundef{author}}
  }
    {}
    {\printnames[byauthor]{author}%
     \setunit{\addspace}%
     \usebibmacro{bytypestrg}{author}{author}}}

\newbibmacro*{byeditorx:i}[1]{%
  \ifnameundef{#1}
    {}
    {\printnames[by#1]{#1}%
     \setunit{\addspace}%
     \usebibmacro{bytypestrg}{#1}{editor}%
     \newunit}}

\renewbibmacro*{byeditor}{%
  \usebibmacro{byeditorx:i}{editor}%
  \usebibmacro{byeditorx}}

\renewbibmacro*{byeditorx}{%
  \usebibmacro{byeditorx:i}{editora}%
  \usebibmacro{byeditorx:i}{editorb}%
  \usebibmacro{byeditorx:i}{editorc}}

\renewbibmacro*{bytranslator}{%
  \ifnameundef{translator}
    {}
    {\printnames[bytranslator]{translator}%
     \setunit{\addspace}%
     \bibstring{bytranslator}}}

\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\printnames[byeditor]{editor}%
     \setunit{\addspace}%
     \usebibmacro{byeditor+othersstrg}%
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

\renewbibmacro*{bytranslator+others}{%
  \ifnameundef{translator}
    {}
    {\printnames[bytranslator]{translator}%
     \setunit{\addspace}%
     \usebibmacro{bytranslator+othersstrg}%
     \clearname{translator}%
     \newunit}%
  \usebibmacro{withothers}}

\begin{filecontents*}{\jobname.bib}
@BOOK{flo1906,
    AUTHOR = "R. Flo",
    TITLE = "Midlandsmaal",
    YEAR = "1906",
    EDITOR = "Arne Garborg",
    LOCATION = "Kristiania",
    PUBLISHER = "Olaf Norlis forlag",
    SUBTITLE = "Etter framlegge fraa rettskrivingsnemndi i 1899"}
@BOOK{ordbogoverdetdanskesprog,
    TITLE = "Ordbog over det danske sprog",
    YEAR = "1919--56",
    EDITOR = "H. Juul-Jensen",
    EDITORA = "Verner Dahlerup",
    EDITORATYPE = "founder",
    LOCATION = "K{\o}benhavn",
    NOTE = "Udgivet af det danske sprog- og litteraturselskab",
    PUBLISHER = "Gyldendalske boghandel. Nordisk forlag",
    VOLUMES = "28"}
@INBOOK{torp1909,
    AUTHOR = "Alf Torp",
    BOOKTITLE = "Gamalnorsk ordbok",
    TITLE = "Gamalnorsk ordavleiding",
    YEAR = "1909",
    BOOKAUTHOR = "Marius H{\ae}gstad and Alf Torp",
    BOOKSUBTITLE = "Med nynorsk tyding",
    LOCATION = "Kristiania",
    PAGES = "xxviii--lxxi",
    PUBLISHER = "Det norske samlaget (Landsmaals-laget)"}
@INCOLLECTION{weinreich1968,
    AUTHOR = "Uriel Weinreich and William Labov and Marvin I. Herzog",
    BOOKTITLE = "Directions for historical linguistics",
    EDITOR = "W. P. Lehmann and Yakov Malkiel",
    TITLE = "Empirical foundations for a theory of language change",
    YEAR = "1968",
    BOOKSUBTITLE = "A symposium",
    LOCATION = "Austin, TX",
    PAGES = "95--195",
    PUBLISHER = "University of Texas Press"}
\end{filecontents*}
\addbibresource{\jobname.bib}

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

Torp, Alf。1909 年。挪威语词典。挪威语词典。Med nynorsk 词典。Marius Hægstad 和 Alf Torp 著。Kristiania:《挪威语词典》(Landsmaals-laget),第 xxviii–lxxi 页。

相关内容