4

For a thesis, I would like to switch the behaviour of the citation commands \cite and \footcite based on the cited entry's keywords, so that Biblatex automatically outputs the citations of source texts (as opposed to cited literature) throughout the text using the bibliography driver for the respective entry type to create a full citation similar to the bibliography entry (basically a \fullcite or \footfullcite).

The .tex-file with the text is generated using multimarkdown (and some subsequent regular expressions) and all citations are created using the \cite or \footcite-command.

Source texts are .bib-file entries whose keywords field includes a certain keyword ("quelle"), which is also used to generate a separate bibliography for the source texts using the keyword option of Biblatex's \printbibliography command.

Is there a way to do this automatically using Biblatex-features?

Why do I need this?:

  • When citing sources using a shorthand is often not appropriate, because more information (e.g. date and recipient of a letter) is needed directly in the context of the text.
  • With separated bibliographies for literature and source texts the readers can easily look up literature in the respective bibliography via shorthand while finding all the sources used throughout the work in the separate bibliography.

Minimum Working Example (MWE):

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@unpublished{zschokke_typoskript_1944,
  title = {{Typoskript} der {Rede} anlässlich der {Ausstellungseröffnung}},
  author = {{Peter Zschokke, Präsident des Basler Kunstvereins}},
  date = {1944-03-18},
  keywords = {Quelle,stabs},
  library = {Staatsarchiv Basel-Stadt},
  note = {StABS, PA 888a N 6 (1) 380},
}
@INBOOK{adorno_halbbildung_1959,
  author = {Theodor W. Adorno},
  title = {Theorie der Halbbildung},
  year = {1959},
  pages = {93-121},
  series = {Gesammelte Schriften},
  number = {8},
  booktitle = {Soziologische Schriften I},
  editor = {Rolf Tiedemann},
  publisher = {Suhrkamp},
  location = {Frankfurt am Main},
}
\end{filecontents*}

\documentclass[%
  bibliography=totoc,
  ngerman
]{scrbook}

\deffootnote[2em]{2em}{2em}{%
\makebox[2em][l]{\thefootnotemark}
}
\renewcommand{\footnoterule}{}
\usepackage{xpatch}
\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands,latesthyphen]{german}
\usepackage{blindtext}
\usepackage[breaklinks,pdfa]{hyperref}
\usepackage[%
  backend=biber,
  style=authoryear-ibid
]{biblatex}
\ExecuteBibliographyOptions{%
  pagetracker=true,
% citation style options
  autocite=footnote,
  citetracker=context,
  ibidtracker=constrict,
  ibidpage=false,
  labeldate=true,
  uniquename=full,
  uniquelist=true,
  sortcites=true,
% bibliography style options:
  dashed=false,
  doi=false,
  eprint=false,
  isbn=false,
  sorting=nyt,
  mergedate=basic
}
%Suppressing of specific BibTeX fields:
\AtEveryBibitem{%
  \clearname{translator}%
  \clearlist{publisher}%
  \clearfield{pagetotal}%
  \clearfield{howpublished}%
  \clearfield{issn}%
  \clearfield{lccn}%
  \clearfield{annote}%
  \clearfield{language}%
}

\defbibheading{lit}{\subsection*{Bibliografie}}
\defbibheading{quellen}{\subsection*{Quellen}}
\addbibresource{\jobname.bib}
\usepackage[%
  strict=true,
  style=swiss
]{csquotes}
\DeclareQuoteStyle[swiss]{german}[][]%
  {«}[]{»}[]%
  {‹}[]{›}
\hypersetup{%
  hidelinks,
  unicode
}
\usepackage{marvosym}

\begin{document}
\nocite{*}
\section*{Default behavior}
A statement regarding a source text.\footcite[Default behavior: \Frowny{}][1]{zschokke_typoskript_1944} A statement regarding cited literature.\footcite[Default behavior: \Smiley{}][103]{adorno_halbbildung_1959}

\section*{Wanted behavior}
A statement regarding a source text.\footfullcite[Wanted output for source texts: ][1]{zschokke_typoskript_1944} A statement regarding cited literature.\footcite[Wanted output for literature: ][103]{adorno_halbbildung_1959}

\section*{Quellen und Bibliografie}
\printbibliography[heading=quellen, keyword=Quelle]
\printbibliography[heading=lit, notkeyword=Quelle]
\end{document}
\endinput

MWE result (footnotes): Descriptive footnotes to illustrate MWE.

Software used:

  • XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015/W32TeX)
  • biblatex 2015/04/19 v3.0
  • authoryear-ibid 2015/04/19 v3.0
  • biber version 2.1
  • Zotero 4.0.28.7
  • Welcome! Please post a small, complete document we can compile to reproduce your situation. Obviously, this will need to include at least a couple of .bib entries, along with the document from \documentclass to \end{document}. – cfr Nov 15 '15 at 3:05
  • I'm not quite sure I understand what you want. An illustrative example would certainly be of help. Do you want to switch the behaviour of your citation command based on a keyword? – moewe Nov 15 '15 at 7:42
  • Thank you for your comments. Yes, I want to switch the behaviour of the \cite and \footcite command based on a keyword of the cited entry. I'll add an MWE. – Oliver Nov 15 '15 at 8:15
3

We can branch a \...cite command by keyword with \ifkeyword

\newbibmacro{full:keyw}{%
  \usedriver
    {\DeclareNameAlias{sortname}{default}}
    {\thefield{entrytype}}}

\DeclareCiteCommand{\cite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifkeyword{Quelle}
     {\usebibmacro{full:keyw}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifkeyword{Quelle}
     {\usebibmacro{full:keyw}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

MWE

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@unpublished{zschokke_typoskript_1944,
  title = {{Typoskript} der {Rede} anlässlich der {Ausstellungseröffnung}},
  author = {{Peter Zschokke, Präsident des Basler Kunstvereins}},
  date = {1944-03-18},
  keywords = {Quelle,stabs},
  library = {Staatsarchiv Basel-Stadt},
  note = {StABS, PA 888a N 6 (1) 380},
}
@INBOOK{adorno_halbbildung_1959,
  author = {Theodor W. Adorno},
  title = {Theorie der Halbbildung},
  year = {1959},
  pages = {93-121},
  series = {Gesammelte Schriften},
  number = {8},
  booktitle = {Soziologische Schriften I},
  editor = {Rolf Tiedemann},
  publisher = {Suhrkamp},
  location = {Frankfurt am Main},
}
\end{filecontents*}

\documentclass[%
  bibliography=totoc,
  ngerman
]{scrbook}

\deffootnote[2em]{2em}{2em}{%
\makebox[2em][l]{\thefootnotemark}
}
\renewcommand{\footnoterule}{}
\usepackage{xpatch}
\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands,latesthyphen]{german}

\usepackage[%
  backend=biber,
  style=authoryear-ibid
]{biblatex}
\ExecuteBibliographyOptions{%
  pagetracker=true,
% citation style options
  autocite=footnote,
  citetracker=context,
  ibidtracker=constrict,
  ibidpage=false,
  labeldate=true,
  uniquename=full,
  uniquelist=true,
  sortcites=true,
% bibliography style options:
  dashed=false,
  doi=false,
  eprint=false,
  isbn=false,
  sorting=nyt,
  mergedate=basic
}
%Suppressing of specific BibTeX fields:
\AtEveryBibitem{%
  \clearname{translator}%
  \clearlist{publisher}%
  \clearfield{pagetotal}%
  \clearfield{howpublished}%
  \clearfield{issn}%
  \clearfield{lccn}%
  \clearfield{annote}%
  \clearfield{language}%
}

\defbibheading{lit}{\subsection*{Bibliografie}}
\defbibheading{quellen}{\subsection*{Quellen}}
\addbibresource{\jobname.bib}
\usepackage[%
  strict=true,
  style=swiss
]{csquotes}
\DeclareQuoteStyle[swiss]{german}[][]%
  {«}[]{»}[]%
  {‹}[]{›}
\usepackage[breaklinks,pdfa]{hyperref}
\hypersetup{%
  hidelinks,
  unicode
}


\newbibmacro{full:keyw}{%
  \usedriver
    {\DeclareNameAlias{sortname}{default}}
    {\thefield{entrytype}}}

\DeclareCiteCommand{\cite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifkeyword{Quelle}
     {\usebibmacro{full:keyw}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifkeyword{Quelle}
     {\usebibmacro{full:keyw}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\begin{document}
\nocite{*}
\section*{Default behavior}
A statement regarding a source text.\footcite[1]{zschokke_typoskript_1944} A statement regarding cited literature.\footcite[103]{adorno_halbbildung_1959}


\section*{Quellen und Bibliografie}
\printbibliography[heading=quellen, keyword=Quelle]
\printbibliography[heading=lit, notkeyword=Quelle]
\end{document}
\endinput

You can of course incorporate this change directly into the cite bibmacro, this will then affect all citation commands.

\renewbibmacro*{cite}{%
  \ifkeyword{Quelle}
    {\usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}}
    {\global\boolfalse{cbx:loccit}%
     \iffieldundef{shorthand}
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {\usebibmacro{cite:ibid}}
          {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
             {\usebibmacro{cite:label}%
              \setunit{\addspace}}
             {\printnames{labelname}%
              \setunit{\nameyeardelim}}%
           \usebibmacro{cite:labelyear+extrayear}}}
       {\usebibmacro{cite:shorthand}}}}

MWE (shortened)

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@unpublished{zschokke_typoskript_1944,
  title = {{Typoskript} der {Rede} anlässlich der {Ausstellungseröffnung}},
  author = {{Peter Zschokke, Präsident des Basler Kunstvereins}},
  date = {1944-03-18},
  keywords = {Quelle,stabs},
  library = {Staatsarchiv Basel-Stadt},
  note = {StABS, PA 888a N 6 (1) 380},
}
@INBOOK{adorno_halbbildung_1959,
  author = {Theodor W. Adorno},
  title = {Theorie der Halbbildung},
  year = {1959},
  pages = {93-121},
  series = {Gesammelte Schriften},
  number = {8},
  booktitle = {Soziologische Schriften I},
  editor = {Rolf Tiedemann},
  publisher = {Suhrkamp},
  location = {Frankfurt am Main},
}
\end{filecontents*}

\documentclass[%
  bibliography=totoc,
  ngerman
]{scrbook}

\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands,latesthyphen]{german}    

\usepackage[%
  backend=biber,
  style=authoryear-ibid
]{biblatex}

\addbibresource{\jobname.bib}
\usepackage[%
  strict=true,
  style=swiss
]{csquotes}

\renewbibmacro*{cite}{%
  \ifkeyword{Quelle}
    {\usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}}
    {\global\boolfalse{cbx:loccit}%
     \iffieldundef{shorthand}
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {\usebibmacro{cite:ibid}}
          {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
             {\usebibmacro{cite:label}%
              \setunit{\addspace}}
             {\printnames{labelname}%
              \setunit{\nameyeardelim}}%
           \usebibmacro{cite:labelyear+extrayear}}}
       {\usebibmacro{cite:shorthand}}}}


\begin{document}
A statement regarding a source text.\footcite[1]{zschokke_typoskript_1944} A statement regarding cited literature.\footcite[103]{adorno_halbbildung_1959}
\end{document}
\endinput

Both solutions give

footnotes of MWE

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.