TeX - LaTeX Asked on February 23, 2021
Is it possible to redefine textcite
when using autocite=footnote
so that it places the the authors’ names in the text but places the rest of the citation in a footnote? As it stands now, textcite
prints the authors’ names along with the year in the text. To me, the style I suggest seems like it would be more consistent.
For extra credit, would it be possible to omit the authors’ names from the footnotes generated by this new version of textcite
?
Here is a minimal example:
documentclass{article}
usepackage[style=authoryear, autocite=footnote]{biblatex}
addbibresource{biblatex-examples.bib}
begin{document}
A citationautocite{knuth:ct:a} in a sentence.
Important works are those by textcites{bertram}{markey}.
Another important work is by textcite{knuth:ct:b}.
textbf{Instead, I would like the output to be:}
A citationautocite{knuth:ct:a} in a sentence.
Important works are those by citeauthor{bertram} and citeauthor{markey}autocites{bertram}{markey}.
Another important work is by citeauthor{knuth:ct:b}autocite{knuth:ct:b}.
end{document}
The textcite
implementation of the verbose
styles does something like that, so we can just copy the textcite
-related code from verbose.cbx
.
documentclass{article}
usepackage[style=authoryear, autocite=footnote]{biblatex}
makeatletter
renewbibmacro*{textcite}{%
ifnameundef{labelname}
{printfield[citetitle]{labeltitle}}
{printnames{labelname}}}
newbibmacro*{textcite:init}{%
citetrackerfalse%
pagetrackerfalse%
iffirstcitekey
{globalundefcbx@lasthash}
{}}
newbibmacro*{textcite:count}{%
stepcounter{textcitetotal}%
ifnumgreater{value{uniquelist}}{value{maxnames}}
{ifnumgreater{value{uniquelist}}{value{textcitemaxnames}}
{setcounter{textcitemaxnames}{value{uniquelist}}}
{}}
{ifnumless{value{labelname}}{value{maxnames}}
{ifnumgreater{value{labelname}}{value{textcitemaxnames}}
{setcounter{textcitemaxnames}{value{labelname}}}
{}}
{ifnumgreater{value{maxnames}}{value{textcitemaxnames}}
{setcounter{textcitemaxnames}{value{maxnames}}}
{}}}}
DeclareCiteCommand{cbx@textcite}
{usebibmacro{textcite:init}}
{iffieldequals{namehash}{cbx@lasthash}
{}
{iffirstcitekey
{}
{textcitedelim}%
stepcounter{textcitecount}%
usebibmacro{textcite}%
savefield{namehash}{cbx@lasthash}}}
{}
{}
DeclareCiteCommand{textcite}[cbx@textcite@initcbx@textcitefootcite]
{usebibmacro{textcite:init}%
gdefcbx@savedkeys{}%
DeferNextCitekeyHook}
{ifthenelse{iffirstcitekeyANDvalue{multicitetotal}>0}
{protected@xapptocbx@footcite@args{%
(thefield{multiprenote})(thefield{multipostnote})}}
{}%
xapptocbx@savedkeys{thefield{entrykey},}%
iffieldequals{namehash}{cbx@lasthash}
{}
{usebibmacro{textcite:count}%
savefield{namehash}{cbx@lasthash}}%
ifnumequal{value{citecount}}{value{citetotal}}
{protected@xapptocbx@textcite@args{{cbx@savedkeys}}%
protected@xapptocbx@footcite@args{%
[thefield{prenote}][thefield{postnote}]{cbx@savedkeys}}%
iflastcitekey
{protected@xapptocbx@textcite@args{thefield{postpunct}}%
protected@xapptocbx@footcite@args{nopunct}}
{}}
{}}
{}
{}
% textcite has nested DeclareCiteCommand definitions for textcite and we want to use
% the normal textcite context
DeclareDelimcontextAlias{cbx@textcite}{textcite}
newrobustcmd{cbx@textcite@init}[3]{%
setcounter{textcitetotal}{0}%
setcounter{textcitecount}{0}%
setcounter{textcitemaxnames}{0}%
defcbx@textcite@args{#1}defcbx@footcite@args{#2}#3%
cbx@textcite@argsemptycbx@footcite@argsempty}
DeclareMultiCiteCommand{cbx@textcites}{cbx@textcite}{}
DeclareMultiCiteCommand{textcites}
[cbx@textcites@initcbx@textcitesfootcites]{textcite}{}
letcbx@textcites@initcbx@textcite@init
pretocmd{cbx@textcites@init}{%
UseNextMultiCiteHook%
AtNextMultiCite{%
renewbibmacro{multiprenote}{}%
renewbibmacro{multipostnote}{}}}{}{}
makeatother
addbibresource{biblatex-examples.bib}
begin{document}
nullvfill % only for this example!
A citationautocite{knuth:ct:a} in a sentence.
Important works are those by textcites{bertram}{markey}.
Another important work is by textcite{knuth:ct:b}.
textbf{Instead, I would like the output to be:}
A citationautocite{knuth:ct:a} in a sentence.
Important works are those by citeauthor{bertram} and citeauthor{markey}autocites{bertram}{markey}.
Another important work is by citeauthor{knuth:ct:b}autocite{knuth:ct:b}.
end{document}
Correct answer by moewe on February 23, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP