The trig package^{∗}

David Carlisle carlisle@cs.man.ac.uk

1994/10/16

1 Introduction

These macros implement the trigonometric functions, sin, cos and tan. In each case two commands are defined. For instance the command \CalculateSin{33} may be isued at some point, and then anywhere later in the document, the command \UseSin{33} will return the decimal expansion of sin(33^{∘}).

The arguments to these macros do not have to be whole numbers, although in the case of whole numbers, L^{A}TEX or plain TEX counters may be used. In TEXBook syntax, arguments must be of type: ⟨optional signs⟩⟨factor⟩

Some other examples are:

\CalculateSin{22.5}, \UseTan{\value{mycounter}}, \UseCos{\count@}.

Note that unlike the psfig macros, these save all previously computed values. This could easily be changed, but I thought that in many applications one would want many instances of the same value. (eg rotating all the headings of a table by the same amount).

I don’t really like this need to pre-calculate the values, I originally implemented \UseSin so that it automatically calculated the value if it was not pre-stored. This worked fine in testing, until I remembered why one needs these values. You want

to be able to say \dimen2=\UseSin{30}\dimen0. Which means that \UseSin

must expand to a ⟨factor⟩.

∗This file has version number v1.08, last revised 1994/10/16.