Giter VIP home page Giter VIP logo

equatags's Introduction

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.

equatags's People

Contributors

davidgohel avatar phgrosjean avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sciviews

equatags's Issues

matrix misses brackets

Thank you for cool package!
Unfortunately, I found matrix misses brackets.
See reprex below:

library(equatags)
library(magrittr)
("\\begin{matrix}
a & b \\\\
c & d \\\\
\\end{matrix}") %>%
  transform_mathjax(to = "svg") %>%
  writeLines("example.svg", useBytes = TRUE)

image

'mathjax-node' error while running transform_mathjax()

I understand that this package is quite new. But it looked so interesting that I tried it out. Based on the following error, I think I need to install node.js?

Kindly have a look, and thank you for this and other great packages that you have authored.

Reproducible Example

I ran the code from the readme and got the following error:

> library(equatags)
> x <- c("(ax^2 + bx + c = 0)",
+        "x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}")
> z <- transform_mathjax(x = x, to = "svg")
Error in transform_mathjax(x = x, to = "svg") : 
  'mathjax-node' is not in your user data directory, run `install_mathjax_npm()` to install it
> install_mathjax_npm()
Error in install_mathjax_npm() : 
  'node-js' is not available or cannot be found.

Version 0.2.1 on CRAN?

Hi @davidgohel. Would it be possible to update {equatags} on CRAN to version 0.2.1? I badly need changes mades between v0.2.0 and 0.2.1 and thus, I have to add a Remotes entry in the DESCRIPTION file of my package until v0.2.1 will be on CRAN.

Thanks!

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.