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