rstudio / bookdown

Authoring Books and Technical Documents with R Markdown
https://pkgs.rstudio.com/bookdown/
GNU General Public License v3.0
3.76k stars 1.27k forks source link

[FR] Allow to use `$$` for numbering equation in **bookdown** #1441

Open cderv opened 1 year ago

cderv commented 1 year ago

This based on ideas and discussion with @Abhi-1U around his work on texor, and what we do in Quarto.

We can use Lua to tweak the rendering and so remove some contraint.

For numering equation, this is documented here: https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#equations

To number and refer to equations, put them in the equation environments and assign labels to them using the syntax (#eq:label)

Currently it needs to be inside \begin{equation} environment, and can't be inside usual $$. Though we can catch the DisplayMath, and emit the right LaTeX we need.

See this self contained reprex in this gist https://gist.github.com/cderv/13b667d1c770fb29ba1fb28cc43f228b

image

image

We could rethink the syntax also. Quarto does a specific new syntax https://quarto.org/docs/authoring/cross-references.html#equations