Skip to content

Unable to use MathML with rmarkdown #1724

Closed

Description

@Bisaloo

test.Rmd

---
title: test
output:
  html_document:
    pandoc_args: "--mathml"
---

$ax^2+bx+c$

I can't get MathML to work with rmarkdown. No matter what I try, I always end up with:

<p><span class="math inline">\(ax^2+bx+c\)</span></p>

Everything works fine if I use pandoc on a regular markdown file:

test.md

$ax^2+bx+c$

and I get the correct output (with the command pandoc test.md -o test.html -s --mathml --metadata pagetitle="test")

<p><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>a</mi><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mi>b</mi><mi>x</mi><mo>+</mo><mi>c</mi></mrow><annotation encoding="application/x-tex">ax^2+bx+c</annotation></semantics></math></p>

My guess it that MathML support is not (yet?) present in rmarkdown so this is a feature request.


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS, RStudio 1.2.5001

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8        LC_COLLATE=en_US.UTF-8    
  LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3 digest_0.6.23   evaluate_0.14   glue_1.3.1      graphics_3.6.1  grDevices_3.6.1 highr_0.8      
  htmltools_0.4.0 jsonlite_1.6    knitr_1.26      magrittr_1.5    markdown_1.1    methods_3.6.1   mime_0.7       
  Rcpp_1.0.3      rlang_0.4.2     rmarkdown_1.18  stats_3.6.1     stringi_1.4.3   stringr_1.4.0   tinytex_0.17   
  tools_3.6.1     utils_3.6.1     xfun_0.11       yaml_2.2.0     

Pandoc version: 2.4

Activity

  1. Bisaloo commented on Dec 6, 2019

    @Bisaloo
    ContributorAuthor

    I got it to work with

    ---
    title: test
    output:
      html_document:
        pandoc_args: "--mathml"
        mathjax: NULL
    ---
    
    $ax^2+bx+c$
    

    Feel free to close this issue if you think this is enough as far as MathML support is concerned in your opinion.

    It would be great if passing the --mathml arg automatically removed mathjax internally though.

  2. yihui commented on Dec 6, 2019

    @yihui
    Collaborator

    This is a perfectly fine feature request. I definitely agree that we shouldn't only support MathJax. I'll see what I can do. Thank you!

  3. atusy commented on Oct 31, 2020

    @atusy
    Collaborator

    I opened PR #1940 to solve this.

  4. added
    feature
    and removed on Apr 14, 2021
  5. added
    next
    on Jan 11, 2022
  6. cderv commented on Jan 25, 2022

    @cderv
    Collaborator

    @Bisaloo we have PR #1940 ready to test. You can install using

    remotes::install_github("rstudio/rmarkdown#1940")

    You should be able to set

    ---
    title: test
    output:
      html_document:
        math: mathml
    ---

    And it should work as expected.

  7. Repository owner moved this from Todo to Done in R Markdown Team Projectson Jan 31, 2022
  8. github-actions commented on Aug 2, 2022

    @github-actions

    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.

  9. locked as resolved and limited conversation to collaborators on Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurenexttheme: math support

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions