Giter VIP home page Giter VIP logo

katex's Introduction

katex badge

Rendering Math to HTML and MathML in R

Convert latex math expressions to HTML for use in markdown documents or package manual pages. The rendering is done in R using the V8 engine, which eliminates the need for embedding the MathJax library in the web pages.

Installation and documentation

Install directly from r-universe:

# Install from our universe
options(repos = c(
    ropensci = 'https://ropensci.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'))
install.packages('katex')

Docs: https://docs.ropensci.org/katex/reference/katex.html

katex's People

Contributors

bwiernik avatar jeroen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

katex's Issues

katex produces extra phantom output in rmarkdown::html_vignette

I have used katex successfully in R blogdown when creating html output. However, I am running into a problem when creating a vignette for an R package that is being output to an rmarkdown::html_vignette. Here's the yaml:

---
title: "Correlation Matrices"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Correlation Matrices}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

And here is the katex-related code:

matform <- "
R = \\left (
\\begin{matrix} 
1.0 & \\rho & \\rho & \\rho \\\\
\\rho & 1.0 & \\rho & \\rho \\\\
\\rho & \\rho & 1.0 & \\rho \\\\
\\rho & \\rho & \\rho & 1.0
\\end{matrix}
\\right )
"

katex::katex_html(matform)

And the correct matrix is generated in the html output file, but there is extra output that shows up:

katex_eample

The centered matrix on top is what I am trying to create. The "inline" piece below is not desired. Is this a bug, or have I implemented incorrectly? Thanks so much.

Probably a problem upstream or elsewhere: incorrect rendering of MathML in Chromium-based web browsers

The output of the code I have in the gist: https://gist.github.com/jmcastagnetto/e1f985c210b4b0251d8665f484d751b8 renders OK in Firefox, when using MathML for complex, multiline formulas (HTML doesn't work with those, for some reason), but it doesn't work with Chromium-based browsers. At leas under Ubuntu Linux 20.04LTS.

Attached some screenshots showing the HTML output rendered Firefox, Chromium and Brave browsers.

katex-firefox-browser-2021 07 12-18_59_12

katex-chromium-browser-2021 07 12-18_53_51

katex-brave-browser-2021 07 12-18_49_33

Support applying on HTML rendered with Pandoc and Katex

It would be great to support pandoc --katex output in render_math_in_html().

test.md file:

Display

$$
\frac{x}{y}
$$

Inline $\frac{x}{y}$

Rendering this file with --katex using Pandoc

pandoc -t html --katex -s -o test.html test.md

Applying this package function throws warning and do not render the math:

> katex::render_math_in_html("test.html", "test.html")
Warning: Did not find '$...$' or '\(...\)' equation in:
\frac{x}{y}

Warning: Did not find '$$...$$' or '\[...\]' equation in:
\frac{x}{y}

Currently, one need to convert a document using --mathjax so that it works with render_math_in_html(). Not providing math flag to Pandoc's CLI will results in warnings as LaTeX math can't be handled by Plain math transformation (which is default).
One drawback is that using --mathjax will make Pandoc insert the needed Mathjax JS and CSS if the template contains $math$.

Found while working on katex support in rmarkdown (rstudio/rmarkdown#2215)

math example not rendering right in winos

image

si
- Session info -------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/New_York            
 date     2021-07-01                  

- Packages -----------------------------------------------------------------------------------------------
 ! package     * version date       lib source                         
 P assertthat    0.2.1   2019-03-21 [?] CRAN (R 4.1.0)                 
   backports     1.2.1   2020-12-09 [1] standard (@1.2.1)              
 P cli           2.5.0   2021-04-26 [?] CRAN (R 4.1.0)                 
 P clipr         0.7.0   2019-07-23 [?] CRAN (R 4.1.0)                 
 P crayon        1.4.1   2021-02-08 [?] CRAN (R 4.1.0)                 
   curl          4.3.2   2021-06-23 [1] standard (@4.3.2)              
 P desc          1.2.0   2018-05-01 [?] CRAN (R 4.1.0)                 
 P details       0.2.1   2020-01-12 [?] CRAN (R 4.1.0)                 
 P httr          1.4.2   2020-07-20 [?] CRAN (R 4.1.0)                 
 P jsonlite      1.7.2   2020-12-09 [?] CRAN (R 4.1.0)                 
   katex       * 0.1.0   2021-07-01 [1] Github (ropensci/katex@c56d7d7)
 P knitr         1.30    2020-09-22 [?] CRAN (R 4.1.0)                 
 P magrittr      2.0.1   2020-11-17 [?] standard (@2.0.1)              
 P png           0.1-7   2013-12-03 [?] CRAN (R 4.1.0)                 
 P R6            2.5.0   2020-10-28 [?] CRAN (R 4.1.0)                 
   Rcpp          1.0.6   2021-01-15 [1] standard (@1.0.6)              
   renv          0.13.2  2021-03-30 [1] CRAN (R 4.1.0)                 
 P rprojroot     1.3-2   2018-01-03 [?] CRAN (R 4.1.0)                 
 P sessioninfo   1.1.1   2018-11-05 [?] CRAN (R 4.1.0)                 
   V8            3.4.2   2021-05-01 [1] standard (@3.4.2)              
 P withr         2.3.0   2020-09-22 [?] CRAN (R 4.1.0)                 
 P xfun          0.18    2020-09-29 [?] CRAN (R 4.1.0)                 
 P xml2          1.3.2   2020-04-23 [?] CRAN (R 4.1.0)                 

[1] C:/trials/217-cross-study/renv/library/R-4.1/x86_64-w64-mingw32
[2] C:/Users/jonathan.sidi/AppData/Local/Temp/Rtmpiwtajz/renv-system-library

 P -- Loaded and on-disk path mismatch.

> render_math_html(example_math(), preview = interactive())
[1] "<span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>f</mi><mo stretchy=\"false\">(</mo><mi>x</mi><mo stretchy=\"false\">)</mo><mo>=</mo><mfrac><mn>1</mn><mrow><mi>σ</mi><msqrt><mrow><mn>2</mn><mi>π</mi></mrow></msqrt></mrow></mfrac><msup><mi>e</mi><mrow><mo>−</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><mo stretchy=\"false\">(</mo><mfrac><mrow><mi>x</mi><mo>−</mo><mi>μ</mi></mrow><mi>σ</mi></mfrac><msup><mo stretchy=\"false\">)</mo><mn>2</mn></msup></mrow></msup></mrow><annotation encoding=\"application/x-tex\">f(x)= {\\frac{1}{\\sigma\\sqrt{2\\pi}}}e^{- {\\frac {1}{2}} (\\frac {x-\\mu}{\\sigma})^2}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">x</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2777777777777778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2777777777777778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.5249199999999998em;vertical-align:-0.5379999999999999em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mopen nulldelimiter\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.845108em;\"><span style=\"top:-2.5510085em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03588em;\">σ</span><span class=\"mord sqrt mtight\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.912845em;\"><span class=\"svg-align\" style=\"top:-3em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord mtight\" style=\"padding-left:0.833em;\"><span class=\"mord mtight\">2</span><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03588em;\">π</span></span></span><span style=\"top:-2.872845em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"hide-tail mtight\" style=\"min-width:0.853em;height:1.08em;\"><svg width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl0 -0\nc5.3,-9.3,12,-14,20,-14\nH400000v40H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM834 80h400000v40h-400000z'/></svg></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.12715500000000002em;\"><span></span></span></span></span></span></span></span></span><span style=\"top:-3.23em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line\" style=\"border-bottom-width:0.04em;\"></span></span><span style=\"top:-3.394em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.5379999999999999em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter\"></span></span></span><span class=\"mord\"><span class=\"mord mathnormal\">e</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.98692em;\"><span style=\"top:-3.363em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">−</span><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mopen nulldelimiter sizing reset-size3 size6\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8443142857142858em;\"><span style=\"top:-2.656em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">2</span></span></span></span><span style=\"top:-3.2255000000000003em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line mtight\" style=\"border-bottom-width:0.049em;\"></span></span><span style=\"top:-3.384em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.344em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter sizing reset-size3 size6\"></span></span></span><span class=\"mopen mtight\">(</span><span class=\"mord mtight\"><span class=\"mopen nulldelimiter sizing reset-size3 size6\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.87905em;\"><span style=\"top:-2.656em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03588em;\">σ</span></span></span></span><span style=\"top:-3.2255000000000003em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line mtight\" style=\"border-bottom-width:0.049em;\"></span></span><span style=\"top:-3.4623857142857144em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">x</span><span class=\"mbin mtight\">−</span><span class=\"mord mathnormal mtight\">μ</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.344em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter sizing reset-size3 size6\"></span></span><span class=\"mclose mtight\"><span class=\"mclose mtight\">)</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8913142857142857em;\"><span style=\"top:-2.931em;margin-right:0.07142857142857144em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>"

Better documentation on when to use functions

Hey.

I'm working on getting some math into one of my packages, and am struggling to understand when its appropriate to use which katex rendering.

I'm using roxygen2 for documentation, and am wondering why its recommended to use \Sexpr[results=rd, stage=build] and not an r katex chunk

More specifically, I'm trying to set up some doc fragments to avoid having the same text all over the place, but rather rendering the docs and vignettes using common Rmd fragments, as described here: https://www.garrickadenbuie.com/blog/dry-vignette-and-readme/

Its working super for everything but math stuff, and I was hoping katex would be the solution, but things are not rendering as expected.

I have a small example repo: https://github.com/Athanasiamo/testing.katex
Comments to what is working and not is in the hello function roxygen doc, in the vignette, and in the man/fragments file.

some formulas give unwanted annotation tags

katex_mathml("\\mu = \\beta_0 + \\beta_1 X + b_{0i} + b_{1i} X")

returns the output below. I split the output over multiple lines to highlight the issue. The output contains an annotation. This annotation is rendered below the equation when using Hugo to render the md to html.

<span class=\"katex\">
  <math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\">
    <semantics>
      <mrow>
      <mi>μ</mi>
      <mo>=</mo>
      <msub><mi>β</mi><mn>0</mn></msub>
      <mo>+</mo>
      <msub><mi>β</mi><mn>1</mn></msub>
      <mi>X</mi><mo>+</mo>
      <msub><mi>b</mi><mrow><mn>0</mn><mi>i</mi></mrow></msub>
      <mo>+</mo>
      <msub><mi>b</mi><mrow><mn>1</mn><mi>i</mi></mrow></msub>
      <mi>X</mi></mrow>
      
      <annotation encoding=\"application/x-tex\">\\mu = \\beta_0 + \\beta_1 X + b_{0i} + b_{1i} X</annotation>
      
    </semantics>
  </math>
</span>

Warning: trimming empty <span>

With new CRAN checks for the HTML manual we are seeing warnings similar to those below when using katex::katex_html:

math_to_rd.html:81:795: Warning: trimming empty <span>
math_to_rd.html:81:1030: Warning: trimming empty <span>
math_to_rd.html:81:1116: Warning: trimming empty <span>

It seems that katex adds extra empty spans as they don't seem to be generated by something in the R package.

Further investigation:
katex generates spans like this that are used for vertical alignment but html tidy
seems to think they are useless and should be removed.

<span class="strut" style="height: 0.6833em"></span>

We could perhaps argue that HTML Tidy should be used with the option --drop-empty-elements set to no.

non-ascii characters not encoded correctly on Windows 10

Follow up on #1

Non-ASCII characters are still not working correctly on Windows 10 with the current GitHub main branch (commit 56fc96f):

katex::katex_html(katex::example_math(), preview = interactive())
#> [1] "<span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>f</mi><mo stretchy=\"false\">(</mo><mi>x</mi><mo stretchy=\"false\">)</mo><mo>=</mo><mfrac><mn>1</mn><mrow><mi>s</mi><msqrt><mrow><mn>2</mn><mi>p</mi></mrow></msqrt></mrow></mfrac><msup><mi>e</mi><mrow><mo>-</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><mo stretchy=\"false\">(</mo><mfrac><mrow><mi>x</mi><mo>-</mo><mi>µ</mi></mrow><mi>s</mi></mfrac><msup><mo stretchy=\"false\">)</mo><mn>2</mn></msup></mrow></msup></mrow><annotation encoding=\"application/x-tex\">f(x)= {\\frac{1}{\\sigma\\sqrt{2\\pi}}}e^{- {\\frac {1}{2}} (\\frac {x-\\mu}{\\sigma})^2}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">x</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2777777777777778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2777777777777778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:2.25144em;vertical-align:-0.93em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mopen nulldelimiter\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.32144em;\"><span style=\"top:-2.2027799999999997em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">s</span><span class=\"mord sqrt\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.90722em;\"><span class=\"svg-align\" style=\"top:-3em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\" style=\"padding-left:0.833em;\"><span class=\"mord\">2</span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">p</span></span></span><span style=\"top:-2.86722em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"hide-tail\" style=\"min-width:0.853em;height:1.08em;\"><svg width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl0 -0\nc5.3,-9.3,12,-14,20,-14\nH400000v40H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM834 80h400000v40h-400000z'/></svg></span></span></span><span class=\"vlist-s\"><U+200B></span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.13278em;\"><span></span></span></span></span></span></span></span><span style=\"top:-3.23em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line\" style=\"border-bottom-width:0.04em;\"></span></span><span style=\"top:-3.677em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord\">1</span></span></span></span><span class=\"vlist-s\"><U+200B></span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.93em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter\"></span></span></span><span class=\"mord\"><span class=\"mord mathnormal\">e</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.0369199999999998em;\"><span style=\"top:-3.4130000000000003em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">-</span><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mopen nulldelimiter sizing reset-size3 size6\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8443142857142858em;\"><span style=\"top:-2.656em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">2</span></span></span></span><span style=\"top:-3.2255000000000003em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line mtight\" style=\"border-bottom-width:0.049em;\"></span></span><span style=\"top:-3.384em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\"><U+200B></span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.344em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter sizing reset-size3 size6\"></span></span></span><span class=\"mopen mtight\">(</span><span class=\"mord mtight\"><span class=\"mopen nulldelimiter sizing reset-size3 size6\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.87905em;\"><span style=\"top:-2.656em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03588em;\">s</span></span></span></span><span style=\"top:-3.2255000000000003em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line mtight\" style=\"border-bottom-width:0.049em;\"></span></span><span style=\"top:-3.4623857142857144em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">x</span><span class=\"mbin mtight\">-</span><span class=\"mord mathnormal mtight\">µ</span></span></span></span></span><span class=\"vlist-s\"><U+200B></span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.344em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter sizing reset-size3 size6\"></span></span><span class=\"mclose mtight\"><span class=\"mclose mtight\">)</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8913142857142857em;\"><span style=\"top:-2.931em;margin-right:0.07142857142857144em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">2</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>"

Created on 2021-07-08 by the reprex package (v2.0.0)

image

Greek letters are pretty generally not working on Windows.

This roxygen2 block:

#' Compute the rank-biserial correlation
#' (\Sexpr[results=rd, stage=build]{katex::math_to_rd('r_{rb}', 'r_rb', FALSE)}),
#' Cliff's *delta* (\Sexpr[results=rd, stage=build]{katex::math_to_rd("\\\\delta", 'delta', FALSE)}),
#' rank epsilon squared (\Sexpr[results=rd, stage=build]{katex::math_to_rd('\\\\varepsilon^2', 'epsilon^2', FALSE)}), and
#' Kendall's \eqn{W} effect sizes for non-parametric (rank sum) tests.

produces:

image

Originally posted by @bwiernik in #1 (comment)

Spaces in the \text{} function showing up as 愼㸰 on pkgdown site

I had the following roxygen2 documentation in my package:

#' \Sexpr[results=rd, stage=build]{
#' katex::math_to_rd("a_{n+1} = f(a_n) \\\\text{ with known inital value } a_0")
#' }

It comes out as I would expect in the help file:

image

But when I build my pkgdown site it comes up as follows:

image

with the 愼㸰 characters instead of spaces.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.