Skip to content

short-captions Lua filter not working in list of figures #273

@leowill01

Description

@leowill01

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.

here is the rendering command used by RStudio:

==> rmarkdown::render('/******/_TEST-pandoc-lua-filter-short-captions/_TEST-lua-short-captions-minreprex.rmd',  encoding = 'UTF-8');
                                                                                          
/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc +RTS -K512m -RTS _TEST-lua-short-captions-minreprex.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output _TEST-lua-short-captions-minreprex.tex --lua-filter /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --embed-resources --standalone --table-of-contents --toc-depth 2 --number-sections --highlight-style tango --pdf-engine lualatex --variable graphics --wrap preserve --lua-filter=/******/short-captions.lua --variable 'geometry:margin=1in' --variable tables=yes --standalone -Mhas-frontmatter=false 

processing file: _TEST-lua-short-captions-minreprex.rmd
output file: _TEST-lua-short-captions-minreprex.knit.md


Output created: _TEST-lua-short-captions-minreprex.pdf

ive uploaded my PDF output: _TEST-lua-short-captions-minreprex.pdf

i am running:

  • macos sonoma 14.1.2
  • rstudio Version 2023.09.1+494 (2023.09.1+494)
  • pandoc 3.1.1 [rstudio version at /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc]
  • rmarkdown 2.25
  • knitr 1.45
  • bookdown 0.37

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions