parseTex: parseTex

Description Usage Arguments Value Author(s) Examples

View source: R/parseTex.r

Description

Parse a Tex command and return a specified argument.

Usage

1
parseTex(x, argNum, delims = "{}", warn = FALSE)

Arguments

x

A latex command, like "\bibcitetexttext"

argNum

The number of the argument desired.

delims

The delimiters to use. This must be a single string, and only the first two characters are used. First character is the opening delimiter, second character is closing delimiter.

warn

Logical scaler. If TRUE, issue a warning if the requested argument is not found. Careful here: if warn is FALSE, the calling procedure will not be able to distinguish between an argument not found and the empty argument (i.e., "").

Value

A string, the desired argument. If the argument is not found, the empty string is returned and a warning is fired if warn==TRUE.

Author(s)

Trent McDonald

Examples

1
2
3
tex <- "command{1}{1984}{{Albert and Anderson}}{{}}"
parseTex(tex, 1)
parseTex(tex, 3)

tmcd82070/tex2rmd documentation built on March 19, 2018, 12:15 p.m.