Parsing LaTeX Inputs

A SnuggleInput Object acts as a placeholder for a source of LaTeX input. This has a number of different constructors that let you pull in LaTeX Strings from various types of Java I/O Objects — currently String, File, InputStream and Reader.

NOTE: SnuggleTeX behaves like “traditional” LaTeX in that it expects all input characters to live in the ASCII subset of Unicode. Characters outside this range will be replaced with (useless) alternatives and reported as a TTEG02  error.

Given a SnuggleSession called snuggleSession and a SnuggleInput called snuggleInput, you can instruct SnuggleTeX to parse it with:


You can parse as many SnuggleInputs as you like; they will be treated like one big continuous sequential input. However, each SnuggleInput should be balanced in the sense that any open environments or braces must be closed within the same input, otherwise errors will be reported.

The parseInput() method returns false if parsing was terminated because a LaTeX input error was encountered and your SnuggleSession was configured to stop on the first LaTeX error; otherwise it returns true. See Error Reporting for more information on managing errors and configuring how they are reported.