quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.89k stars 320 forks source link

Customize the `out-width` in multi-plot layouts on PDF output. #7074

Open eyayaw opened 1 year ago

eyayaw commented 1 year ago

This is related to #2417.

Changing the out-width in a multi-plot layout is ignored for pdf output.

---
title: "Customize out-width in multi-plot layouts"
format: 
  pdf:
    keep-tex: true
---

::: {#fig-elephants layout-ncol="2" width="49%"}
![Surus](https://github.com/quarto-dev/quarto-web/blob/main/docs/authoring/_figure-examples/surus.png?raw=true){#fig-surus}

![Hanno](https://github.com/quarto-dev/quarto-web/blob/main/docs/authoring/_figure-examples/hanno.png?raw=true){#fig-hanno}

Famous Elephants
:::

::: {#fig-elephants-1 layout-ncol="2"}
![Surus](https://github.com/quarto-dev/quarto-web/blob/main/docs/authoring/_figure-examples/surus.png?raw=true){#fig-surus-1 width="97.5%"}

![Hanno](https://github.com/quarto-dev/quarto-web/blob/main/docs/authoring/_figure-examples/hanno.png?raw=true){#fig-hanno-2 width="97.5%"}

Famous Elephants 1
:::

Custom widths are completely ignored on pdf output.

Generated tex ```tex \begin{figure} \begin{minipage}[t]{0.50\linewidth} {\centering \raisebox{-\height}{ \includegraphics{out-width_files/mediabag/surus.png} } } \subcaption{\label{fig-surus}Surus} \end{minipage}% % \begin{minipage}[t]{0.50\linewidth} {\centering \raisebox{-\height}{ \includegraphics{out-width_files/mediabag/hanno.png} } } \subcaption{\label{fig-hanno}Hanno} \end{minipage}% \caption{\label{fig-elephants}Famous Elephants} \end{figure} \begin{figure} \begin{minipage}[t]{0.50\linewidth} {\centering \raisebox{-\height}{ \includegraphics{out-width_files/mediabag/surus.png} } } \subcaption{\label{fig-surus-1}Surus} \end{minipage}% % \begin{minipage}[t]{0.50\linewidth} {\centering \raisebox{-\height}{ \includegraphics{out-width_files/mediabag/hanno.png} } } \subcaption{\label{fig-hanno-2}Hanno} \end{minipage}% \caption{\label{fig-elephants-1}Famous Elephants 1} \end{figure} ```
cderv commented 1 year ago

@dragonstyle do we allow sizing inside layout for LaTeX ?

it seems it works for HTML, but I am not sure if LaTeX implementation of layout allow sizing. It seems it probably should work but unsure...

cscheid commented 1 year ago

(tagging myself on this one too since the fix will go through the new PanelLayout node. That's messy enough that I think you'll want my help. Let me know..)