4

I would like to include some math symbols in my GitHub README file generated by Rmarkdown. However, enclosing the symbols in $ does not render them as symbols: it just puts parentheses around them. Based on this document, I thought perhaps I could use MathJax, but my efforts to get this to work have been unsuccessful so far. Any help would be appreciated!

Attempt 1:

---
output:
  github_document
---
Here are some math symbols: $/alpha$ $A$ $1$ 

Attempt 2:

---
output:
  github_document:
    pandoc_args: "--mathjax"
---
Here are some math symbols: $/alpha$ $A$ $1$ 

Attempt 3:

---
output:
  github_document:
    pandoc_args: [
      "--mathjax", "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
    ]
---
Here are some math symbols: $/alpha$ $A$ $1$

Attempt 4:

---
output:
  github_document:
    md_extensions: -tex_math_single_backslash+tex_math_dollars
---
Here are some math symbols: $/alpha$ $A$ $1$

So far, all of these attempts produced this:

enter image description here

Jeffrey Girard
  • 761
  • 4
  • 20
  • I previously used output: rmarkdown::github_document alone. This rendered dollar-bracketed text in mathtype. This functionality was lost when I updated to R 3.6. I did not manage to rescue it with this configuration. However, installing R 3.5.3 alongside, I was able to produce an output with the correct mathtype formatting, as before. I did not manage to narrow down which changes produced this effect. I'd be interested to know what changed, and if the functionality can be recovered in R 3.6.3. – rj411 Jul 26 '20 at 13:18

1 Answers1

1

That´s a difficult question and lot of people asked them before, see e.g. https://github.com/github/markup/issues/897

I found a simple solution for some small formulas, e.g. for alpha:

Just use &alpha You can also sub- or superscript with ... or ... (see more here: https://www.w3schools.com/html/html_entities.asp)

Solution found here: How to show math equations in general github's markdown(not github's blog)

J_F
  • 9,956
  • 2
  • 31
  • 55