Skip to content

Instantly share code, notes, and snippets.

@tomhopper
Last active April 29, 2018 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhopper/3fed738972701b4b85d3648f881b971d to your computer and use it in GitHub Desktop.
Save tomhopper/3fed738972701b4b85d3648f881b971d to your computer and use it in GitHub Desktop.
Demonstration of creating automatically-numbered equations in RMarkdown documents.
At the top of your R markdown, beneath the yaml title block, add the following `<script>` section
---
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
equationNumbers: {
autoNumber: "all",
formatNumber: function (n) {return n}
}
}
});
</script>
Then insert your displaymath equations normally:
$$g(x) = \int f(x) \mathrm{d}x$$
To prevent numbering, use the `\nonumber` switch
$$g(x) = \int f(x) \mathrm{d}x\nonumber$$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment