Skip to content

Links inside fig.cap garbled with LaTeX #60

Open
@jweisber

Description

@jweisber

Thanks for the terrific package—and for the whole knitrverse!

I wonder if there's a bug that affects links placed inside fig.cap when working with LaTeX (tufte_handout or tufte_book). Here's a MWE:

---
title: "Minimal Working Example"
output: tufte::tufte_handout  # but tufte::tufte_html is fine
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse venenatis fringilla libero at tristique. 

```{r fig.cap="A plot of the famous [cars data set](https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/cars.html)."}
plot(cars)
```

Aliquam ut enim sodales, semper libero nec, bibendum velit. Pellentesque ultrices magna justo, in faucibus orci consequat sit amet.

This gives me the result:

screen shot 2018-08-22 at 8 27 44 pm

Whereas substituting tufte::tufte_html seems to work as expected.

Digging into the generated .tex file, it looks like the problem is the link just hasn't been converted from markdown to LaTeX:

\begin{figure}
\includegraphics{MWE_files/figure-latex/unnamed-chunk-1-1} \caption[A plot of the famous [cars data set](https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/cars.html)]{A plot of the famous [cars data set](https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/cars.html).}\label{fig:unnamed-chunk-1}
\end{figure}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions