You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
im trying to render an R Markdown document using the short-captions.lua Lua filter.
the render is using bookdown references and is using the pandoc version that comes with RStudio.
THE PROBLEM = the figure caption in the list of figures (as inserted with \listoffigures) is the long caption, not the short caption specified in the {} attributes after the image link.
here's a minimal reprex of the .rmd doc:
---
title: "_TEST pandoc lua filter short-captions"
output:
bookdown::pdf_document2:
latex_engine: xelatex
pandoc_args:
- "--lua-filter=/PATH/TO/short-captions.lua"
---
\listoffigures
![(ref:my-fig)](assets/test-img.png){#fig:my-fig short-caption="short fig caption"}
(ref:my-fig) LONG FIG CAPTION LONG FIG CAPTION LONG FIG CAPTION LONG FIG CAPTION LONG FIG CAPTION LONG FIG CAPTION LONG FIG CAPTION LONG FIG CAPTION.
EDIT: this workaround was not able to render markdown or latex expression syntax in the short captions in the LOF, so here is modified script from that workaround with that added functionality (originally posted here) :
PANDOC_VERSION:must_be_at_least'3.1'ifFORMAT:match'latex' thenfunctionFigure(f)
localshort=f.content[1].content[1].attributes['short-caption']
ifshortandnotf.caption.shortthen-- Parse the short caption as Markdown to handle formatting and then convert to LaTeXlocalshort_caption=pandoc.read(short, 'markdown').blocks[1].contentf.caption.short=pandoc.Inlines(short_caption)
endreturnfendend
im trying to render an R Markdown document using the
short-captions.lua
Lua filter.the render is using
bookdown
references and is using thepandoc
version that comes with RStudio.THE PROBLEM = the figure caption in the list of figures (as inserted with
\listoffigures
) is the long caption, not the short caption specified in the{}
attributes after the image link.here's a minimal reprex of the
.rmd
doc:here is the rendering command used by RStudio:
ive uploaded my PDF output: _TEST-lua-short-captions-minreprex.pdf
i am running:
/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc
]The text was updated successfully, but these errors were encountered: