User’s Guide to the Overword package^{∗}

Frank G. Bennett, Jr.

January 24, 1998

Abstract

This package provides two low-level macros for the parsing of text using L^{A}TEX 2ε.

1 Using the macros

This package provides two macros which can be used as building blocks for the parsing of text. It forms part of the Calendar package, but is written as a discrete module that may be used in other packages as well.

The \@ifoverword macro takes four arguments. These are, in order: a token to match; a text to expand when a match is found; a text to expand if the match is not found; and a text to expand if the macro encounters \end. This last is required to allow macros to be built which will react gracefully when the end of an environment or a document is encountered.

This macro hops over word units (delimited by a space or spaces, any number of return characters being treated as a space), and expands text according to what it finds on the other side. Within the text arguments, \@overword can be used to insert the word that has been gobbled. The expanded text can contain the name of the macro that invokes \@ifoverword. Note that \@overword is relaxed at each invocation of the macro. This can be used to detect whether the macro has encountered an \end immediately after itself or beyond a word, and thereby exit cleanly in either case.

The file demo.tex contains a sample of the use of this macro. This can be used as a model for building text-parsing loops.

The \@ifnextnparchar macro serves the same purpose as \@ifnextchar except that, like \@ifoverword, it is indifferent to \par (if it encounters one, it will gobble it and look at the next token following it). And like \@ifoverword, it takes a text to expand when the next token is \end as its fourth argument, to help protect against accidental attempts to read past the end of the file.

∗This file is version number 3.1.1.1. It was last revised on 1998/01/17 18:15:15.