0

I need in a tufte-book citations with author-year and used the recommendations for the author-year style. Unlike the case there, I want

  • the simple citation in regular text as sidenote (as is automatically produced with autocite=footnote and the tufte style) and
  • a plain citation in footnotes.

I have tried to change the code given there to have autocite a footnote in regular text and a plain citation in a footnote, but have not succeeded.

What must be changed?

% \documentclass[a4paper,openany,nobib]{tufte-book}  
\documentclass{article}
\usepackage[style=authoryear,
            autocite=footnote]{biblatex}

\DeclareAutoCiteCommand{inlineplainfootnote}{\mysmartcite}{\mysmartcites}

\DeclareCiteCommand{\mysmartcite}[\iffootnote\textnormal\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareMultiCiteCommand{\mysmartcites}
    [\iffootnote\textnormal\mkbibparens]{\mysmartcite}{\multicitedelim}

\ExecuteBibliographyOptions{autocite=inlineplainfootnote}

% \usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{B02,
  author = {Poet, B.},
  year = {2002},
  title = {Beta},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\null\vfill% just for the example

Some text with a reference \autocite{A01} which should become a sidenote i.e. 1 and the sidenote should say: (Author 2001) .

Some more text with a citation which should become a footnote or sidenote saying: Author 2001, Poet 2002 \autocite{A01, B02}.

Some text with a footnote \footnote{A footnote with \autocite{B02}.} which should say: 1 A footnote with (Poet 2002).

And some text with a footnote with two citations \footnote{Two citations\autocite{B02, A01}} which should say: 2 Two citations(Poet 2002; Author 2001).

\printbibliography

\end{document}

Aside: I have added a second bib entry, but it cannot be found. what is wrong there?

user855443
  • 1,120
  • What do you mean by "plain citation"? Can you show us what the output should look like in the example? – moewe Jul 14 '23 at 15:39
  • As to your aside: filecontents does not overwrite an existing file. So if you started out with a .bib file of the same basename as your .tex file or edited the filecontents later to include the second reference, the old file with the old contents will stick around. I get two working citations in your example. Delete the test .bib file (and the .aux, .bbl and .bcf) and try again. – moewe Jul 14 '23 at 15:40
  • @moewe - I have put the expected output in the example file. thank you for asking! - I recently switched to vscode with latex-workshop and did not see that clean up did not delete the .bib file - I expected the error in missing , or similar. – user855443 Jul 14 '23 at 18:53
  • @user855443 Note you should be very glad VSC doesn't delete your bibliography database! – cfr Jul 15 '23 at 01:46
  • @cfr - I have my true bib files stored somewhere else, but I can see your point. It is just another piece of information somebody not using latex every day may not have present. – user855443 Jul 15 '23 at 08:32

1 Answers1

2

I think you don't need to define any new citation commands: You could be pretty happy with the standard \smartcite approach were it not for the fact that biblatex can't detect footnotes in tufte-book. So all we need to do is make it detect footnotes. This is done by inserting \toggletrue{blx@footnote} in the right place in the footnote implementation.

\documentclass[a4paper,openany,nobib]{tufte-book}

\usepackage[style=authoryear, autocite=footnote]{biblatex}

\makeatletter \renewcommand@footnotetext[2][0pt]{% \marginpar{% \hbox{}\vspace{#1}% \def\baselinestretch {\setspace@singlespace}% \reset@font\footnotesize% @tufte@margin@par% use parindent and parskip settings for marginal text \vspace{-1\baselineskip}\noindent% \protected@edef@currentlabel{% \csname p@footnote\endcsname@thefnmark% }% \color@begingroup% @makefntext{% \toggletrue{blx@footnote}% \ignorespaces #2% }% \color@endgroup% }% }%

\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document} Some text with a reference \autocite{sigfridsson}

Some more text with a citation\autocite{sigfridsson, nussbaum}.

Some text with a footnote \footnote{A footnote with \autocite{nussbaum}.}

And some text with a footnote with two citations \footnote{Two citations\autocite{nussbaum, sigfridsson}}

\printbibliography \end{document}

1 Sigfridsson and Ryde 1998.
2 Sigfridsson and Ryde 1998; Nussbaum 1978.
3 A footnote with (Nussbaum 1978).
4 Two citations(Nussbaum 1978; Sigfridsson and Ryde 1998)

Note that this does not include parentheses in footnotes that contain only citations.

moewe
  • 175,683
  • Excellent - worked immediately and solved a vexing problem with footnotes in footnotes for the tufte style (the mechanism should probably be incorporated somewhere in the style?). I am impressed with the simplicity of the solution! Thanks a lot! – user855443 Jul 15 '23 at 08:47