/
Generating equation numbers in RMarkdown files
Generating equation numbers in RMarkdown files
I came across a MathJax script that you can add to the top of a .Rmd file, which then automatically generates numbers to the right of your display equation (i.e., $$eqn$$):
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
equationNumbers: {
autoNumber: "all",
formatNumber: function (n) {return +n}
}
}
});
</script>
The script is placed at the top of the Rmd file, below the YAML block. I’m not sure if this works for other documents, but this is how it looks in a webpage:
It also appears that the numbers don’t show up for in-line equations. And you can stop a number from showing up to the right of a display equation using \nonumber
in the LaTeX code. For example: $$E=mc^2\nonumber$$
would not have a number associated with it.
, multiple selections available,