rstudio / tufte

Tufte Styles for R Markdown Documents
https://rstudio.github.io/tufte/
399 stars 110 forks source link

Broken margin citations in PDF and footnote citations in HTML #48

Open jlorieau opened 7 years ago

jlorieau commented 7 years ago

First, thank you for coding and sharing this template. It's very promising and helpful to academics.

The tufte format uses footnotes to place citations in the margin. When compiling the template in HTML format, the citations indeed appear in the margin--though without a footnote number, which would be a useful feature for scientists.

When compiling the tufte-handout (or tufte-book) template in PDF, citations do not appear in the margin as they do in the latex-tufte template.

I was able to fix this in part with a rudimentary solution, by adding the following to the YAML header.

header-includes:
  - \setcitestyle{super}
  - \renewcommand*{\citep}[1]{{\cite{#1}}}
  - \renewcommand*{\citet}[1]{{\cite{#1}}}

This effectively redefines the natbib \citep and \citet commands to use the \cite commands compatible with tufte-handouts and tufte-book. This solution doesn't adversely impact the margin citations in HTML format. However, it would be nice to still have a textual version of the \citet that includes a footnote reference (ex: Smith et al. 2000 3).

The Tufte classes appear to rely on natbib. I also tried various solutions with biblatex on the post-processed .tex file---using nobib as a documentclass option, or natbib=true as a package option to biblatex---but I couldn't get these to work.

Altogether, I'm reporting a bug and requesting a feature:

yihui commented 6 years ago

Thanks for your report and experiments, but unfortunately I don't have enough LaTeX sorcery myself to make this happen... 😞