Skip to contents

These internal functions provide functionality to find environment names and their use

Usage

FindBegin(x, cmdName)

FindEnd(x, cmdName)

FindCommand(x, cmdName)

Arguments

x

string vector, each line should represent one line of a text file or a section fo a text file.

cmdName

Command to search for in x.

Value

Returns a numeric vector, indicating each occurrance of a start of a environment that looks like \begin{cmdName}

Returns a numeric vector, indicating each occurrence of a start of a environment that looks like \end{cmdName}

Returns a numeric vector, indicating each occurrence of the command \cmdName found in the document.

Details

In FindBegin and FindEnd, cmdName refers to the name of the command that would start an environment. Following the 'LaTeX' convention of "\begin{cmdName}" or "\end{cmdName}" respectively. However, it is not a full throrough check. They will only be found by this class if they are only preceded by alphanumeric characters and spaces, this is to force the user to use begin and end environments at the start of a new line. TODO: CONSIDER AYBE CHANGING THIS THIS, IT IS EASY.

On the other hand, in the function FindCommand. It finds the command "\cmdName". And in this case it is less rescrittive, as long as the line is not commented, it will find it. Make sure to not write slashes before the "\cmdName", since you might bug the program if it thinks you wrote the command but you just wrote some slashes and then the command name afterwards.

All functions don't search for commands if the commands have been commented with the latex comment command in the same line... don't try to use multiple line comments on latex please...

IMPORTANT, instead of just writing something alphanumeric, these function actually use the cmdName as a regular expression, which might be useful in many cases, but be careful with this.

TODO: Implement options for regular expressions

See also

Other Structuring Document: CompileDocument(), DivideFile(), IsWellSectioned(), StructureDocument()