Open lierdakil opened 1 year ago
I can think of a few other possibilities here:
layout="2x3"
Okay, good alternatives. Some thoughts:
- Automatic in a grid of width 2
This would be annoying if you want to stack, e.g., 2 images per portrait A4 page: while not very common, also not unheard of. There are plenty of other examples where this would be insufficient.
- attribute on the outer figure specify the layout
We only really need to specify either columns or rows. Columns are simpler. But this precludes uneven grids, e.g. 2-3 and 3-2 are used sometimes.
- HorizontalRule indicate [...] a new line
Syntax-wise, this seems the most convenient option and without the flexibility drawbacks of the two previous ones. Feels rather hacky though, I mean more so than using Div
s for the same purpose.
If I had to choose one of three, I'd go with the third. In fact, convenience-wise, it's certainly preferable to divs. Divs have precedent for something similar, though, since we have the columns
thingamajig.
@tarleb any thoughts on this?
For docx, output pandoc use tables to place subfigures, and we basically need a friendly way to define a 2d table that contains images. Divs would give us the necessary flexibility and would encode weird layouts with rowspans and colspans. The downside is that this could be a little too flexible, as I don't think there is an easy way to build those complex figures with ConTeXt.
A figure attribute with the grid dimensions would be the easy and safe choice. Not sure which I like better.
Docs on how Quarto handles figures: https://quarto.org/docs/authoring/figures.html#subfigures
I guess that approach would preclude uneven grids (e.g. 2 in a row, then a big image in one row, then 2 more). EDIT: Oh, I see quarto has this: {layout="[[1,1], [1]]"}
Another possibility, perhaps, would be to have the writer determine an ideal layout based on width information on the figures/images. So, for example, if you have 3 images in your figure, and the first has width 100% and the second and third 50%, then you get one row with the first image and then a second row with the next two. (This would rule out having very narrow images in rows by themselves; I don't know if that's something people would want to do.)
Note: we should also think about how it would work in other writers. In HTML, I'd want the layout to be responsive, so that when the article is read on a phone the figures stack vertically but on a browser they are laid out in tabular form. This could be achieved using flex-wrap and assigning widths to the subfigures. If that's how it would be best to work in HTML, then it might not be ideal to expect layout to be hard-coded in the source document.
When I convert the latex to docx, the subfigure is also placed on a single line. Is there any plan to improve this issue.
Describe your proposed improvement and the problem it solves.
Pandoc 3.0 introduced subfigures support in LaTeX. The problem is LaTeX writer always puts all subfigures into one line, and it's pretty common to align figures in a grid instead. This is a pretty bad experience, frankly.
Additional context: pandoc-crossref.
I don't have good ideas what could be done here, considering
Figure
is a flat list ofBlock
s. But I have a "bad" idea -- group rows withDiv
s, otherwise plop subfigures vertically.Describe alternatives you've considered.
:shrug: use blockquotes to group rows? That sounds even more hacky.