[Tex/LaTex] way to make LaTex show up in RStudio preview

htmlpdftexrstudio

I'm using RStudio (current version) on a Windows 10. The math rendering works but when I add additional aspects to make the document more clean, I run into the problem of going from pdf to html and vice-versa. For instance, the following is knit to pdf with LaTex "code":
enter image description here

Now, the following is the same input but knit to html:
enter image description here

You can't really tell, but the R Markdown link (highlighted in the html) works for the pdf as well. The only difference is that the html does not display the theorem. The only way to mimic it, is to use html code but its not the same. Is there a way to make the html display the LaTex input just like the pdf? If not, then how does one deal with the issue of going from html to LaTex and vice-versa?

Best Answer

It should be showing previewed TeX in all cases here is TeX in Sweave rendered to PDF Also in-line preview in editor and Knit to both HTML and PDF.

enter image description here

I suggest that you need to query with the editor application forum what TeX settings or support packages you require. see https://support.rstudio.com/hc/en-us

In answering another question about how to manipulate highlighting of TeX in Rstudio Chunks (such as within your example of a Theorem) I found that it is possible to show the theorem as html in the knit preview viewer and thus in the Browser HTML but it is not done as a real time (In-line) preview since parts of the chunk need to be processed as a full document through Pandoc to resolve cross-references etc. This concurs with what is mentioned by the manual.

I guess it should be possible to send all that code I used to describe 1 character to mathjax and display in a mini html preview but in this case it helps to send the whole input on random occasions for the characters to be resolved for checking thus not slowing the machine down whilst each character of the block is compiled. For snippets of plain TeX it could run the same as other blocks of tex preview but in the code chunk they are rarely plain tex since they are as here being modified.

enter image description here