Equation numbering in R package vignette?

Viewed 104

What is the idiomatic way to include dynamically numbered equations in the vignette for an R package? I see that there are options with pandoc-crossref and bookdown. I created my vignette using usethis::use_vignette() and trying to find a combination of yaml header and equation-writing that works. Is there a way to add dynamically updated numbers to equations written like $$y = mx+b$$ ?

I'd love an answer that includes the YAML header and an example equation. So far I have

---
title: "using_mypackage"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{using_mypackage}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---
something about my first equation

$$y = mx+b \tag{1}$$

I also see that this option works great when the output is set to pdf_document instead of html_vignette; if there's a way to make that work across output types that would be perfect.

Thanks!

0 Answers
Related