# Help to develop a \textcite command to be used with verbose citation styles in Biblatex (help with \DeclareCiteCommand)

This question led to a new feature in a package:
biblatex

I want to have a \textcite command to be used with verbose citation styles in Biblatex. It should do something as this:

I use it within the text, to replace the subject of a sentence:

As \textcite[4]{JohnDoe} said...


And the result would be something like

As John Doe¹ said...

. . .

__

1. John Doe. Booktitle. Address: Publisher, 2011, p. 4.

Or, if it's not the first citation:

As John Doe² said...

. . .

__

1. Doe, Booktitle, p. 4.

I tried to do so with the following command:

\renewcommand{\textcite}[2][]{\citename{#2}{author}\footcite[#1]{#2}}


but I know this isn't the best approach (just to begin, it completely ignores the punctuation tracker), since there are those \DeclareCiteCommand especially designed to do something like this --- I just can't understand how to use them...

-
I think this can be done by: 1) using the definition of \foocite from /usr/share/texmf/tex/latex/biblatex/cbx/verbose.cbx and add its functionality to \textcite, and 2) using the definition of \textcite from /usr/share/texmf/tex/latex/biblatex/cbx/autoryear.cbx and strip it off of the functionality you don't need. That would be an approach similar to tex.stackexchange.com/questions/22273/… . I tried to do this but found myself too stupid to comprehend how I should proceed in hacking them up. –  N.N. Aug 24 '11 at 15:14
\DeclareCiteCommand allows you to easily iterate over a set of entries. It breaks up processing into code segments that you can specify, but not every segment has access to the bibliographic data. (The wrapper, for example, has none. See the "Citation Style Files" section in the Author Guide for more details.) Your citation actually needs to process each entry twice to in order to print bibliographic data in both the text and the footnote. So I think your general approach is reasonable as-is. –  Audrey Aug 24 '11 at 16:24

Philipp Lehman's elegant solution to this problem (given in Marco's answer) was incorporated into biblatex 1.7. As of biblatex 2.7a, a few improvements have been made:

• Use of the and string in the final delimiter
• Correct output of multiprenote and multipostnote arguments
• Correct output of \tvolcite
• Avoid parsing trailing punctuation as cite keys on initial LaTeX runs
• Move any "auto" trailing punctuation between the name label and the footnote mark

Here is an example.

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=verbose]{biblatex}

\begin{document}
\null\vfill
What can we learn from \textcite{cicero}?
Following \textcite{cicero}, we adapt some related findings from
\textcites[See][29--30]{kant:ku}{companion}.
We obtain results from various authors---namely:
\textcites(See)(for example)[10--15]{cicero}{companion,knuth:ct:a,knuth:ct:b}.
\end{document}


The third citation demonstrates that the correspondence between inline name labels and works can be ambiguous. Whenever the (compressed) list has more than two name labels and at least one of these labels uses the serial comma \finalandcomma, the list is delimited by a semicolon. This case is shown in the last citation.

-
Thanks, it works fine! I'm just wondering how could we add the pre-note argument to this command... –  henrique Aug 25 '11 at 0:31
@henrique Your request has now been fully implemented in the standard verbose styles. Note that results can be awkard when maxcitenames > 1. To avoid ambiguous label distinction with serial commas, I've introduced serial semicolons. Suggestions for further improvements can be submitted to the github repo. –  Audrey Jul 13 '13 at 19:12

EDIT: Philipp improved his own solution. He will add this feature in the verbose style.

\documentclass{article}
\usepackage[style=verbose,backend=biber]{biblatex}
\makeatletter

\DeclareCiteCommand{\textcite}[\cbx@textcite\footcite]
{\gdef\cbx@savedkeys{}}
{\printnames{labelname}%
\xappto\cbx@savedkeys{\thefield{entrykey},}}
{\multinamedelim}
{\protected@xappto\cbx@savedcites{%
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}

\newrobustcmd{\cbx@textcite}[2]{%
\def\cbx@savedcites{#1}#2\cbx@savedcites}

\DeclareMultiCiteCommand{\textcites}[\cbx@textcite\footcites]{\textcite}{\multinamedelim}

\makeatother
\begin{document}

\textcite{augustine} claims that \textellipsis

\textcite[55]{augustine} claims that \textellipsis

\textcite[Cf.][]{augustine} claims that \textellipsis

\textcite{augustine,hammond,cotton} show that \textellipsis

\textcites{augustine,hammond,cotton} show that \textellipsis

\textcites{augustine}{hammond}{cotton} show that \textellipsis

\textcites[55]{augustine}[33]{hammond}[99]{cotton} show that \textellipsis

\end{document}


Philipp Lehmann explained me the following solultion:

\textcite is pretty self-explanatory. \cbx@textcites performs the equivalent of \citeauthor (synchronously with the loop) but also collects all arguments for later use. \cbx@textcitewrapper uses this data to issue a \footcites command which puts all citations in a single footnote. \DeclareMultiCiteCommand provides the user interface.

\documentclass{article}
\usepackage[style=verbose,backend=biber]{biblatex}
\makeatletter

\renewrobustcmd*{\textcite}{\blx@citeargs\cbx@textcite}
\newcommand{\cbx@textcite}[3]{%
\citeauthor{#3}\footcite[#1][#2]{#3}}

\DeclareCiteCommand{\cbx@textcites}
{\gdef\cbx@savedkeys{}}
{\printnames{labelname}%
\xappto\cbx@savedkeys{\thefield{entrykey},}}
{\multicitedelim}
{\protected@xappto\cbx@savedcites{%
[\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}

\newrobustcmd{\cbx@textcitewrapper}[1]{%
\gdef\cbx@savedcites{\footcites}#1\cbx@savedcites}

\DeclareMultiCiteCommand{\textcites}[\cbx@textcitewrapper]{\cbx@textcites}{\multicitedelim}

\makeatother
\begin{document}

\textcite{augustine} claims that \textellipsis

\textcite[55]{augustine} claims that \textellipsis

\textcite[Cf.][]{augustine} claims that \textellipsis

\textcite{augustine,hammond,cotton} show that \textellipsis

\textcites{augustine,hammond,cotton} show that \textellipsis

\textcites{augustine}{hammond}{cotton} show that \textellipsis

\textcites[55]{augustine}[33]{hammond}[99]{cotton} show that \textellipsis

\end{document}

-
Thanks! That first comment I left on your old answer mentioned this approach. My own attempts (not quite as elegant as Philipp's) suffered from the same defect as his - it doesn't handle punctuation. It also doesn't handle multipre- and multipostnotes, but that is easy to fix. –  Audrey Sep 10 '11 at 14:02
@Audrey: He is brilliant ;-) –  Marco Daniel Sep 10 '11 at 14:07