argument_parsing {TeXCheckR} | R Documentation |
Replace nth arguments
Description
Replace nth arguments
Usage
replace_nth_LaTeX_argument(
tex_lines,
command_name,
n = 1L,
replacement = "correct",
optional = FALSE,
warn = TRUE,
.dummy_replacement = "Qq"
)
nth_arg_positions(
tex_lines,
command_name,
n = 1L,
optional = FALSE,
star = TRUE,
data.tables = TRUE,
allow_stringi = TRUE
)
Arguments
tex_lines |
A character vector of a LaTeX file (as read in from |
command_name |
The command name, or the pattern of the command, without the initial backslash. |
n |
Which argument of the command. |
replacement |
What to replace the |
optional |
If |
warn |
If the nth argument is not present, emit a warning? Set to |
.dummy_replacement |
An intermediate replacement value.
This value cannot be present in |
star |
Assume the starred version of the command. That is, assume that the contents of the argument lies on a single line. |
data.tables |
Should each element of the list be a |
allow_stringi |
(logical, default: |
Details
nth_arg_positions
reports the starts and stops of the command for every line.
This includes the braces (in order to accommodate instances where the argument is empty).
If the line is empty or does not contain the command the values of starts
and stops
are NA_integer_
.
Examples
nth_arg_positions("This is a \\textbf{strong} statement.", "textbf")
replace_nth_LaTeX_argument("This is a \\textbf{strong} statement.", "textbf")