[Tex/LaTex] type \LaTeX inside inline code in Rmarkdown

knitrmarkdownrsymbolssyntax highlighting

I know I can use $$ to write \LaTeX in Rmarkdown documents like $\beta$. My goal is if this is possible inside inline code.

I would do `$\beta$` or `$\\beta$`, but both do not work.

In case it is not possible, is there some way to generate a greek letter inside inline code in Rmarkdown?

Following https://stackoverflow.com/questions/26821326/how-can-i-write-special-characters-in-rmarkdown-latex-documents, I tried `β`.

But it also does not work. What can I do?


Best Answer

Here I found that it depends on the type of area you are working in and potentially easier if your target is to show it in html rather than pdf so within a code chunk I got best success with <code><mathml><mi>&#x03B2;</mi></mathml></code>

Whereas outside a code chunk I found I had to simply use


enter image description here

Note the highlighted β