parse_tex: Parse LaTeX lines

Description Usage Arguments Value Examples

View source: R/parse_tex.R

Description

Parse LaTeX lines

Usage

1
parse_tex(tex_lines)

Arguments

tex_lines

Character vector (as read from a .tex file).

Value

A data.table where each row identifies a unique character in tex_lines.

line_no

Matches the index of tex_lines.

char_no

The character within line_no.

char

The character. A single character.

tex_group

The TeX group by default. Any delimiters can be used.

optional_tex_group

(If any present), the optional TeX group.

tgi

The number of braces opened at the i-th current TeX group level.

GROUP_IDi

An integer identifying the unique contiguous block at the TeX group at or above the current group level.

GROUP_IDi

The analog for optional groups.

If tex_lines is zero-length, a null data.table.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
parse_tex(c("A{}", "B[a]{b{c}{d}}z"))
# The version transposed:
#
#>          char : A{}B[a]{b{c}{d}}z
#>           tg1 : 011111122......22
#>           tg2 : 00000000011122222
#>           og1 : 00001111111111111
#>     GROUP_ID1 : .11....222222222.
#>     GROUP_ID2 : .........111222..
#> OPT_GROUP_ID1 : ....111..........

Example output



TeXCheckR documentation built on Nov. 17, 2020, 9:08 a.m.