quarto-dev / quarto-dev/quarto-cli
Passing LaTeX argument argument to `\includegraphics{}` (e.g `draft`)
@cscheid is already working on this.
Since Jul 18, 2023.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Discussed in https://github.com/quarto-dev/quarto-cli/discussions/6234
Originally posted by ramiromagno July 17, 2023
Description
Is there a simple way of adding the draft option to:
such that instead of getting:
\begin{figure}[t]
{\centering \includegraphics[width=\textwidth,height=1.5in]{empty.pdf}}
\caption{\label{fig-fig1}This is the sample figure caption.}
\end{figure}
I would get the argument draft passed on to \includegraphics{}:
\begin{figure}[t]
{\centering \includegraphics[width=\textwidth,height=1.5in, draft]{empty.pdf}}
\caption{\label{fig-fig1}This is the sample figure caption.}
\end{figure}
Details
We could expect to do it like
{#fig-fig2 draft=true}
However this does not work. Currently I don't think Pandoc supports passing any attributes to LaTeX. They are ignored.
knitr does have a out.extra chunk option that allows that;
```{r}
#| fig.cap: This is the sample figure caption.
#| out.extra: draft
knitr::include_graphics("empty", error = FALSE)
```
but knitr does write the LaTeX markup directly in that case, and does not rely on Pandoc.
Note: This does not work in Quarto because quarto will always enforce Markdown syntax for image for all knitr output.
Not sure we can improve the feature without Pandoc support... 🤔 But still opening the issue to track the idea.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.