| 1 |
%% file: TXSprns.doc - Parentheses Sizing - TeXsis version 2.18 |
| 2 |
%% @(#) $Id: TXSprns.doc,v 18.2 2000/05/17 00:19:46 myers Exp $ |
| 3 |
%======================================================================* |
| 4 |
% (C) Copyright 1989, 1992 by Eric Myers and Frank E. Paige |
| 5 |
% This file is a part of TeXsis. Distribution and/or modifications |
| 6 |
% are allowed under the terms of the LaTeX Project Public License (LPPL). |
| 7 |
% See the file COPYING or ftp://ftp.texsis.org/texsis/LPPL |
| 8 |
%======================================================================* |
| 9 |
\ifx\undefined\meta \texsis\input TXSdocM.doc\draft\fi |
| 10 |
|
| 11 |
|
| 12 |
\subsection{Automatic Parentheses Sizing \label{sect.paren}}% |
| 13 |
Plain \TeX\ provides automatic adjustment of the sizes of parentheses |
| 14 |
and other delimiters when you use \cs{left} and \cs{right}, as in |
| 15 |
\index{parentheses!sizes} |
| 16 |
\example |
| 17 |
|$$| |
| 18 |
\cs{left}|(| \meta{math material } \cs{right}|)| |
| 19 |
|$$| |
| 20 |
\endexample |
| 21 |
\TeXsis\ provides similar automatic sizing of parentheses and square |
| 22 |
brackets in displayed equations without the need of typing \cs{left} and |
| 23 |
\cs{right}. You must still use \cs{left} and \cs{right} for all other |
| 24 |
delimiters, and they can be used for parentheses and square brackets if |
| 25 |
desired. This feature is turned on and off with \CS{autoparens} and |
| 26 |
\cs{offparens} respectively; the default, once you say \cs{texsis}, is |
| 27 |
\CS{autoparens}. Thus, for example, |
| 28 |
\TeXexample |
| 29 |
|smalltt\autoparens |
| 30 |
$$ |
| 31 |
( a \over b ) |
| 32 |
$$ |
| 33 |
|endTeXexample |
| 34 |
produces |
| 35 |
\autoparens |
| 36 |
$$ |
| 37 |
( a \over b ) |
| 38 |
$$ |
| 39 |
whereas |
| 40 |
\TeXexample |
| 41 |
|smalltt\offparens |
| 42 |
$$ |
| 43 |
( a \over b ) |
| 44 |
$$ |
| 45 |
|endTeXexample |
| 46 |
\goodbreak\noindent |
| 47 |
produces |
| 48 |
\offparens |
| 49 |
$$ |
| 50 |
( a \over b ) |
| 51 |
$$ |
| 52 |
\autoparens |
| 53 |
which is not what one normally desires. |
| 54 |
|
| 55 |
The automatic sizing of parentheses works by making |)|, |(|, |]|, |
| 56 |
and |[| active characters in displayed equations and defining them to be |
| 57 |
macros which use \cs{left} and \cs{right} to size the parentheses. While |
| 58 |
this normally works properly and simplifies the typing of equations, it |
| 59 |
will fail if the \cs{left} and \cs{right} operators are not properly |
| 60 |
balanced, such as when a long equation is split between two or more |
| 61 |
lines with \cs{eqalign} or \cs{EQNalign}. Almost all such problems can be |
| 62 |
solved by using the control sequences \cs{lparen}, \cs{rparen}, \cs{lbrack}, |
| 63 |
and \cs{rbrack}, which are taken from Plain \TeX\ and which give just the |
| 64 |
standard parenthesis and bracket characters. For example, |
| 65 |
$$ |
| 66 |
\EQNalign{ |
| 67 |
F &= \Biggl\lbrack (a \over b) + (c \over d) \cr |
| 68 |
&\qquad + (e \over f) + (g \over h) \Biggr\rbrack \cr} |
| 69 |
$$ |
| 70 |
can be produced with |
| 71 |
\TeXexample |
| 72 |
$$ |
| 73 |
\EQNalign{ |
| 74 |
F &= \Biggl\lbrack (a \over b) + (c \over d) \cr |
| 75 |
&\quad + (e \over f) + (g \over h) \Biggr\rbrack \cr} |
| 76 |
$$ |
| 77 |
|endTeXexample |
| 78 |
\noindent |
| 79 |
Note that in this example the parentheses are balanced on one line and |
| 80 |
so can be sized automatically, while the brackets span two lines and so |
| 81 |
must be sized ``by hand.'' The \cs{vbig} macro described in the next section |
| 82 |
provides additional flexibility for sizing. |
| 83 |
|
| 84 |
If all else fails, you can use \cs{offparens} to turn off the |
| 85 |
automatic sizing of parentheses and put in \cs{left} and \cs{right} or |
| 86 |
explicit sizes yourself. In any case, you must put \cs{left} and |
| 87 |
\cs{right}, if needed, in in-line equations (math expressions which are |
| 88 |
not displayed equations), because. \CS{autoparens} only applies to |
| 89 |
displayed equations, not in-line math text.\Footnote\dag{Previous |
| 90 |
versions of \TeXsis\ used the control sequence \cs{onparens} to provide |
| 91 |
automatic parentheses sizing in {\it all} math-mode expressions. While |
| 92 |
you can still use this, we do not encourage it since it may cause |
| 93 |
problems with other uses of these characters.} |
| 94 |
|
| 95 |
%>>> EOF TXSprns.doc <<< |