quarto-dev / quarto-dev/quarto-cli

Passing LaTeX argument argument to `\includegraphics{}` (e.g `draft`)

Aperta
#6,239 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@cscheid ci sta già lavorando.

Dal 18/7/2023.

crossref enhancement latex
Lingua principale
JavaScript
Stelle
6k
Fork
458
Merge medio
1g 9h
PR unite (30g)
41

Descrizione

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:

https://github.com/ramiromagno/wiley-njd/blob/885a1827617952d3d01156ab68e6af8c8e118337/template.qmd#L131

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

![This is the sample figure caption.](empty){#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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.