thesisdown icon indicating copy to clipboard operation
thesisdown copied to clipboard

Hyperlinks in citations

Open JVAQUEROM opened this issue 3 years ago • 8 comments

Describe the bug I do not get hyperlinks in citations to point out to the references sections (to the particular entry, of course).

To Reproduce Use any citation, and it does not happen. My experience with LaTeX is more in the way of using \cite, \citep, etc. But I am not familiar with this CSL-way.

Expected behavior All citations with a link that points to the corresponding entry in references chapter.

JVAQUEROM avatar Apr 16 '21 12:04 JVAQUEROM

I can't seem to get this to work either. I was hoping that adding in pagebackref=true to the call to \usepackage{hyperref} and then moving \usepackage[pagebackref=true]{hyperref} to be the last line before \begin{document} in template.tex would do it, but it looks like this might be more of a Pandoc/bookdown issue as I'm not getting bookdown::pdf_book to produce links to citations either.

ismayc avatar Apr 16 '21 21:04 ismayc

I guess there is no simple way to use normal natbib package with \citet / \citep commands, right?

JVAQUEROM avatar Apr 19 '21 15:04 JVAQUEROM

I'm not exactly sure, unfortunately.

ismayc avatar Apr 19 '21 16:04 ismayc

Ok, I'm getting close to getting biblatex to work.

One has to put this in the preamble of the template.tex

\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}
\addbibresource{$bibliography$}

Also, in the index.Rmd, the YAML must be

output: thesisdown::thesis_pdf: citation_package: biblatex

and in the 99-References.Rmd, last line must be:

\printbibliography

The you can knit the index.Rmd. This will fail BUT you have the .tex. Compile to PDF (this will fail). Then in a terminal (I'm on linux) run biber thesis and then you can compile to PDF again, and all goes well.

I am, however, not sure how to tell pandoc to do this, to do it automatically in the knit call

JVAQUEROM avatar Apr 23 '21 16:04 JVAQUEROM

Thanks for the update! I wonder if RStudio Community may be able to assist? Referencing {bookdown} with template: template.tex instead of {thesisdown} may get you more traction too. I have to imagine there is someone out there that has gotten this to work?

ismayc avatar Apr 23 '21 19:04 ismayc

I made some tests with {bookdown}'s pdf_book but still having some trouble with natbib. I may try biblatex, but I do not really have much time for tests, I must finish my thesis...

JVAQUEROM avatar Apr 26 '21 17:04 JVAQUEROM

Hello everyone, I experienced the same issue as described above (in-text citations are not linked to the reference chapter). However, I am was using the command [@author], where @author refers to the bibtex code. Is there anything that can be done include the hyperlink for this citation type? Thanks for you help!

the-jul avatar Aug 05 '21 11:08 the-jul

Hey, Perhaps I should have posted it here, but I managed to get biblatex and hyperlinks working in a way where you can swap between using either citeproc (without hyperlinks) or biblatex (with hyperlinks). Here's the comment with the details: https://github.com/ismayc/thesisdown/issues/207#issuecomment-2320675775

Unfortunately, I didn't manage to tell pandoc to run biber, but instead made a script to knit the document.

Hope this is helpful to anyone :)

shdam avatar Aug 30 '24 09:08 shdam