Set items in a LaTeX2 object
Arguments
- items
A LaTeX2 object or other list of LaTeX2item objects.
- range
A LaTeX2range object.
- values
An object that can be coerced to a LaTeX2 object or (if
range$range
isNULL
) a LaTeX2item.
Value
set_range()
replaces the item(s) at the given path, and returns the modified version of items
.
Examples
latex <- kableExtra::kbl(mtcars[1:2, 1:2], format = "latex", caption = "Sample table")
parsed <- parseLatex(latex)
tablepath <- path_to(parsed, is_env, envtypes = "tabular")
range <- LaTeX2range(tablepath, 8)
set_range(parsed, range, "The 8th item")
#> \begin{table}
#>
#> \caption{Sample table}
#> \centering
#> \begin{tabular}[t]{l|r|r}
#> \hline
#> The 8th item & mpg & cyl\\
#> \hline
#> Mazda RX4 & 21 & 6\\
#> \hline
#> Mazda RX4 Wag & 21 & 6\\
#> \hline
#> \end{tabular}
#> \end{table}