-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.Rmd
More file actions
67 lines (52 loc) · 1.86 KB
/
README.Rmd
File metadata and controls
67 lines (52 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# parseLatex
<!-- badges: start -->
[](https://github.com/dmurdoch/parseLatex/actions/workflows/R-CMD-check.yaml)
[](https://CRAN.R-project.org/package=parseLatex)
<!-- badges: end -->
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/ .
## Installation
You can install the development version of parseLatex from [GitHub](https://github.com/) with:
``` r
# install.packages("pak")
pak::pak("dmurdoch/parseLatex")
```
## Example
This is a basic example.
```{r example}
library(parseLatex)
library(kableExtra)
latex <- kbl(mtcars[1:2, 1:2], format = "latex")
cat(latex)
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))
tableCell(table, 2,2) # The title counts!
tableCell(table, 2,2) <- "Changed!"
table
```
## To-do list
- Possibly add class for table objects, and implement
indexing and subsetting on that class.
- See what `kableExtra` does with tables, and try to make that
easier.
- Do something with math environments?