Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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...

share|improve this question
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
2  
\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

2 Answers

up vote 6 down vote accepted

The previous version of this answer defined a command that combined the results of \citeauthor and \autocite, but it didn't always account for punctuation correctly.

The code below relies on internal biblatex commands to parse arguments and trailing punctuation. Some refinements for inline citation delimiters are also provided.

Note the new \textcite command (like the last one) cannot be extended to a multicite version via \DeclareMultiCiteCommand. Accounting for punctuation in the multicite setting isn't straightforward.

\documentclass{report}
\usepackage[style=verbose,citepages=omit,maxcitenames=1]{biblatex}
\bibliography{biblatex-examples}

% Track citations globally (for demonstration)
\ExecuteBibliographyOptions{citetracker=true}

\makeatletter

\newcommand*{\addcitedelim}{%
  \ifnumequal{\blx@maxcitenames}{1}
    {\addcomma}
    {\addsemicolon}}

\newcommand*{\addfinalcitedelim}{%
  \ifnumequal{\blx@maxcitenames}{1}
    {\addspace\bibstring{and}}
    {\addsemicolon}}

\newcommand*{\textcitedelim}{%
  \ifnumequal{\the\c@citecount}{\the\c@citetotal}
    {\addfinalcitedelim\space}
    {\addcitedelim\space}}

\protected\def\blx@textcitepunct#1{%
  \blx@citeargs{\blx@textcitepunct@i{#1}}}
\long\def\blx@textcitepunct@i#1#2#3#4{%
  \blx@thecheckpunct{\blxcitecmd{#1}{#2}{#3}{#4}}}

\renewrobustcmd*{\textcite}{\blx@textcitepunct{textcite}}
\long\csdef{blx@cite@textcite}#1#2#3#4{%
  \AtNextCite{%
    \let\multicitedelim=\textcitedelim}%
  \citename{#3}[first-last]{labelname}%
  #4% Move trailing punctuation between two citation commands
  \footcite[#1][#2]{#3}}

\makeatother

\begin{document}
\null\vfill

What can we learn from \textcite{cicero}?
Following \textcite{cicero}, we adapt some related findings from
\textcite[See][529--530]{kant:ku} and \textcite{aksin}.
We obtain results from various authors---namely:
\textcite[See][for example]{cicero,aksin,bertram}.

\printbibliography
\end{document}

enter image description here

share|improve this answer
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
1  
@henrique I've edited the answer to incorporate prenotes. If you're ultimately wanting a multicite command, then I'm afraid this answer isn't a good one. I might revisit this problem at some point to find a better alternative. Or perhaps another user could help out with this. – Audrey Aug 25 '11 at 4:16

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

\documentclass{article}
\usepackage[style=verbose,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\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}
\addbibresource{biblatex-examples.bib}
\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}
share|improve this answer
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
1  
@Audrey: He is brilliant ;-) – Marco Daniel Sep 10 '11 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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