powered by
Opening a brace increases the 'group' in TeX. For example, in a{bc}{d{e}} a is in group 0, bc in group 1 as is d and e is in group 2.
a{bc}{d{e}}
a
bc
d
e
tex_group_by_char(tex_lines, optional = FALSE)
A list the same length as lines. Each element an integer vector indicating the TeX group at that position.
lines
For positions at braces the upcoming group is returned. So a{b} should return 0 1 1 0 (in its first element).
a{b}
0 1 1 0
Character vector of a document LaTeX.
If FALSE (the default), the groups are taken with respect to braces. If TRUE, square brackets are used (perhaps not associated with a command).
FALSE
TRUE
tex_group_by_char("a{bc}{d{e}}")
Run the code above in your browser using DataLab