Learn R Programming

parseLatex (version 0.4.1)

find_caption: Find or drop captions

Description

Find or drop captions

Usage

find_caption(items)

drop_caption(items, idx = NULL)

path_to_caption(items)

Value

find_caption() returns a LaTeX2range object for any caption text, with an attribute extra holding the range of associated macros and whitespace.

drop_caption() returns the items with captions dropped as a LaTeX2 object. It has an attribute named idx that is the idx argument with corresponding elements dropped.

path_to_caption() returns a path containing the location of the first caption block within items. It has an attribute extra

containing a LaTeX2range object for the associated macros and whitespace.

Arguments

items

A LaTeX2 or other list of LaTeX2items.

idx

NULL or a vector of the same length as items

Examples

Run this code
parsed <- parseLatex("before \\caption{This is a caption} \\\\ after")
idx <- find_caption(parsed)
get_range(parsed, idx)
get_range(parsed, attr(idx, "extra"))
drop_caption(parsed)
path_to_caption(parsed)

Run the code above in your browser using DataLab