1

I'd like to use fenced divs in a large bookdown project to create numbered environments like Theorem, Example, etc. Bookdown's built-in code blocks to do this aren't sufficient, since they can't have R code blocks inside of them and also interfere with RStudio syntax highlighting.
Fenced divs have a lighter syntax and work really well for me.

I can do this:

::: {.example #funexample}
Here is an example
:::

Bookdown automatically calls the lua-filter latex-div.lua by Lesur, Derview, and Xie on these blocks. I've modified this filter to handle latex labels properly, and plan to continue to customize it. I can use my new filter with the following in output.yml:

  pandoc_args:
    - --lua-filter=latex-fenced-blocks.lua

However, it appears that the latex-div.lua filter is hardwired into the pandoc command that bookdown uses to generate latex. Is there a way to tell bookdown I do not want it to use the latex-div.lua filter?

The pandoc_args seems to only allow for adding arguments to pandoc, not removing them.

turtlegraphics
  • 296
  • 3
  • 8
  • 1
    Just found this: https://github.com/rstudio/bookdown/issues/924 in which it seems @yihui is thinking about the same fenced div solution to theorem/example/etc. numbering. – turtlegraphics Aug 31 '20 at 03:51
  • 1
    Yes, we'll work on it in a few weeks. – Yihui Xie Aug 31 '20 at 13:55
  • @YihuiXie .. I have written a lua filter that handles fenced divs for both html and latex. I'd like to offer it to you as a solution, or the start of a solution. You can see it here: https://github.com/turtlegraphics/book-test – turtlegraphics Sep 10 '20 at 07:21
  • Thanks! I don't have time to look at your Lua filer at the moment, but we have started working on our version two weeks ago: https://github.com/rstudio/bookdown/pull/940 Feedback welcome! – Yihui Xie Sep 10 '20 at 13:31

0 Answers0