diff options
author | Karl Berry <karl@freefriends.org> | 2013-03-12 22:32:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-03-12 22:32:50 +0000 |
commit | 3a6402a1f1023de22b00d622bdbd01d88fb994be (patch) | |
tree | 83bbaccd3e537e7e01c01584f55d09acd1d8c7e9 /Master/texmf-dist/source | |
parent | b994a042b1d8959e691bfccb2c866dde84324753 (diff) |
schemata (12mar13)
git-svn-id: svn://tug.org/texlive/trunk@29357 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/generic/schemata/schemata.dtx | 309 |
1 files changed, 206 insertions, 103 deletions
diff --git a/Master/texmf-dist/source/generic/schemata/schemata.dtx b/Master/texmf-dist/source/generic/schemata/schemata.dtx index 46c4b0d77e6..657641f350f 100644 --- a/Master/texmf-dist/source/generic/schemata/schemata.dtx +++ b/Master/texmf-dist/source/generic/schemata/schemata.dtx @@ -27,7 +27,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01] %<package>\ProvidesPackage{schemata} %<*package> - [2013/02/14 v0.5 generic package to aid construction of topical categories] + [2013/03/10 v0.6 generic package to aid construction of topical categories] %<package>\fi %</package> % @@ -41,7 +41,7 @@ \usepackage{mflogo} \usepackage{multicol} \usepackage[toc]{multitoc} -\usepackage{schemata}[2013/02/14] +\usepackage{schemata}[2013/03/10] \usepackage{hypdoc} \makeindex \frenchspacing @@ -56,7 +56,7 @@ %</driver> % \fi % -% \CheckSum{517} +% \CheckSum{628} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -76,6 +76,7 @@ % % % \changes{v0.5}{2013/02/14}{Initial version} +% \changes{v0.6}{2013/03/10}{Added features} % % \DoNotIndex{\@Schem@, \@Schema, \@schem@, \@schema, \@schemab@x, \@schemabox, \Schem@, \schem@, \schemab@x, \bfseries, \bgroup, \catcode, \csname, \DeclareOption, \def, \dimen, \egroup, \else, \endcsname, \endinput, \ExecuteOptions, \expandafter, \fi, \futurelet, \gdef, \hbox, \hfil, \if, \ifcsname, \ifdim, \ifmmode, \ifx, \ignorespaces, \index, \itshape, \let, \newbox, \newcommand, \newdimen, \next, \Open, \Option, \PackageWarning, \ProcessOptions, \relax, \RequirePackage, \scshape, \setbox, \space, \testchar, \vbox, \vfil, \vskip} % @@ -95,7 +96,7 @@ % % This package emerged from my personal need to typeset diagrams based on seventeenth-century theology books. I have chosen to make it use a very ``bare-bones'' approach that is platform-agnostic in many cases, simple to implement, and immune to a number of special cases because it requires manual formatting. % -% I would recommend that a package like \emph{TikZ}, something based on \MP, or some other powerful solution may have advantages, especially for those seeking a top-to-bottom diagram, such as that in; \textsc{H.~Dembowski}, \emph{Einf{\"u}hrung in die Christologie} (Darmstadt, 1993), 146. This package is meant to be basic and available in minimal \TeX{} installations. +% I would recommend that a package like \emph{TikZ}, \textsf{PSTricks}, \MP, or some other powerful solution may have advantages, especially for those seeking a top-to-bottom diagram, such as that in; \textsc{H.~Dembowski}, \emph{Einf{\"u}hrung in die Christologie} (Darmstadt, 1993), 146. This package is meant to be basic and available in minimal \TeX{} installations. % % This package allows one to mimic (to some degree) the left-to-right schemata seen in books like the \emph{Loci Theologici} of Martin Chemnitz and the \emph{Clavis Scripturae Sacrae} of M. Flacius Illyricus. % @@ -103,10 +104,10 @@ % % \subsection{Package Options and Loading} % -% Presently there are no package options.\\ +% \LaTeX{} users can choose among three package options: |braces|, |brackets|, and |parens|. These set the defaults for the ``branches.'' If no options are chosen, the default is |braces|. Plain \TeX{} and \LaTeX{} users can use the |\DoBraces|, |\DoBrackets|, and |\DoParens| macros for the same effect. The default still remains braces.\\ % % \begin{tabular}{ll} -% Users of \LaTeX{} invoke: & |\usepackage{schemata}|\\[1ex] +% Users of \LaTeX{} invoke: & |\usepackage[|\meta{options}|]{schemata}|\\[1ex] % Plain \TeX{} users will use: & |\input|\textvisiblespace|schemata.sty| % \end{tabular} % @@ -153,7 +154,7 @@ % }% % } % -% \noindent Note how the results of the two sides are roughly the same. In fact, if one uses a |p{|\meta{width}|}| argument with a tabular, one will get almost the same results seen with a |\schemabox| also using a width argument. The difference is that the latter is intended for use in plain \TeX. +% \noindent Note how the results of the two sides are similar. In fact, if one uses a |p{|\meta{width}|}| argument with a tabular, one will get similar results seen with a |\schemabox| using a width argument. The formar still must be enclosed in an |\hbox|. The latter is intended for use in plain \TeX. % % The |\schemabox| macro is a ``stack'' of |\hbox| content within a |\vbox|. We will cover it below after we introduce the |\Schema| macro. % \end{multicols} @@ -180,6 +181,17 @@ % \end{quote} % The \meta{width} of a |\schemabox| is a dimension, e.g. 3cm. No wrapping takes place. Each line of \meta{text} must be terminated explicitly by |\\|, except the final line. The first line of a |\schemabox| inserts a |\strut| for aesthetic reasons. % +% Certainly, it is not mandatory to use a |\schemabox|. Indeed, anything that creates a box whose width is smaller than |\textwidth| can be useful. For example, one can create 1cm$^2$ boxes:\\[1ex] +% | \def\Box{\hbox{\vrule\vbox to 1cm{%|\\ +% | \hrule\hbox to 1cm{\hfil}\vfil\hrule}\vrule}}|\\ +% \def\Box{\hbox{\vrule\vbox to 1cm{\hrule\hbox to 1cm{\hfil}\vfil\hrule}\vrule}} +% +% \begin{tabular}{lll} +% \schema{\Box}{\Box} & \schema{\Box}{\Box\Box} & \Schema{-0.2ex}{0.9cm}{\Box}{\Schema[close]{-0.2ex}{0.9cm}{\Box\hbox{\Box\kern0.2em}}{\Box}}\\ +% \end{tabular} +% +% \medskip\noindent Both |\schema| and |\Schema| are vertical, so they will stack vertically if invoked sequentially. A |tabular| environment prevented that stacking above. If one does not use ``ex'' height for \meta{size} in a |\Schema|, one should specify a \meta{size} slightly less than half the height of the contents. Above, a \meta{size} of |0.9cm| suffices for a content of |2cm|. This approach is meant to facilitate sizing content according to lines of text, which is what schemata usually hold. +% % \subsection{Tutorial} % % \subsubsection{Starting Off Basic} @@ -201,37 +213,13 @@ % \schema{\SB{a}}{\SB{b\\c}} % \end{multicols} % -% Now we are getting somewhere! Note that ``one-liners'' pretty much look ugly no matter how you do them. For example: -% \begin{multicols}{2} -% \noindent Code:\\[2ex] -% |\let\SB\schemabox|\\ -% |$\hbox{a}\left\lbrace%|\\ -% | \hbox{bp}\right.$|\\ -% |$\vcenter{\hbox{a}}\left\lbrace%|\\ -% | \vcenter{\hbox{b}}\right.$|\\ -% |$\vcenter{\hbox{\strut a}}%|\\ -% | \left\lbrace%|\\ -% | \vcenter{\hbox{\strut bp}}%|\\ -% | \right.$|\\ -% |\schema{\SB{a}}{\SB{bp}}|\\ -% \columnbreak\\ -% \noindent Result:\\[6ex] -% \let\SB\schemabox\bgroup\LARGE -% $\hbox{a}% -% \left\lbrace% -% \hbox{bp}% -% \right.$\\[1ex] -% $\vcenter{\hbox{a}}% -% \left\lbrace% -% \vcenter{\hbox{b}}% -% \right.$\\[0.5ex] -% $\vcenter{\hbox{\strut a}}% -% \left\lbrace% -% \vcenter{\hbox{\strut bp}}% -% \right.$\\[1.6ex] -% \schema{\SB{a}}{\SB{bp}}\egroup -% \end{multicols} -% \noindent The first example has aligned baselines, but the open brace appears to drop too low (in order to enclose also the depth, not just the height of the material). The second shows how vertical centering can cause baselines not to match up in one-liners of a different height. The third example shows how a |\strut| will fix that issue. The final example shows how this package deals with one-liners. A |\schemabox| adds a strut in the first line to make multi-line schemata look better. A height of 1.44265ex is automatically added to the brace height, also for multi-line schemata. +% \noindent Now we are getting somewhere! Note that the side of the schema that ``opens up'' really should be more than one line high:\\ +% +% \noindent\begin{tabular}{lllllllll} +% \schema{\schemabox{a}}{\schemabox{b}} & \schema{\schemabox{a}}{\schemabox{b\\c}} & \Schema{0ex}{2ex}{\schemabox{a}}{\Schema[close]{0ex}{2ex}{\schemabox{b\\c}}{\schemabox{d}}} & \DoBrackets \schema{\schemabox{a}}{\schemabox{b}} & \DoBrackets \schema{\schemabox{a}}{\schemabox{b\\c}} & \DoBrackets \Schema{0ex}{2ex}{\schemabox{a}}{\Schema[close]{0ex}{2ex}{\schemabox{b\\c}}{\schemabox{d}}} & \DoParens \schema{\schemabox{a}}{\schemabox{b}} & \DoParens \schema{\schemabox{a}}{\schemabox{b\\c}} & \DoParens \Schema{0ex}{2ex}{\schemabox{a}}{\Schema[close]{0ex}{2ex}{\schemabox{b\\c}}{\schemabox{d}}}\\ +% \end{tabular}\\ +% +% \noindent\DescribeMacro{\DoBraces} The left three examples use braces. This is the default, but it is also triggered by |\DoBraces|. \DescribeMacro{\DoBrackets} The center three examples are achieved with |\DoBrackets|. \DescribeMacro{\DoParens} The right three result from using |\DoParens|. All three macros should precede |\schema| and |\Schema| within a particular scope, and they remain in force in that scope unless changed. A height of 1.44265ex is added automatically to the height of the delimiters to aid the appearance of multi-line schemata. % % \subsubsection{\emph{Loci} 101} % @@ -269,13 +257,15 @@ % Sanctificatione \&\\ % Glorificatione ejusdem.} % } -%}\vspace{1ex} -% \noindent Something is off here. The ``simple'' schema automatically adjusts the brace height to the right-hand side. But that includes the \emph{entire} right-hand side. We shall see later that schemata also can nest left and right-hand sides. This package requires manual alignment and adjustment. +%} +% +% Something is off here. The ``simple'' schema automatically adjusts the brace height to the right-hand side. But that includes the \emph{entire} right-hand side. Moreover, |\schema| will produce cumulatively larger braces when nesting. +% +% This package requires the user to make manual alignment and adjustment to the braces when the entire right-hand side is not to be enclosed. This is because one might insert vertical space at various points that make automatic calculation of brace height somewhat less than trivial. This example is fairly simple and requires only two changes at the places indicated, namely: % % \bgroup\footnotesize% % \begin{multicols}{2} -% \noindent Initial Code:\\[1ex] -%|\schema% <---change this|\\ +%\noindent|\schema% Change to \Schema{-1ex}{8.6ex}|\\ %|{%|\\ %| \schemabox{Subjectum theo-\\|\\ %| logi\ae{} est Notitia\\|\\ @@ -291,7 +281,7 @@ %| \schemabox{Unitate natur\ae{}.\\|\\ %| Trinitate personarum.\\|\\ %| Operibus ad intra.}|\\ -%| }% <---add space|\\ +%| }% Add\smallskip here|\\\columnbreak\\ %| \schema|\\ %| {%|\\ %| \schemabox{\textsc{Voluntatem},\\|\\ @@ -309,25 +299,22 @@ %| Sanctificatione \&\\|\\ %| Glorificatione ejusdem.}|\\ %| }|\\ -%|}|\columnbreak\\ -% \noindent Subsequent Changes:\\[1ex] -%|\Schema{-1ex}{8.6ex}|\dots\\ -%\dots|\smallskip|\dots\\ +%|}|\\ +% \end{multicols} +% \egroup % -% The commented text |% <---add space| in the listing to the left, at the end of the schema beginning with ``\textsc{Essentiam},'' indicates where a little vertical space between the right-hand ``leaves'' of the ``tree'' might help, so we adjust that first in order to set the braces properly. We remove the comment and insert a |\smallskip|. The general rule is:\\ +% \noindent The commented text |% Add\smallskip here| at the bottom of the left column indicates where a little vertical space between the right-hand ``leaves'' of the ``tree'' might help. We remove the comment and insert a |\smallskip|. The general rule is:\\ % % \noindent\ \ |\schema|\dots\marg{right-hand side}\meta{vert-space} % % \noindent\ \ |\Schema|\dots\marg{right-hand side}\meta{vert-space}\\ % -% \noindent One also may insert space within a |\schemabox|, but one should avoid doing that in either the first or last lines. +% \noindent One also may insert space within a |\schemabox|, but one should avoid doing that in either the first or last lines when inside a |\schema|. % % Having adjusted the ``leaves,'' we now work toward the ``root.'' The |\Schema| macro requires manual brace adjustment and sizing. It is best used in cases where either the left or right-hand sides include a |\schema| or a |\Schema|. Manual adjustment is achieved by counting lines, estimating, and refining the estimate. % -% Observe that there is approximately eight lines from ``\textsc{Essentiam}'' down to ``ut in.'' Estimate \meta{size} to |8ex| and \meta{adjust} to |0ex|. The large brace will be a little too low. Set \meta{adjust} to |-1ex| to raise the brace about half a line and to lower the left-hand side about half a line, keeping everything centered. Finally, setting \meta{size} to |8.6ex| gives a better result. +% Even in the source above, one can estimate eight lines of output text from ``\textsc{Essentiam}'' down to ``ut in.'' Set \meta{size} to |8ex| and \meta{adjust} to |0ex|. The large brace will be a little too low. Set \meta{adjust} to |-1ex| to raise the brace about half a line and to lower the left-hand side about half a line, keeping everything centered. Finally, setting \meta{size} to |8.6ex| gives a better result. % -% \end{multicols} -% \egroup %\Schema{-1ex}{8.6ex} %{% % \schemabox{Subjectum theo-\\ @@ -364,7 +351,38 @@ % } %}\medskip % -% \noindent Before we proceed, it may be helpful to note that many schemata, such as ones that illustrate the relationship of figures and tropes to the literal sense of a text, are no more complex than this first example. +% \noindent Many schemata, such as ones that illustrate the relationship of figures and tropes to the literal sense of a text, are no more complex than this: +% +% \begin{displaymath} +% \LCschema% +% \Schema{0ex}{4.8ex} +% {\hbox{sensus literalis}} +% {% +% \schema{\schemabox{sensus\\literalis\\(improprie)}}% +% {\schemabox{ex parallelismo clarior\\ex analogia fidei\\ex evidentia rei}}% +% \smallskip\schemabox{sensus literae} +% } +% \UCschema% +% \end{displaymath} +% |\LCschema%|\\ +% |\Schema{-1ex}{5ex}|\\ +% |{\hbox{Sensus literalis}}|\\ +% |{%|\\ +% | \schema{\schemabox{Sensus\\literalis\\(improprie)}}%|\\ +% | {\schemabox{Ex parallelismo clarior\\%|\\ +% | Ex analogia fidei\\Ex evidentia rei}}%|\\ +% | \medskip\schemabox{Sensus literae}|\\ +% |}|\\ +% |\UCschema%|\\[2ex] +% \DescribeMacro{\LCschema} +% \DescribeMacro{\UCschema} +% By default, a |\schemabox| automatically adds a |\strut| to the first line because it is often the case that the topics in a schema start in some fashion with a capitalized letter. Using |\Schema| allows one to manually adjust the brace height, but |\schema|, as used above, looks wrong with the lowercase content unless one uses |\LCschema| in order to suppress adding a |\strut|. |\UCschema| restores the default. +% +% \DescribeMacro{\SwitchSB} |\SwitchSB| is a ``per-use'' macro that causes a particular |\schemabox| to do the opposite of whatever |\LCschema| and |\UCschema| call for. It should be placed immediately before the |\schemabox| and is reset thereafter. +% +% This still does not correct for the fact that |\schema| adjusts its height with respect to the ascenders and descenders, not the height of the first letter. Inserting |\vskip-0.8ex| before |\schemabox{Ex parallelismo|\dots{} causes the material in the |\schema| to look centered on the first letters. Still, if one must go to all that trouble, one could easily use |Schema|. +% +% This example also shows that one can have a heterogeneous collection of vertically-centered material within the LHS and RHS braces of |\Schema|. Doing that with |\schema| is not recommended. % \clearpage % % \subsubsection{Going Big} @@ -983,9 +1001,9 @@ % \end{multicols} % \egroup % -% \noindent The next example further illustrates spacing and adjusting:\\ +% \noindent The next example illustrates spacing, adjusting, and |\DoParens|:\\ % -% \bgroup\scriptsize% +% \bgroup\scriptsize\DoParens% %\Schema{-38ex}{14ex} %{ % \schemabox{Sacr\ae{} litter\ae{}\\ loquuntur, de} @@ -1092,30 +1110,31 @@ % } % } %} -%\egroup +%\egroup\medskip % -% \noindent Next we see some closed schemata:\\ +% \noindent Next we see some closed schemata. Braces are back, thanks to scoping rules.\\ % -%\Schema{-1.4ex}{9.4ex} +%\bgroup\small% +%\Schema{-1.4ex}{10ex} %{% % \schemabox{Qu\ae{} sit\\ % % \textsc{Dei}, vel} %} %{% -% \Schema{-1ex}{4.6ex} +% \Schema{-1ex}{5ex} % {% % \schemabox{\textsc{Essentia}, in} % } % {% -% \schemabox{Unitate divina,} +% \vskip1ex\schemabox{Unitate divina,} % \medskip -% \Schema{0ex}{3ex} +% \Schema{0ex}{3.4ex} % {% % \schemabox{Tribus perso-\\% % nis divinitatis} % } % {% -% \Schema[close]{0ex}{3ex} +% \Schema[close]{0ex}{3.4ex} % {% % \schemabox{Patre,\\ Filio,\\% % Spiritui Sancto} @@ -1127,18 +1146,18 @@ % } % } % \medskip -% \Schema{-0.2ex}{6ex} +% \Schema{-0.2ex}{6.4ex} % {% % \schemabox{\textsc{Voluntas},\\% % revelatur in\\ actione, sive} % } % {% -% \Schema{0ex}{3ex} +% \Schema{0ex}{3.4ex} % {% % \schemabox{Universali} % } % {% -% \Schema[close]{0ex}{3ex} +% \Schema[close]{0ex}{3.4ex} % {% % \schemabox{Creationis,\\% % Sustenationis,\\ Propagationis,} @@ -1158,32 +1177,32 @@ % Conservando.\\ Glorificando.} % } % } -%}\medskip +%}\egroup\medskip % % \noindent This example merits consideration because it uses not only open schemata but closed ones nested within them. One must use |\Schema| in that case to prevent the opening braces from being slightly larger than the closing braces. % % \bgroup\footnotesize% % \begin{multicols}{2} -%\noindent|\Schema{-1.4ex}{9.4ex}|\\ +%\noindent|\Schema{-1.4ex}{10ex}|\\ %|{%|\\ -%| \schemabox{Qu\ae{} sit\\ %|\\ +%| \schemabox{Qu\ae{} sit\\%|\\ %| \textsc{Dei}, vel}|\\ %|}|\\ %|{%|\\ -%| \Schema{-1ex}{4.4ex}|\\ +%| \Schema{-1ex}{5ex}|\\ %| {%|\\ %| \schemabox{\textsc{Essentia}, in}|\\ %| }|\\ %| {%|\\ -%| \schemabox{Unitate divina,}|\\ +%| \vskip1ex\schemabox{Unitate divina,}|\\ %| \medskip|\\ -%| \Schema{0ex}{3ex}|\\ +%| \Schema{0ex}{3.4ex}|\\ %| {%|\\ %| \schemabox{Tribus perso-\\%|\\ %| nis divinitatis}|\\ %| }|\\ %| {%|\\ -%| \Schema[close]{0ex}{3ex}|\\ +%| \Schema[close]{0ex}{3.4ex}|\\ %| {%|\\ %| \schemabox{Patre,\\ Filio,\\%|\\ %| Spiritui Sancto}|\\ @@ -1195,18 +1214,18 @@ %| }|\\ %| }|\\ %| \medskip|\columnbreak\\ -%| \Schema{-0.4ex}{6ex}|\\ +%| \Schema{-0.2ex}{6.4ex}|\\ %| {%|\\ %| \schemabox{\textsc{Voluntas},\\%|\\ %| revelatur in\\ actione, sive}|\\ %| }|\\ %| {%|\\ -%| \Schema{0ex}{3ex}|\\ +%| \Schema{0ex}{3.4ex}|\\ %| {%|\\ %| \schemabox{Universali}|\\ %| }|\\ %| {%|\\ -%| \Schema[close]{0ex}{3ex}|\\ +%| \Schema[close]{0ex}{3.4ex}|\\ %| {%|\\ %| \schemabox{Creationis,\\%|\\ %| Sustenationis,\\ Propagationis,}|\\ @@ -1229,7 +1248,7 @@ %|}|\\ % \end{multicols} % \egroup -% \noindent The balanced open/closed schemata take the form:\\[1ex] +% \noindent Balanced open/closed schemata take the general form:\\[1ex] % |\Schema{0ex}{2ex}|\\ % | {\hbox{$left_1$}}{\Schema[close]{0ex}{2ex}|\\ % | {\hbox{$left_2$}}{\hbox{$right_2$}}}|\\[1ex] @@ -1238,9 +1257,10 @@ % \Schema{0ex}{2ex} % {\hbox{$left_1$}}{\Schema[close]{0ex}{2ex} % {\hbox{$left_2$}}{\hbox{$right_2$}}} -% \end{displaymath} +% \end{displaymath}\medskip % % \noindent Try to produce the following. Hint: Everything to the right of the leftmost brace is the RHS of the outermost schema. Everything in that RHS to the left of the rightmost brace is the LHS of the first nested schema, and so on. +% \bgroup\DoBrackets% % \begin{displaymath} % \Schema{-0.2ex}{5.5ex} % {\schemabox{a}}% @@ -1265,11 +1285,13 @@ % {\schemabox{p}}% % } % \end{displaymath} +% \egroup % \clearpage -% This final example illustrates how one can set the width of a |\schemabox|, and for what sort of use that might be, e.g., in order to line up the braces.\\[1ex] +% This final example illustrates how one can set the width of a |\schemabox|, and for what sort of use that might be, e.g., in order to line up the braces. Invoking |\DoBrackets| after the start of the group containing the right-hand side of the first |\Schema| causes all schemas contained therein to use brackets. This remains consistent with scoping rules.\\[2ex] %\Schema{-0.2ex}{14.4ex} %{\schemabox{\bfseries Curriculum}} %{% +% \DoBrackets% % \schema % {\schemabox[3cm]{\bfseries I. General\\Studies}} % {\schemabox{1. Collected Works\\2. Encyclopedias}} @@ -1298,6 +1320,7 @@ %\noindent|\Schema{-0.2ex}{14.4ex}|\\ %|{\schemabox{\bfseries Curriculum}}|\\ %|{%|\\ +%| \DoBrackets%|\\ %| \schema|\\ %| {\schemabox[3cm]{\bfseries%|\\ %| I. General\\Studies}}|\\ @@ -1337,23 +1360,86 @@ % \fi % \section{Implementation} % -% The concept of using math mode to generate schemata was first implemented in plain \TeX, then migrated to \LaTeX. +% The concept of using math mode to generate schemata was first implemented by me in plain \TeX, then migrated to \LaTeX. % % \subsection{Package Options and Required Packages} % -%The package currently has no options and no dependencies to run. +% \changes{v0.6}{2013/03/10}{Added brackets and parens as well as braces} +% Three options are implemented, namely, |braces| (the default), |brackets|, and |parens|. Plain \TeX{} does not use options as such, but simply declares braces as the default and allows the user to change that after the file is |\input|.\\ +% \begin{macrocode} +\expandafter\ifx\csname newenvironment\endcsname\relax% +\def\DoBraces{\let\schemaLD\lbrace \let\schemaRD\rbrace}\DoBraces% +\DoBraces% +\else +\DeclareOption{braces}{\let\schemaLD\lbrace \let\schemaRD\rbrace} +\DeclareOption{brackets}{\let\schemaLD\lbrack \let\schemaRD\rbrack} +\DeclareOption{parens}{\let\schemaLD( \let\schemaRD)} +\ExecuteOptions{braces} +\ProcessOptions\relax +\fi +% \end{macrocode} % % \begin{macrocode} \newbox\rhs% \newbox\lhs% \newdimen\rheight% \newdimen\lheight% +% \end{macrocode}\medskip +%Two box registers and two dimen registers are used to analyze the left-hand and right-hand vertical sizes of the boxes in a schema. Automation of alignment presently is a distant horizon. +% +% \changes{v0.6}{2013/03/10}{Added tweaks for lowercase material in a \cmd{\schema}.} +% \begin{macrocode} +\newif\ifschemaLC% +\newif\ifschemaSwitch% % \end{macrocode} -%Two box registers and two dimen registers are allocated, one for determining the left-hand vertical size of the schema and one for determining the right-hand size. The reason to use two instead of one each is to facilitate possible future automation of the alignment of schemata. % % \subsection {Macros} % +% \begin{macro}{\DoBraces} +% \changes{v0.6}{2013/03/10}{Added macro} +% \begin{macrocode} +\def\DoBraces{\let\schemaLD\lbrace \let\schemaRD\rbrace}\DoBraces% +% \end{macrocode} +% \end{macro} +% Set the default option. +% \begin{macro}{\DoBrackets} +% \changes{v0.6}{2013/03/10}{Added macro} +% \begin{macrocode} +\def\DoBrackets{\let\schemaLD\lbrack \let\schemaRD\rbrack}% +% \end{macrocode} +% \end{macro} +% Set the ``branches'' to be brackets. +% \begin{macro}{\DoParens} +% \changes{v0.6}{2013/03/10}{Added macro} +% \begin{macrocode} +\def\DoParens{\let\schemaLD( \let\schemaRD)}% +% \end{macrocode} +% \end{macro} +% Set the ``branches'' to be parentheses. +% \begin{macro}{\LCschema} +% \changes{v0.6}{2013/03/10}{Added macro} +% \begin{macrocode} +\def\LCschema{\schemaLCtrue}% +% \end{macrocode} +% \end{macro} +% Set global settings to assume lowercase initial text in schemaboxes. +% \begin{macro}{\UCschema} +% \changes{v0.6}{2013/03/10}{Added macro} +% \begin{macrocode} +\def\UCschema{\schemaLCfalse}% +% \end{macrocode} +% \end{macro} +% Set global settings to assume uppercase initial text in schemaboxes. +% \begin{macro}{\SwitchSB} +% \changes{v0.6}{2013/03/10}{Added macro} +% \begin{macrocode} +\def\SwitchSB{\schemaSwitchtrue}% +% \end{macrocode} +% \end{macro} +% Flip the settings for one |\schemabox|, which will reset this value. +% % \begin{macro}{\schemabox} +% \changes{v0.6}{2013/03/10}{Added lowercase tweaks} % \begin{macrocode} \expandafter\ifx\csname newenvironment\endcsname\relax% {\catcode`@=11 @@ -1362,28 +1448,42 @@ \else \let\next\@schemab@x \fi \next} \gdef\@schemab@x#1{\@schemabox[0pt]{#1}} \gdef\@schemabox[#1]#2{% + \ifschemaLC\def\Adj{}% + \ifschemaSwitch\def\Adj{\strut}\fi + \else + \def\Adj{\strut}% + \ifschemaSwitch\def\Adj{}\fi + \fi + \schemaSwitchfalse% \ifdim#1<1pt \def\\{\egroup\hbox\bgroup\ignorespaces }% - \vbox{\hbox\bgroup\strut\ignorespaces #2\egroup}% + \vbox{\hbox\bgroup\Adj\ignorespaces #2\egroup}% \else \def\\{\hfil\egroup\hbox to #1\bgroup\ignorespaces }% - \vbox{\hbox to #1\bgroup\strut\ignorespaces #2\hfil\egroup}% + \vbox{\hbox to #1\bgroup\Adj\ignorespaces #2\hfil\egroup}% \fi }}\else \newcommand{\schemabox}[2][0pt]{% + \ifschemaLC\def\Adj{}% + \ifschemaSwitch\def\Adj{\strut}\fi + \else + \def\Adj{\strut}% + \ifschemaSwitch\def\Adj{}\fi + \fi + \schemaSwitchfalse% \ifdim#1<1pt \def\\{\egroup\hbox\bgroup\ignorespaces }% - \vbox{\hbox\bgroup\strut\ignorespaces #2\egroup}% + \vbox{\hbox\bgroup\Adj\ignorespaces #2\egroup}% \else \def\\{\hfil\egroup\hbox to #1\bgroup\ignorespaces }% - \vbox{\hbox to #1\bgroup\strut\ignorespaces #2\hfil\egroup}% + \vbox{\hbox to #1\bgroup\Adj\ignorespaces #2\hfil\egroup}% \fi }\fi % \end{macrocode} % \end{macro} -% Print a "box" that is a stack of left-aligned hboxes (with optional width) -% wrapped in a vbox. This allows the box to be only as wide as needed when -% a part of a schema. The syntax is reminiscent of a one-column tabular. +% Wrap a stack of left-aligned hboxes with optional width in a vbox. +% This allows the box to be only as wide as needed. The syntax is reminiscent +% of a one-column tabular. Normally insert a |\strut| in the first |\hbox|. % % \begin{macro}{\schema} % \begin{macrocode} @@ -1427,8 +1527,12 @@ }\fi % \end{macrocode} % \end{macro} -% This is the ``simple'' version of a schema. It vertically centers one box of internal vertical material on the left-hand side with one box of internal vertical material on the right-hand side. It puts a ``simple'' brace between the boxes based on the height of the box and the option passed to the schema. By default, a schema has a box to the left, an open brace, and a box to the right. If any optional argument other than "open" is used, the schema prints a box to the left, a close brace, and a box to the right. -% \clearpage +% This ``simple'' schema vertically centers two boxes of internal vertical material and +% puts a ``simple'' brace between the boxes based on the height of the box and the options +% passed to the schema. By default, a schema has a box to the left, an open delimiter, +% and a box to the right. If any optional argument other than "open" is used, the schema +% prints a box to the left, a close brace, and a box to the right. +% % \begin{macro}{\Schema} % \begin{macrocode} \expandafter\ifx\csname newenvironment\endcsname\relax% @@ -1466,24 +1570,23 @@ % \begin{macrocode} \expandafter\ifx\csname newenvironment\endcsname\relax% \def\basiclbrace#1{% - \ifmmode\left.\vcenter{\vbox to #1{\vfil}}\right\lbrace\fi} + \ifmmode\left.\vcenter{\vbox to #1{\vfil}}\right\schemaLD\fi} \else \newcommand{\basiclbrace}[1]{% - \ifmmode\left.\vcenter{\vbox to #1{\vfil}}\right\lbrace\fi} + \ifmmode\left.\vcenter{\vbox to #1{\vfil}}\right\schemaLD\fi} \fi % \end{macrocode} % \end{macro} % Draw an on-center brace to the left of a simple box. -% \clearpage % % \begin{macro}{\basicrbrace} % \begin{macrocode} \expandafter\ifx\csname newenvironment\endcsname\relax% \def\basicrbrace#1{% - \ifmmode\left\rbrace\vcenter{\vbox to #1{\vfil}}\right.\fi} + \ifmmode\left\schemaRD\vcenter{\vbox to #1{\vfil}}\right.\fi} \else \newcommand{\basicrbrace}[1]{% - \ifmmode\left\rbrace\vcenter{\vbox to #1{\vfil}}\right.\fi} + \ifmmode\left\schemaRD\vcenter{\vbox to #1{\vfil}}\right.\fi} \fi % \end{macrocode} % \end{macro} @@ -1496,22 +1599,22 @@ \dimen0=#1% \dimen2=#2% \ifdim\dimen0<0pt - \ifmmode\vcenter{\hbox{$\left.\vbox to 1.44265\dimen2{\vfil}\right\lbrace% + \ifmmode\vcenter{\hbox{$\left.\vbox to 1.44265\dimen2{\vfil}\right\schemaLD% \atop\vbox to -1.44265\dimen0{\vfil}$}}\fi \else \ifmmode\vcenter{\hbox{$\vbox to 1.44265\dimen0{\vfil}% - \atop\left.\vbox to 1.44265\dimen2{\vfil}\right\lbrace$}}\fi + \atop\left.\vbox to 1.44265\dimen2{\vfil}\right\schemaLD$}}\fi \fi }\else \newcommand{\complexlbrace}[2]{% \dimen0=#1% \dimen2=#2% \ifdim\dimen0<0pt - \ifmmode\vcenter{\hbox{$\left.\vbox to 1.44265\dimen2{\vfil}\right\lbrace% + \ifmmode\vcenter{\hbox{$\left.\vbox to 1.44265\dimen2{\vfil}\right\schemaLD% \atop\vbox to -1.44265\dimen0{\vfil}$}}\fi \else \ifmmode\vcenter{\hbox{$\vbox to 1.44265\dimen0{\vfil}% - \atop\left.\vbox to 1.44265\dimen2{\vfil}\right\lbrace$}}\fi + \atop\left.\vbox to 1.44265\dimen2{\vfil}\right\schemaLD$}}\fi \fi }\fi % \end{macrocode} @@ -1525,22 +1628,22 @@ \dimen0=#1% \dimen2=#2% \ifdim\dimen0<0pt - \ifmmode\vcenter{\hbox{$\left.\vbox to 1.44265\dimen2{\vfil}\right\rbrace% + \ifmmode\vcenter{\hbox{$\left.\vbox to 1.44265\dimen2{\vfil}\right\schemaRD% \atop\vbox to -1.44265\dimen0{\vfil}$}}\fi \else \ifmmode\vcenter{\hbox{$\vbox to 1.44265\dimen0{\vfil}% - \atop\left.\vbox to 1.44265\dimen2{\vfil}\right\rbrace$}}\fi + \atop\left.\vbox to 1.44265\dimen2{\vfil}\right\schemaRD$}}\fi \fi }\else \newcommand{\complexrbrace}[2]{% \dimen0=#1% \dimen2=#2% \ifdim\dimen0<0pt - \ifmmode\vcenter{\hbox{$\left.\vbox to 1.44265\dimen2{\vfil}\right\rbrace% + \ifmmode\vcenter{\hbox{$\left.\vbox to 1.44265\dimen2{\vfil}\right\schemaRD% \atop\vbox to -1.44265\dimen0{\vfil}$}}\fi \else \ifmmode\vcenter{\hbox{$\vbox to 1.44265\dimen0{\vfil}% - \atop\left.\vbox to 1.44265\dimen2{\vfil}\right\rbrace$}}\fi + \atop\left.\vbox to 1.44265\dimen2{\vfil}\right\schemaRD$}}\fi \fi }\fi % \end{macrocode} |