Nothing
The goal of parseLatex
is to provide a parser for a subset of LaTeX
syntax that is more complete than what is handled by the
tools::parseLatex()
parser.
Perhaps some day it will handle all LaTeX inputs, but that’s not likely.
For now, I’m aiming to handle anything that knitr::kable()
and the
kableExtra
functions will produce, plus related code.
A website describing the current state is here: https://dmurdoch.github.io/parseLatex/ .
You can install the development version of parseLatex from GitHub with:
# install.packages("pak")
pak::pak("dmurdoch/parseLatex")
This is a basic example.
library(parseLatex)
library(kableExtra)
latex <- kbl(mtcars[1:2, 1:2], format = "latex")
cat(latex)
#>
#> \begin{tabular}[t]{l|r|r}
#> \hline
#> & mpg & cyl\\
#> \hline
#> Mazda RX4 & 21 & 6\\
#> \hline
#> Mazda RX4 Wag & 21 & 6\\
#> \hline
#> \end{tabular}
parsed <- parseLatex(latex)
# This is a blank followed by a table; drop the blank
table <- parsed[[find_env(parsed, "tabular")]]
# Get the alignment options from the content
brace_options(get_contents(table))
#> {l|r|r}
tableCell(table, 2,2) # The title counts!
#> 21
tableCell(table, 2,2) <- "Changed!"
table
#> ENVIRONMENT: \begin{tabular}[t]{l|r|r}
#> \hline
#> & mpg & cyl\\
#> \hline
#> Mazda RX4 & Changed! & 6\\
#> \hline
#> Mazda RX4 Wag & 21 & 6\\
#> \hline
#> \end{tabular}
kableExtra
does with tables, and try to make that easier.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.