Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Short captions for figures and tables #116

Closed
prakaa opened this issue Apr 27, 2023 · 4 comments · Fixed by #118
Closed

Fix: Short captions for figures and tables #116

prakaa opened this issue Apr 27, 2023 · 4 comments · Fixed by #118

Comments

@prakaa
Copy link
Contributor

prakaa commented Apr 27, 2023

I am currently using this template as a building block (great work @tompollard!), but have gone with using the excellent pandoc-crossref instead of pandoc-xnos (you need to change pandoc flags in the Makefile).

In theory, this should mean I should have been able to use short captions for both figures and tables using Lua filters for figure short-captions and table short-captions.

But if anyone else is like me and is trying to use with pandoc 3.0+, you'll notice short-captions (Lua filter for figures) doesn't work because pandoc Lua has been updated to use Figures from 3.0 onwards.

Fix:

  • jpcirrus has written a very simple and concise fix here: Use markdown image title text when generating list of figures jgm/pandoc#7915 (comment)
  • table-short-captions still works.
  • I have put both of these .lua files in a filters folder. These are called via a flag, e.g. --lua-filter=filters/figure-short-captions.lua
  • I can confirm this works for me for both figures and tables for pandoc 3.1.2 - i.e. I can add short captions and they appear in the list of figures and list of tables

Moving forward
Note that this may be addressed within pandoc itself, there is an open PR that may resolve this: jgm/pandoc#8617

I can prepare a PR for this change, but it will require moving from pandoc-xnos to pandoc-crossref. Alternatively, I am still refining my repo (which is heavily based on this one, but with some updates/opinionated changes), but happy to share with those interested and potentially release down the line.

@tompollard
Copy link
Owner

tompollard commented May 17, 2023

@prakaa thanks for raising this issue. I think switching to pandoc-crossref makes sense. Please could you open a PR?

@prakaa
Copy link
Contributor Author

prakaa commented May 17, 2023

Thanks @tompollard, will fork this repo and create a PR.

I imagine this will require:

  • Changing xnos flags to crossref in Makefile
  • Adding working figure-short-captions and table-short-captions Lua filters, and calling these in Makefile
  • Changing referencing in the sample text to conform with crossref style
  • Updating README
    • Require pandoc 3.1+

@tompollard
Copy link
Owner

thanks @prakaa, i appreciate you looking at this. sounds good to me!

@prakaa
Copy link
Contributor Author

prakaa commented May 19, 2023

@tompollard PR ready, please see #118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants