1

\footcite produces a formatted citation that looks like \cite rather than \textcite. How can I make \footcite look like \textcite with biblatex?

I have found https://tex.stackexchange.com/a/458155/36836 and https://tex.stackexchange.com/a/426113/36836 but this only adds brackets around the year (not the page number). (It also only works with the ext-authoryear-icomp, but I am fine with using it if it has no other detrimental side effects.)

Same for https://tex.stackexchange.com/a/501320/36836. (However, the non-ext-authoryear-icomp variant also adds strange additional square brackets around the year of my \textcites. Maybe some interaction with another modification I am using in my document. But I am not sure.)

Here is the actual and wanted result:

\documentclass{article}
\usepackage[style=authoryear-icomp,autocite=footnote]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{A01,        
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
  journaltitle = {A Journal},
  volume = {1},
  number = {1},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
  location = {There},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Current result \autocite[23]{A01}.

Wanted result.\footnote{\textcite[23]{B02}.}

\printbibliography
\end{document}
3

authoryear-icomp's \textcite definition is among the most complex citation commands defined by standard biblatex. It uses a two-pass structure to get the -comp bit of the format right. That means that it is actually defined in terms of two citation commands: one that does the preprocessing and a second internal command that does the actual formatting.

Fortunately, it is possible to transplant that setup from \textcite to \footcite and \smartcite (which is what \autocite is in your setup).

If you want to move the position of the prenote, you need to modify the textcite bibmacro so that it doesn't print the prenote and print the prenote in the precode of the cite commands.

\documentclass{article}
\usepackage[style=authoryear-icomp, autocite=footnote]{biblatex}

\makeatletter
% same as 'textcite' but does not print the prenote
\newbibmacro*{foottextcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\iffieldundef{shorthand}
       {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                    \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
          {\setunit{\addcomma}%
           \usebibmacro{cite:extradate}}
          {\setunit{\compcitedelim}%
           \usebibmacro{cite:labeldate+extradate}%
           \savefield{labelyear}{\cbx@lastyear}}}
       {\setunit{\compcitedelim}%
        \usebibmacro{cite:shorthand}%
        \global\undef\cbx@lastyear}}
    {\ifnameundef{labelname}
       {\iffieldundef{shorthand}
          {\usebibmacro{cite:label}%
           \setunit{%
             \global\booltrue{cbx:parens}%
             \printdelim{nonameyeardelim}\bibopenparen}%
           \ifnumequal{\value{citecount}}{1}
             {\usebibmacro{prenote}}
             {}%
           \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
             {\usebibmacro{cite:ibid}}
             {\usebibmacro{cite:labeldate+extradate}}}
          {\usebibmacro{cite:shorthand}}}
       {\printnames{labelname}%
        \setunit{%
          \global\booltrue{cbx:parens}%
          \printdelim{nameyeardelim}\bibopenparen}%
        \iffieldundef{shorthand}
          {\iffieldundef{labelyear}
             {\usebibmacro{cite:label}}
             {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
                {\usebibmacro{cite:ibid}}
                {\usebibmacro{cite:labeldate+extradate}}}%
           \savefield{labelyear}{\cbx@lastyear}}
          {\usebibmacro{cite:shorthand}%
           \global\undef\cbx@lastyear}}%
     \stepcounter{textcitecount}%
     \savefield{namehash}{\cbx@lasthash}}%
  \setunit{%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}%
    \textcitedelim}}


% \footcite
\DeclareCiteCommand{\cbx@footcite}[\mkbibfootnote]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{foottextcite}}
  {}
  {\usebibmacro{textcite:postnote}}

\DeclareDelimcontextAlias{cbx@footcite}{footcite}

\DeclareCiteCommand{\footcite}[\cbx@textcite@init\cbx@footcite]
  {\gdef\cbx@savedkeys{}%
   \citetrackerfalse%
   \pagetrackerfalse%
   \DeferNextCitekeyHook%
   \usebibmacro{cite:init}}
  {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
     {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
      \global\clearfield{multipostnote}}
     {}%
   \xappto\cbx@savedkeys{\thefield{entrykey},}%
   \iffieldequals{namehash}{\cbx@lasthash}
     {}
     {\stepcounter{textcitetotal}%
      \savefield{namehash}{\cbx@lasthash}}}
  {}
  {\protected@xappto\cbx@savedcites{%
     [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}

\DeclareMultiCiteCommand{\cbx@footcites}[\mkbibfootnote]{\cbx@footcite}{}
\DeclareMultiCiteCommand{\footcites}[\cbx@textcites@init\cbx@footcites]{\footcite}{}

% \footcitetext
\DeclareCiteCommand{\cbx@footcitetext}[\mkbibfootnotetext]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{foottextcite}}
  {}
  {\usebibmacro{textcite:postnote}}

\DeclareDelimcontextAlias{cbx@footcitetext}{footcite}

\DeclareCiteCommand{\footcitetext}[\cbx@textcite@init\cbx@footcitetext]
  {\gdef\cbx@savedkeys{}%
   \citetrackerfalse%
   \pagetrackerfalse%
   \DeferNextCitekeyHook%
   \usebibmacro{cite:init}}
  {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
     {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
      \global\clearfield{multipostnote}}
     {}%
   \xappto\cbx@savedkeys{\thefield{entrykey},}%
   \iffieldequals{namehash}{\cbx@lasthash}
     {}
     {\stepcounter{textcitetotal}%
      \savefield{namehash}{\cbx@lasthash}}}
  {}
  {\protected@xappto\cbx@savedcites{%
     [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}

\DeclareMultiCiteCommand{\cbx@footcitetexts}[\mkbibfootnotetext]{\cbx@footcitetext}{}
\DeclareMultiCiteCommand{\footcitetexts}[\cbx@textcites@init\cbx@footcitetexts]{\footcitetext}{}

% \smartcite (=\autocite in your setup)
\DeclareCiteCommand{\cbx@smartcite}[\iffootnote\mkbibparens\mkbibfootnote]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{foottextcite}}
  {}
  {\usebibmacro{textcite:postnote}}

\DeclareDelimcontextAlias{cbx@smartcite}{smartcite}

\DeclareCiteCommand{\smartcite}[\cbx@textcite@init\cbx@smartcite]
  {\gdef\cbx@savedkeys{}%
   \citetrackerfalse%
   \pagetrackerfalse%
   \DeferNextCitekeyHook%
   \usebibmacro{cite:init}}
  {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
     {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
      \global\clearfield{multipostnote}}
     {}%
   \xappto\cbx@savedkeys{\thefield{entrykey},}%
   \iffieldequals{namehash}{\cbx@lasthash}
     {}
     {\stepcounter{textcitetotal}%
      \savefield{namehash}{\cbx@lasthash}}}
  {}
  {\protected@xappto\cbx@savedcites{%
     [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}

\DeclareMultiCiteCommand{\cbx@smartcites}[\iffootnote\mkbibparens\mkbibfootnote]{\cbx@smartcite}{}
\DeclareMultiCiteCommand{\smartcites}[\cbx@textcites@init\cbx@smartcites]{\smartcite}{}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
Current result \autocite[See][380]{sigfridsson}.

Wanted result.\autocites[24-26]{nussbaum}[13]{geer}

\printbibliography
\end{document}

1 See Sigfridsson and Ryde (1998, p. 380).//2 Nussbaum (1978, pp. 24–26) and Geer (1985, p. 13).

4
  • Awesome. Seems to work in principle. Now, I am trying to integrate it into my document. I hope it comes out as I would have expected.
    – Daniel
    May 3 '20 at 14:15
  • Okay, I think it worked as it was to be expected. Thanks. Unfortunately, I made a mistake when thinking about the effects. For example, \autocite[See ][380]{sigfridsson} normally results in See Sigfridsson and Ryde 1998, p. 380. But with \textcite it creates Sigfridsson and Ryde (See 1998, p. 380). I wasn't aware that \textcite acts in that way. What I need is actually See Sigfridsson and Ryde (1998, p. 380)..
    – Daniel
    May 3 '20 at 14:52
  • 1
    @Daniel All possible, the code doesn't get shorter, though. See the edit, please.
    – moewe
    May 3 '20 at 15:00
  • As long as it works. And it seems to work fabulously. Thanks for your help!
    – Daniel
    May 3 '20 at 16:29

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.