quarto-dev / quarto-dev/quarto-cli

Varying subfigure width

Open
#1,869 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement figures layout
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/1817

Originally posted by jpmorr August 11, 2022
When dealing with a single image it's quite simple to vary the image width in the standard markup:

![Nice picture](image.jpg){#fig-img1 width=60%}

I'd like to do something similar when using a subfigure to have a little more fine gained control over some I'll fitting figures generated elsewhere.

::: {#fig-specimen_comp layout-ncol=2}

![Nice picture](image.jpg){#fig-img1 width=60%}

![Nice picture2](image2.jpg){#fig-img2}

Comparison between two samples
:::

However, I've noticed that the width attribute is completely ignored in the subfigure, setting to 10% or 90% does not change the size of the subfigure. I don't want to change the width of the column as the caption text should be equal width in this case. Is it possible to change the width of the figure, much like in latex you can set a figure to be [width=0.75\textwidth]?

Obvious solution is to make a copy of the figure I want to resize and crop it to fit better, but I like the latex solution of just changing the size.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read discussion #1817 and reproduce the supplied Quarto Markdown example with different subfigure width values. Trace how the subfigure layout handles image width compared with a standalone image. Done means the width setting changes the subfigure image without changing the column or caption width, with behavior matching the requested LaTeX-style control.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex, markdown
Domain
content
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.