Description Usage Arguments Details Value Examples
Return an argument of a Tex command.
1 | returnCommandArg(x, cmd, argNum = 1, optArg = FALSE)
|
x |
An array of character strings (lines from a Latex file) to process. |
cmd |
A character string naming the command to look for in |
argNum |
The number of the argument to |
optArg |
True or false depending on whether one of the optional arguments or one of the required arguments is desired. |
Tex command is something like "\comand[opt1]arg1arg2", and this routine returns one of those arguments, either optional or required.
The desired argument as a single text string. If the command
does not exist in x
, a string of length 0 (i.e., "") is returned.
If the requested argument does not exist (e.g., argNum
too big),
a string of length 0 (i.e., "") is returned.
1 2 3 4 5 6 7 8 | x <- c("kdkdk", "kdkd \\title{My Title", "is Sir} dkdk")
returnCommandArg(x, "title")
x <- c("\\cmd[opt1][opt2]{arg1}{arg2}")
returnCommandArg(x, "cmd", 1) # "arg1"
returnCommandArg(x, "cmd", 2) # "arg2"
returnCommandArg(x, "cmd", 1, TRUE) # "opt1"
returnCommandArg(x, "cmd", 2, TRUE) # "opt2"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.