I would like
- my citation style to be a footnote
Author (Year)
- for the entire
Author (Year)
to be a hyperlink to the bibliography - for repeated citations to be
Ibid
So far I can almost do it all.
The code below compiles to give the correct hyperlink and the correct ibidem, but the citation is Author Year
(no parentheses). If I change each autocite
to footcite
I get the correct hyperlink and the correct citation, but the wrong ibidem: Author (ibid.)
.
If I make the first autocite
a footcite
, I get the intended result ... but that means I have to keep track of autocite
and footcite
, which defeats the purpose of automatic ibidem.
\documentclass{article}
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=authoryear-ibid,ibidtracker=constrict, autocite=footnote]{biblatex}
\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{#1}}
\DeclareFieldFormat{textcitehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{%
#1%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}}
\savebibmacro{cite}
\savebibmacro{textcite}
\renewbibmacro*{cite}{%
\printtext[citehyperref]{%
\restorebibmacro{cite}%
\usebibmacro{cite}}}
\renewbibmacro*{textcite}{%
\ifboolexpr{
( not test {\iffieldundef{prenote}} and
test {\ifnumequal{\value{citecount}}{1}} )
or
( not test {\iffieldundef{postnote}} and
test {\ifnumequal{\value{citecount}}{\value{citetotal}}} )
}
{\DeclareFieldAlias{textcitehyperref}{noformat}}
{}%
\printtext[textcitehyperref]{%
\restorebibmacro{textcite}%
\usebibmacro{textcite}}}
% The following lines give the correct footcite Author (Year) but make the ibid erroneous
% Author (ibid)
\DeclareCiteCommand{\footcite}[\mkbibfootnote]
{\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\iffirstcitekey
{\setcounter{textcitetotal}{1}}
{\stepcounter{textcitetotal}%
\textcitedelim}%
\usebibmacro{textcite}}
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}
{\usebibmacro{textcite:postnote}}
\begin{filecontents}{\jobname.bib}
@book{Chomsky1986,
Address = {Cambridge Mass.},
Author = {Noam Chomsky},
Publisher = {{MIT} Press},
Title = {Barriers},
Year = {1986}}
@book{Chomsky1981,
Address = {Dordrecht},
Author = {Noam Chomsky},
Publisher = {Foris Publications},
Title = {Lectures on Government and Binding},
Year = {1981}}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\section{}
% switching between \autocite and \footcite solves some problems but
% exposes others
\autocite{Chomsky1981} and \autocite{Chomsky1981}
\printbibliography
\end{document}