rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.65k stars 1.09k forks source link

square root symbol incorrectly displayed in preview pane #12849

Closed StevenJenkinsJPL closed 2 months ago

StevenJenkinsJPL commented 1 year ago

System details

RStudio Edition : desktop
RStudio Version : 2022.12.0.353
OS Version      : macOS Ventura 13.2.1 (22D68)
R Version       : 4.2.2 (2022-10-31)

Steps to reproduce the problem

Create an RMarkdown document containing this displayed equation:

$$
\newcommand{\diff}[1]{(#1_i - \bar{#1})}
\begin{align}
\sigma_{I_{XX}} & = \sqrt{ \sum_{i=1}^n \big\{  \sigma_{{I_{XX}}_i}^2 + \big[ 2 w_i \diff{y} \sigma_{y_i} \big]^2 + \big[ 2 w_i \diff{z} \sigma_{z_i} \big]^2 + \big[ \big(\diff{y}^2 + \diff{z}^2 \big)\sigma_{w_i}\big]^2 \big\} } \\
\end{align}
$$

Preview in Viewer Pane.

Describe the problem in detail

The square root symbol is displayed correctly in the inline preview but not in the Viewer Pane. There appear to be missing glyphs. Screenshot 2023-03-15 at 2 27 50 PM

The generated HTML displays correctly with Safari 16.3 (18614.4.6.1.6) and Firefox 102.9.0esr (64-bit) but not with Chrome 111.0.5563.64 (Official Build) (x86_64).

I have not processed the document giving me this problem in some months. I know it worked at some point last year but I can't say exactly when the problem first occurred.

It looks like it could be a bug in Chrome but if the Viewer Pane uses Chrome it projects into RStudio.

No errors are reported during rendering:

processing file: sqrt-problem.Rmd

'/Applications/RStudio 2022.12.0+353.app/Contents/Resources/app/quarto/bin/tools/pandoc' +RTS -K512m -RTS sqrt-problem.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output sqrt-problem.html --lua-filter /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --embed-resources --standalone --variable bs3=TRUE --section-divs --template /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /var/folders/kw/kqz7nx6j7ybd_c0mjpl4_00rbk_zwy/T//Rtmp3eFplj/rmarkdown-str1494d31a2635e.html 
output file: sqrt-problem.knit.md
![Screenshot 2023-03-15 at 2 27 50 PM](https://user-images.githubusercontent.com/26097269/225447906-6a685200-8b71-4b2d-81f3-78f2a428f1cc.png)

Output created: sqrt-problem.html

Describe the behavior you expected

Square root symbol rendered correctly.

ronblum commented 1 year ago

@StevenJenkinsJPL Thank you for raising this! I can reproduce this in RStudio Desktop and RStudio Server 2022.12.0+353 and 2023.03.0+386, but works correctly in 2022.07.2+576. Even a very simple sqrt is malformed:

$$
\sqrt{ -1 } 
$$

shows up as

sqrt

This happens for both previews and knitted files, both in the Viewer Pane and in a browser.

mikebessuille commented 1 year ago

Could be fixed by updating mathjax ? https://github.com/rstudio/rstudio/issues/11535

cderv commented 2 months ago

FWIW mathjax.rstudio.com/latest has been updated to 2.7.9 - I don't know if this fixed the issue.

ronblum commented 2 months ago

@cderv It is! Closing.