The vector package^{∗}

Nick Efford^{†}

                            nde@dcre.leeds.ac.uk

1994/09/16

Abstract This package provides a set of new commands for representing vectors in various ways. The commonly-used bold and underlined notations are supported, as is the ‘hat’ notation for representing unit vectors. Macros are also provided to represent a row or column vector as a set of elements.

1 Introduction

L^{A}TEX 2ε provides the \vec command to represent vectors in math mode; $\vec{a}$, for example, produces a⃗. In the author’s experience, vectors are more commonly represented either in bold face roman type or else by means of underlining. Another convenient notation is the use of the ‘hat’ to indicate a unit-length vector. This package defines more suitable representations for vectors and unit vectors, using different fonts (boldface roman and sans serif) and two kinds of underlining (straight and wavy). It also defines macros which represent row or column vectors as implicit or explicit sequences of elements.

2 Examples

Six new commands are defined for representing vectors with a single (possibly composite) symbol. They are shown, with sample output, in table 1. Unlike \vec, the new commands can be used in text mode as well as math mode.

\uvec By default, \uvec and \uuvec underline a symbol using a straight line. If a \uuvec wavy line is prefered, then the wavy package option should be specified. \irvec Another set of commands are defined which can represent a vector as a row or \icvec column of elements. \irvec and \icvec generate ‘implicit’ row and column vec-

tors, respectively. Here, only the first and last elements actually appear; \ldots is used to imply the existance of the rest. Both macros take one mandatory argument, a character which names the vector. By default, the first and last elements are constructed from this character and the subscripts ‘1’ and n, respectively. An optional argument allows final subscripts other than n to be specified. The subscript for the first element cannot be altered in this way, but then it is not likely

\firstelement that you will want to change this often. If you do need to change it, the command \firstelement can be used. Table 2 shows some sample output for \irvec.

∗This file is v1.0, last revised 1994/09/16.

†Address: School of Computer Studies, University of Leeds, Leeds LS2 9JT, United Kingdom

The syntax for \icvec is the same as that for \irvec. One important difference is that \icvec can only be used in math mode, whereas \irvec can be used in both

math and text modes. For example, \buvec{q} = \left(\icvec{q}\right) pro-

duces

q̂ = ( q_{1} ; ⋮ ; q_{n} )

\rvec The final pair of macros, \rvec and \cvec, provide explicit representations of \cvec a vector as a row or column of elements, i.e., all elements of the vector are shown^{1}.

Three mandatory arguments are used to specify the name of the vector, an integer subscript for the first element and an integer subscript for the final element. For

instance, \bvec{x} = \{\rvec{x}{1}{6}\} produces

\underline{x} = \{x_{1}, x_{2}, x_{3}, x_{4}, x_{5}, x_{6}\}

and \bvec{y} = \left[\cvec{y}{0}{3}\right] gives

y = [ \begin{matrix}y_{0} \\ y_{1} \\ y_{2} \\ y_{3} \end{matrix} ]

As with the implicit macros, \rvec may be used in both math and text modes, whereas \cvec may only be used in math mode.

1Clearly, these macros are suitable only for vectors with comparatively small numbers of elements!

\bvec{a}, \buvec{a}  a, â
\svec{a}, \suvec{a}  a, â
\uvec\{a\}, \uuvec\{a\}  \underline{a}, ˆ \underline{a} / ã, ˜ â

Table 1: new commands for symbolic vectors.

\irvec{a}  a_{1}, . . . , a_{n}
\irvec[4]{a}  a_{1}, . . . , a_{4}

\firstelement{0}
\irvec[9]{a}  a_{0}, . . . , a_{9}

Table 2: row vectors with implicit elements.