Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.9 KB

README.md

File metadata and controls

64 lines (47 loc) · 1.9 KB

equatags

R build status

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.