2

I am using Biblatex. For a thesis, I need to have footnote citations to look like this:

author (year:page)

for example

²Johnson (2010:29)

I have already implmenented the code from this question, see below, which gives me

²Johnson, 2010:29.

The only thing that I need to do now is to remove the comma after the author, add parentheses and remove the dot at the end. Unfortunately, even after printing and reading through 263 pages of Biblatex documentation, I still do not know what the linked code does. I would be glad if someone could help me out with this.

\documentclass{report}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\usepackage[colorlinks]{hyperref}

\renewcommand*{\nameyeardelim}{\nametitledelim}
\renewcommand*{\postnotedelim}{\addcolon}
\DeclareFieldFormat{postnote}{#1}

\newrobustcmd*{\citehook}{%
  \AtNextCite{%
    \renewcommand*{\postnotedelim}{\addspace}%
    \renewbibmacro*{cite:labelyear+extrayear}{%
      \iffieldundef{label}
        {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
        {}}}}

\newrobustcmd*{\autocitetitle}{\citehook\autocite}
\newrobustcmd*{\autocitetitles}{\citehook\autocites}

\addbibresource{biblatex-examples.bib}
\begin{document}
\null\vfill
Filler text \autocite[See][10--15]{aristotle:poetics}.
Filler text \autocitetitle[See][7.6.2]{aristotle:poetics}.
Filler text \autocite{aristotle:poetics,aristotle:rhetoric,kant:kpv,cms}.
Filler text \autocites[10--15]{aristotle:poetics}[25]{aristotle:rhetoric}.
Filler text \autocitetitle{aristotle:poetics,aristotle:rhetoric,kant:kpv,cms}.
Filler text \autocitetitles[7.6.2]{aristotle:poetics}{aristotle:rhetoric}.
\printbibliography
\end{document}
5
  • biblatex-examples.bib is giving me an error and I don't know why. Anyway, in your preamble, for the comma add \renewcommand*{\nameyeardelim}{\addspace}, and for the period, add \renewcommand{\labelnamepunct}{\addspace}. Testing with a custom bibliography, I'm getting the round brackets. But do you want them around the year only?
    – Alenanno
    Jan 22, 2016 at 16:16
  • Thank you, this worked so far. I need the brackets around the year AND the page...
    – Ulu83
    Jan 22, 2016 at 16:19
  • Correction: the period is still around. I added ' \renewcommand{\labelnamepunct}{\addspace} ' after all code above
    – Ulu83
    Jan 22, 2016 at 16:20
  • Why the dollar signs? You're probably seeing the period because you added it in the sentence. :)
    – Alenanno
    Jan 22, 2016 at 16:22
  • My sentence is this is some sentence \footcite[30]{walter2013zukunft} The Dollar signs were just a typo, corrected them.
    – Ulu83
    Jan 22, 2016 at 16:26

1 Answer 1

1

Since the output that \textcite gives is almost what you want, I thought it would be a good idea to just make \footcite a little bit closer to \textcite, try the following definitions

\makeatletter
\newbibmacro*{footcite}{%
  \ifnameundef{labelname}
    {\iffieldundef{shorthand}
       {\usebibmacro{cite:label}%
        \setunit{%
          \global\booltrue{cbx:parens}%
          \addspace\bibopenparen}%
        \usebibmacro{cite:labelyear+extrayear}}
       {\usebibmacro{cite:shorthand}}}
    {\printnames{labelname}%
     \setunit{%
       \global\booltrue{cbx:parens}%
       \addspace\bibopenparen}%
     \usebibmacro{citeyear}}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\boolfalse{cbx:parens}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \iffirstcitekey
     {\setcounter{textcitetotal}{1}}
     {\stepcounter{textcitetotal}%
      \textcitedelim}%
   \usebibmacro{footcite}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}}
  {\usebibmacro{textcite:postnote}}

\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]{\footcite}{}
\makeatother

Which is a just slightly modified version of authoryear.cbx's definition of textcite.

In total

MWE

\documentclass[american]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\usepackage[colorlinks]{hyperref}

\renewcommand*{\nameyeardelim}{\addcomma\space}
\renewcommand*{\postnotedelim}{\addcolon}
\DeclareFieldFormat{postnote}{#1}

\makeatletter
\newbibmacro*{footcite}{%
  \ifnameundef{labelname}
    {\iffieldundef{shorthand}
       {\usebibmacro{cite:label}%
        \setunit{%
          \global\booltrue{cbx:parens}%
          \addspace\bibopenparen}%
        \usebibmacro{cite:labelyear+extrayear}}
       {\usebibmacro{cite:shorthand}}}
    {\printnames{labelname}%
     \setunit{%
       \global\booltrue{cbx:parens}%
       \addspace\bibopenparen}%
     \usebibmacro{citeyear}}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\boolfalse{cbx:parens}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \iffirstcitekey
     {\setcounter{textcitetotal}{1}}
     {\stepcounter{textcitetotal}%
      \textcitedelim}%
   \usebibmacro{footcite}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}}
  {\usebibmacro{textcite:postnote}}

\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]{\footcite}{}
\makeatother

\addbibresource{biblatex-examples.bib}
\begin{document}
Filler text \footcite[See][10--15]{aristotle:poetics}.
Filler text \footcite{aristotle:poetics,aristotle:rhetoric,kant:kpv,cms}.
Filler text \footcites[10--15]{aristotle:poetics}[25]{aristotle:rhetoric}.
\printbibliography
\end{document}

footnote section of the MWE

3
  • Hi moewe, thanks a lot, your solution works fine! I am wondering if I am ever going to get behind the cryptic commands here ;-)
    – Ulu83
    Jan 22, 2016 at 23:03
  • I am still getting the point at the end of the citation, though. Can you tell me how to remove it?
    – Ulu83
    Jan 24, 2016 at 11:18
  • @Ulu83 Try \renewcommand{\bibfootnotewrapper}[1]{\bibsentence#1}. See also How to remove period after Biblatex footnote citation.
    – moewe
    Jan 24, 2016 at 11:26

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .