rstudio / rmarkdown

Dynamic Documents for R
https://rmarkdown.rstudio.com
GNU General Public License v3.0
2.88k stars 974 forks source link

Viewing Equations in Preview HTML after rendering #15

Closed jaredlander closed 10 years ago

jaredlander commented 10 years ago

I have been experimenting with setting the Knit HTML button to use render and seem to have it working to my liking. It nicely URI-encodes images and CSS while calling out to a script for mathjax (something pandoc alone does not seem capable of doing, as far as I can tell).

When viewing the produced HTML file in Chrome, everything looks great, including equations. However, in the Preview HTML pane that opens after knitting (Ctrl+Shift+H) the equations are written as text. For some reason the mathjax equations are not rendering.

A barebones Rmd file follows:


---
title: "Portfolios"
author: "Jared P. Lander"
date: March 14, 2014
output:
  revealjs_presentation:
    mathjax: "default"
    center: true

---

# Portfolio Optimization

# Definitions

$n$ Assets  
$A_i$ Asset  

# Relative Investment
$$
    \sum_{i=1}^n w_i = 1
$$

And my settings are:

options(rstudio.markdownToHTML = 
            function(inputFile, outputFile) {
                rmarkdown::render(input=inputFile, output_format=revealjs_presentation(center=TRUE), output_file=outputFile, clean=TRUE)
            }
)

Is this an issue with the Preview window or something else?

jjallaire commented 10 years ago

You actually don't need to use rstudio.markdownToHTML to call render. If you get the current preview release of RStudio (http://www.rstudio.com/ide/download/preview) then it will call rmarkdown::render by default.

jaredlander commented 10 years ago

Got the preview release and without using rstudio.markdownToHTML it worked great, including showing the equations in the Preview Pane. Thanks!

github-actions[bot] commented 4 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.