自定义修改的 biblatex 样式

自定义修改的 biblatex 样式

代码的输出这里已经非常接近我需要满足的要求了。不过,还缺少两件小事。

目前书目条目如下:辛普森,荷马。采访巴特·辛普森。斯普林菲尔德,2018 年 7 月 25 日。

但是,它看起来应该是这样的:辛普森,荷马。采访巴特·辛普森,2018 年 7 月 25 日,斯普林菲尔德。

因此,有两点需要改变:

  1. 在面试官后面加逗号而不是点
  2. 更改日期和地址的位置

凭借我对 biblatex 的了解,我尝试更改 usebibmacro 中日期和地址的位置,并添加 \isdot 来打印逗号。毫不奇怪,这两种方法都不起作用,不幸的是,我在 biblatex 手册中也没有找到问题的答案(或者更准确地说,我看不懂)。

那么我该如何更改代码才能使其正常工作?

    \RequirePackage{filecontents}
    \begin{filecontents*}{\jobname.bib}
    @interview{homer,
      interviewee = {Homer Simpson},
      interviewer = {Bart Simpson},
      date        = {2018-07-25},
      address     = {Springfield},
    }
    \end{filecontents*}


      \begin{filecontents}{interview.dbx}
      \DeclareDatamodelEntrytypes{interview}
       \DeclareDatamodelFields[type=list,datatype=name]{
        interviewer,
        interviewee,
      }

    \DeclareDatamodelEntryfields[interview]{
      addendum,
      doi,
      eprint,
      eprintclass,
      eprinttype,
      interviewer,
      interviewee,
      location,
      note,
      pubstate,
    }
    \end{filecontents}
    \documentclass[ngerman]{article}
    \usepackage{babel}
    \usepackage{csquotes}
    \usepackage[datamodel=interview,backend=biber]{biblatex}
    \usepackage{hyperref}
    \addbibresource{\jobname.bib}

    \NewBibliographyString{interview}
    \DefineBibliographyStrings{german}{%
      interview   = {Interview},
    }

    \DeclareNameAlias{interviewee}{author}

    \DeclareBibliographyDriver{interview}{%
      \usebibmacro{bibindex}%
      \usebibmacro{begentry}%
      \printnames{interviewee}%
      \newunit\newblock
      \bibstring{interview}%
      \setunit{\addspace}%
      \printnames{interviewer}%
      \newunit\newblock
      \printfield{note}%
      \newunit\newblock
      \usebibmacro{location+date}%
      \newunit\newblock
      \usebibmacro{doi+eprint+url}%
      \newunit\newblock
      \usebibmacro{addendum+pubstate}%
      \setunit{\bibpagerefpunct}\newblock
      \usebibmacro{pageref}%
      \newunit\newblock
      \iftoggle{bbx:related}
        {\usebibmacro{related:init}%
         \usebibmacro{related}}
        {}%
      \usebibmacro{finentry}}

    \begin{document}
    \cite{homer}

    \printbibliography
    \end{document}

答案1

只需调整 bibdrivermoewe 的回答

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
  @interview{homer,
    interviewee = {Homer Simpson},
    interviewer = {Bart Simpson},
    date        = {2018-07-25},
    address     = {Springfield},
  }
\end{filecontents*}


\begin{filecontents}{interview.dbx}
  \DeclareDatamodelEntrytypes{interview}
  \DeclareDatamodelFields[type=list,datatype=name]{
    interviewer,
    interviewee,
  }

  \DeclareDatamodelEntryfields[interview]{
    addendum,
    doi,
    eprint,
    eprintclass,
    eprinttype,
    interviewer,
    interviewee,
    location,
    note,
    pubstate,
  }
\end{filecontents}
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[datamodel=interview,backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}

\NewBibliographyString{interview}
\DefineBibliographyStrings{german}{%
  interview   = {Interview},
}

\DeclareNameAlias{interviewee}{author}

\DeclareBibliographyDriver{interview}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printnames{interviewee}%
  \newunit\newblock
  \bibstring{interview}%
  \setunit{\addspace}%
  \printnames{interviewer}%
  \setunit{\addcomma\space}%
  \usebibmacro{date}%
  \setunit{\addcomma\space}%
  \printlist{location}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
  {\usebibmacro{related:init}%
    \usebibmacro{related}}
  {}%
  \usebibmacro{finentry}}

\begin{document}
\cite{homer}

\printbibliography
\end{document}

enter image description here

相关内容