Equations to 'XML'

Provides function to transform latex math expressions into format 'HTML' or 'Office Open XML Math'. The 'XML' result can then be included in 'HTML', 'Microsoft Word' documents or 'Microsoft PowerPoint' presentations by using a 'Markdown' document or the R package 'officer'.


equatags

R buildstatus

The goal of the package is to provide a tool to transform latex math expressions into HTML format and Office Open XML Math format (which can be used in a Word or PowerPoint document).

Installation

You can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("davidgohel/equatags")

Example with flextable

library(flextable)

eqs <- c(
  "(ax^2 + bx + c = 0)",
  "a \\ne 0",
  "x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}")
df <- data.frame(formula = eqs)
df


ft <- flextable(df)
ft <- compose(
  x = ft, j = "formula",
  value = as_paragraph(as_equation(formula)))
ft <- align(ft, align = "center", part = "all")
ft <- width(ft, width = 2, j = "formula")
ft

Related work

  • Packages texPreview written by Jonathan Sidi, “compile snippets of ‘LaTeX’ directly into images from the R console to view in the ‘RStudio’ viewer pane, Shiny apps and ‘RMarkdown’ documents”. With this package, you can get images from your ‘latex’ code. The tool offers a wider functional spectrum than just equation processing and focuses on ‘latex’ instead of only ‘MathJax’ equations.

  • Package mathjaxr written by Wolfgang Viechtbauer, “Using ‘Mathjax’ in Rd Files”. This package let you add equations in the manual pages of your package in a very convenient way.

  • Package katex written by Jeroen Ooms, “Rendering Math to HTML, ‘MathML’, or R-Documentation Format”. ‘equatags’ mainly uses its functions.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("equatags")

0.2.2 by David Gohel, a year ago


Report a bug at https://github.com/ardata-fr/equatags/issues


Browse source code at https://github.com/cran/equatags


Authors: David Gohel [aut, cre] , ArData [cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports xml2, xslt, katex


Imported by nlmixr2rpt.

Suggested by flextable, polarzonoid.


See at CRAN