lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
911 stars 72 forks source link

Feature request: one row of subfigures side-by-side #381

Closed hhirtz closed 1 year ago

hhirtz commented 1 year ago

Continuation of #60, the syntax for side-by-side subfigures only works when there are more than one row.

This works:

# Figures

<div id="fig:latex">
![cool caption](/tmp/LaTeX_logo.svg.png){#fig:logo1 width=40%}
![cooler caption](/tmp/LaTeX_logo.svg.png){#fig:logo2 width=40%}

![cool caption](/tmp/LaTeX_logo.svg.png){#fig:logo3 width=40%}
![cooler caption](/tmp/LaTeX_logo.svg.png){#fig:logo4 width=40%}

Copies of the LaTeX logo
</div>

Those logos are different I swear. Especially [@fig:logo1] and [@fig:logo2].

screen-20230317151723

But this doesn't (I only deleted the second row of images, notice how the refs are now broken):

# Figures

<div id="fig:latex">
![cool caption](/tmp/LaTeX_logo.svg.png){#fig:logo1 width=40%}
![cooler caption](/tmp/LaTeX_logo.svg.png){#fig:logo2 width=40%}

Copies of the LaTeX logo
</div>

Those logos are different I swear. Especially [@fig:logo1] and [@fig:logo2].

screen-20230317151738

The workaround I use now is to insert no-op latex $\text{}$ as a second paragraph, although it seems a HTML comment <!-- hack --> does the trick too:

# Figures

<div id="fig:latex">
![cool caption](/tmp/LaTeX_logo.svg.png){#fig:logo1 width=40%}
![cooler caption](/tmp/LaTeX_logo.svg.png){#fig:logo2 width=40%}

$\text{}$

Copies of the LaTeX logo
</div>

Those logos are different I swear. Especially [@fig:logo1] and [@fig:logo2].

screen-20230317151757

Here's the command I'm using to convert from markdown to pdf:

pandoc --filter pandoc-crossref --citeproc test.md -o test.pdf

I'm using pandoc v3.1 and pandoc-crossref v0.3.15.1a.

lierdakil commented 1 year ago

Hi! Thanks for the report! You've actually stumbled upon a bug introduced when updating to pandoc 3.0 format. I've pushed a commit that should fix this to master. I'll try to push out a release in a bit. If you need it ASAP, you could grab artefacts from https://github.com/lierdakil/pandoc-crossref/actions/runs/4460009114 once that's done (should be within the next hour or so)

hhirtz commented 1 year ago

Thank you very much! Works like a charm with v0.3.15.2