Seite 1 von 1

Neuer Bib-Typ Interview

Verfasst: So 7. Apr 2019, 20:10
von Gast
Hallo und guten Abend,

Kann mir jemand helfen - irgendwie wird das Jahr hier nicht ausgegeben:
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@interview{homer,
  interviewee = {Homer Simpson},
  interviewer = {Bart Simpson},
  date        = {2018-07-25},
  address     = {Springfield},
  year        = {2018}
}
\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 durch Autor},
}

\DeclareNameAlias{interviewee}{author}

\DeclareBibliographyDriver{interview}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printnames{interviewee}%
  \newunit\newblock
  \usebibmacro{year}%
  \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}
Vielen Dank für die Hilfe!

Verfasst: So 7. Apr 2019, 20:13
von Gast
Sollte irgendwie so aussehen:

SIMPSON, Homer, 2018. Interview durch Autor. Springfield, 25.07.2018

Verfasst: So 7. Apr 2019, 20:43
von Gast
Wenn ich das richtig sehe, ist der Code von dieser exzellenten Antwort inspiriert.

Für eine authoryear-Anpassung würde ich das Folgende nutzen.
\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,style=authoryear,mergedate=false,backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}

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

\DeclareLabelname{%
  \field{shortauthor}
  \field{author}
  \field{shorteditor}
  \field{editor}
  \field{translator}
  \field{interviewee}
}

\ExecuteBibliographyOptions{useinterviewee}
\DeclareNameAlias{interviewee}{author}

\makeatletter
\newbibmacro*{interviewee}{%
  \ifboolexpr{
    test \ifuseinterviewee
    and
    not test {\ifnameundef{interviewee}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\usebibmacro{bbx:savehash}%
        \printnames{interviewee}%
        \setunit{\printdelim{nameyeardelim}}}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \usebibmacro{date+extradate}}
\makeatother

\DeclareBibliographyDriver{interview}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{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}
Ich habe aber das Gefühl, dass Du der Gast mit biblatex-iso und Overleaf bist. Da muss es natürlich anders aussehen. Aufbauend auf das, was wir schon in access-date-and-publish-date-t21734.html erarbeitet haben, wäre das in etwa
\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[backend=biber, datamodel=interview,
  style=iso-authoryear,
  date=edtf, labeldate=year,
  maxbibnames=3, shortnumeration]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}


\DeclareNameAlias{default}{given-family}
\DeclareNameAlias{sortname}{family-given/given-family}
\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}

\DeclareDelimFormat{multinamedelim}{\addcomma\space}
\DeclareDelimFormat{finalnamedelim}{%
  \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
  \addspace\bibstring{and}\space}

\DeclareNameAlias[incollection]{editor}{default}
\makeatletter
\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\usebibmacro{bbx:savehash}%
     \printnames{editor}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{editor}}
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}}}%
\makeatother

%%% EMULATION RELEVANTER BEFEHLE
%%% NUR FÜR VERALTETE SYSTEME WIE BEI Overleaf
%%% BEI NEUEREN SYSTEMEN IST DIESER BLOCK ZU ENTFERNEN
\makeatletter
\def\blx@imc@iflabeldateisdate{%
  \ifboolexpr{%
    togl {blx@labeldateparts}
    and not test {\iffieldundef{labeldatesource}}
    and
    (test {\iffieldequalstr{labeldatesource}{}}
     or test {\iffieldequalstr{labeldatesource}{year}})}}

\def\blx@imc@ifdatehasyearonlyprecision#1{%
  \ifboolexpr{not test {\iffieldundef{#1year}}
              and (test {\ifcsstring{blx@dateformat@#1date}{year}}
                   or (test {\iffieldundef{#1month}}
                       and test {\iffieldundef{#1season}}))}}

\def\blx@imc@ifdatehastime#1{%
  \ifboolexpr{togl {blx@#1dateusetime}
                 and not test {\iffieldundef{#1hour}}}}

\def\blx@imc@ifdateshavedifferentprecision#1#2{%
  \ifboolexpr{   (test {\ifdatehasyearonlyprecision{#1}}
                  and not test {\ifdatehasyearonlyprecision{#2}})
              or (not test {\ifdatehasyearonlyprecision{#1}}
                  and test {\ifdatehasyearonlyprecision{#2}})
              or (test {\ifdatehastime{#1}}
                  and not test {\ifdatehastime{#2}})
              or (not test {\ifdatehastime{#1}}
                  and test {\ifdatehastime{#2}})}}

\def\blx@imc@ifdateyearsequal#1#2{%
  \ifboolexpr{ test {\iffieldsequal{#1year}{#2year}}
               and test {\iffieldsequal{#1dateera}{#2dateera}}}}

\blx@regimcs{%
  \iflabeldateisdate \ifdatehasyearonlyprecision \ifdatehastime
  \ifdateshavedifferentprecision
  \ifdateyearsequal}
\makeatother
%%% EMULATION ENDE

\renewbibmacro*{date}{%
  \ifboolexpr{
    test {\iflabeldateisdate}
    and
    not test {\ifdateshavedifferentprecision{label}{}}
  }%
    {}
    {\printdate}}

\DefineBibliographyStrings{german}{%
  andothers = {und andere},
  urlseen   = {Zugriff am:},
  urlfrom   = {Verfügbar unter:},
}

\DeclareFieldFormat*{pages}{\mkmlpageprefix[bookpagination]{#1}}

\renewcommand{\finentrypunct}{}

\urlstyle{same}


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

\DeclareLabelname{%
  \field{shortauthor}
  \field{author}
  \field{shorteditor}
  \field{editor}
  \field{translator}
  \field{interviewee}
}

\ExecuteBibliographyOptions{useinterviewee}
\DeclareNameAlias{interviewee}{author}

\makeatletter
\newbibmacro*{interviewee}{%
  \ifboolexpr{
    test \ifuseinterviewee
    and
    not test {\ifnameundef{interviewee}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\usebibmacro{bbx:savehash}%
        \printnames{interviewee}%
        \setunit{\printdelim{nameyeardelim}}}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \printextrayear}
\makeatother

\DeclareBibliographyDriver{interview}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{interviewee}%
  \newunit\newblock
  \bibstring{interview}%
  \setunit{\addspace}%
  \printnames{interviewer}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{location+publisher+date}%
  \newunit
  \printfield{version}%
  \setunit{\addspace}%
  \usebibmacro{urldate}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \usebibmacro{identifier}%
  \newunit\newblock
  \usebibmacro{availability+access}%
  \newunit\newblock
  \printfield{note}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}


\begin{document}
\cite{homer}

\printbibliography
\end{document}