0

I need to meet special design rules for my bibliography so this code was made for me:

\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear]{biblatex}

\addbibresource{biblatex-examples.bib}

\DefineBibliographyStrings{ngerman}{references={Bibliographie}}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\printnames[byeditor]{editor}%
     \setunit{\addspace}%
     \usebibmacro{byeditor+othersstrg}%
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}
\renewbibmacro*{byeditor+othersstrg}{\usebibmacro{editor+othersstrg}}
\renewbibmacro*{bytranslator+othersstrg}{\usebibmacro{translator+othersstrg}}
\renewbibmacro*{bytypestrg}[2]{%
  \iffieldundef{#1type}
    {\bibstring{#2}}
    {\ifbibxstring{\thefield{#1type}}
       {\bibstring{\thefield{#1type}}}
       {\printtext{\thefield{#1type}}}}}

\renewcommand*{\multinamedelim}{/}
\renewcommand*{\finalnamedelim}{\multinamedelim}

\renewcommand*{\labelnamepunct}{\addcolon\space}
\renewcommand*{\postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

\DeclareFieldFormat{superedition}{\textsuperscript{#1}}

\providecommand*{\iflabeldateisdate}{%
  \ifboolexpr{%
    not test {\iffieldundef{labeldatesource}}
    and 
    (test {\iffieldequalstr{labeldatesource}{}} 
     or test {\iffieldequalstr{labeldatesource}{year}})}}

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[parens]{%
       \iflabeldateisdate
         {\iffieldnum{edition}
            {\printfield[superedition]{edition}%
             \global\clearfield{edition}}
            {}%
          \printdateextra}
         {\printlabeldateextra}}}}

\renewcommand*{\bibpagespunct}{\addcolon\space}
\DeclareFieldFormat{pages}{#1}

\DeclareNameAlias{sortname}{family-given}


\begin{document}
\nocite{sigfridsson,companion,cotton,iliad,malinowski,
        gaonkar:in,westfahl:space,pines,brandt,hyman,kant:kpv}
\printbibliography
\end{document}

Now there is one last thing I need: for some publications it is necessary for me to state the year of its first appearance like this:

Doe, Jane [1979] (22003) etc

(the bold number is supposed to be in superscript)

  • 1
    What about citations? Can we just use the normal year there or do you need the origyear as well? – moewe Aug 18 '17 at 16:19
  • I keep forgetting that everything is possible with LaTeX... for the citations the normal year is enough – LajosH Aug 18 '17 at 16:23
2

You can modify your date+extrayear macro to print the origdate in the bibliography if it is defined.

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {\usebibmacro{origdate}% <- add this line
     \setunit*{\addspace}%   <- add this line
     \printtext[parens]{%
       \iflabeldateisdate
         {\iffieldnum{edition}
            {\printfield[superedition]{edition}%
             \global\clearfield{edition}}
            {}%
          \printdateextra}
         {\printlabeldateextra}}}}

Then define a macro to print the origdate.

\newbibmacro*{origdate}{%
  \iffieldundef{origyear}
    {}
    {\printtext[brackets]{\printorigdate}}}

Putting it all together with your MWE (I added Doe 2003 with an origyear of 1979):

\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{doe,
  author = {Doe, Jane},
  title = {Title},
  edition = {2},
  date = {2003},
  origdate = {1979},
  location = {Location},
  publisher = {Publisher}
}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\DefineBibliographyStrings{ngerman}{references={Bibliographie}}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\printnames[byeditor]{editor}%
     \setunit{\addspace}%
     \usebibmacro{byeditor+othersstrg}%
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}
\renewbibmacro*{byeditor+othersstrg}{\usebibmacro{editor+othersstrg}}
\renewbibmacro*{bytranslator+othersstrg}{\usebibmacro{translator+othersstrg}}
\renewbibmacro*{bytypestrg}[2]{%
  \iffieldundef{#1type}
    {\bibstring{#2}}
    {\ifbibxstring{\thefield{#1type}}
       {\bibstring{\thefield{#1type}}}
       {\printtext{\thefield{#1type}}}}}

\renewcommand*{\multinamedelim}{/}
\renewcommand*{\finalnamedelim}{\multinamedelim}

\renewcommand*{\labelnamepunct}{\addcolon\space}
\renewcommand*{\postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

\DeclareFieldFormat{superedition}{\textsuperscript{#1}}

\providecommand*{\iflabeldateisdate}{%
  \ifboolexpr{%
    not test {\iffieldundef{labeldatesource}}
    and 
    (test {\iffieldequalstr{labeldatesource}{}} 
     or test {\iffieldequalstr{labeldatesource}{year}})}}

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {\usebibmacro{origdate}%
     \setunit*{\addspace}%
     \printtext[parens]{%
       \iflabeldateisdate
         {\iffieldnum{edition}
            {\printfield[superedition]{edition}%
             \global\clearfield{edition}}
            {}%
          \printdateextra}
         {\printlabeldateextra}}}}

\newbibmacro*{origdate}{%
  \iffieldundef{origyear}
    {}
    {\printtext[brackets]{\printorigdate}}}

\renewcommand*{\bibpagespunct}{\addcolon\space}
\DeclareFieldFormat{pages}{#1}

\DeclareNameAlias{sortname}{family-given}


\begin{document}
\cite{doe}
\nocite{sigfridsson,companion,cotton,iliad,malinowski,
        gaonkar:in,westfahl:space,pines,brandt,hyman,kant:kpv}
\printbibliography
\end{document}

enter image description here

  • 1
    +1 Though you can move the brackets into the format and drop the \iffieldundef with \newbibmacro*{origdate}{\printorigdate} \DeclareFieldFormat{origdate}{\mkbibbrackets{#1}} – moewe Aug 19 '17 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.