Stacks in TeX



There are a couple of situations where we need to talk about something that it is not yet available, for example: when we say something like ``as we will see in chapter ...'; whenever we want to use a bibliographic citation. Those situations are well treated in LaTeX by the use of auxiliary files.

A different situation arises if we want to have a LaTeX environment where one or more commands depend on the arguments given to other commands, that is, the values of the arguments of one command are taken from the arguments of another command. We can also use an auxiliary file as a way of communication between commands but that implies that we have to process the document twice (at least) in order to complete the environment.

In this paper we describe the implementation of stacks in TeX as a way to solve the problem just described. One command puts the info in the stack, the other command takes the info from the stack, and with this approach we manage to establish communication between commands processing the document only once.




TeX programming


TUGboat, Vol. 26, #1, pp. 7-9, TeX User Group, September 2005

Cited by

No citations found