Learn R Programming

TeXCheckR (version 0.2.0)

argument_parsing: Replace nth arguments

Description

Replace nth arguments

Usage

replace_nth_LaTeX_argument(tex_lines, command_name, n = 1L,
  replacement = "correct", warn = TRUE, .dummy_replacement = "Qq")

nth_arg_positions(tex_lines, command_name, n = 1L)

Arguments

tex_lines

A character vector of a LaTeX file read in from readLines.

command_name

The command name, or the pattern of the command, without the initial backslash.

n

The number of mandatory arguments.

replacement

What to replace the nth argument with.

warn

If the nth argument is not present, emit a warning? Set to FALSE for n-ary commands.

.dummy_replacement

An intermediate replacement value. This value cannot be present in tex_lines.

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).

Examples

Run this code
# NOT RUN {
nth_arg_positions("This is a \\textbf{strong} statement.", "textbf")
replace_nth_LaTeX_argument("This is a \\textbf{strong} statement.", "textbf")

# }

Run the code above in your browser using DataLab