Debian Codegraph @

texmf-dist/source/generic/youngtab/youngtab.dtx

raw
1 % \iffalse
2 %% File: youngtab.dtx
3 %% Copyright (C) 1996,98,99 Volker B"orchers and Stefan Gieseke,
4 %% This program can be redistributed and/or modified under the terms
5 %% of the LaTeX Project Public License Distributed from CTAN
6 %% archives in directory macros/latex/base/lppl.txt; either
7 %% version 1 of the License, or any later version.
8 %
9 %<package>\NeedsTeXFormat{LaTeX2e}
10 %<package>\ProvidesPackage{youngtab}
11 %<package>[1999/05/19 v1.1; Macros for Young-Tableaux]
12 %
13 %<*driver>
14 \documentclass{ltxdoc}
15 \usepackage[enableskew]{youngtab}
16 \GetFileInfo{youngtab.sty}
17 \begin{document}
18 \title{The \textsf{youngtab} package\thanks{This file has version number
19 \fileversion, dated \filedate.}}
20 \author{Volker B\"orchers\thanks{email: [email protected]}
21 \\Stefan Gieseke\\
22 Universit\"at Bremen}
23 \date{\filedate}
24 \maketitle
25 \DocInput{youngtab.dtx}
26 \end{document}
27 %</driver>
28 % \fi
29 %\iffalse
30 %
31 %% Package `youngtab' to use with TeX, LaTeX209 or LaTeX2e
32 %% (You will need LaTeX2e to extract the documentation and a STY-file
33 %% without comments from the .dtx file)
34 %
35 % Version: Date: Changes:
36 %
37 % 1.0 1996/03/25 First working version. (After much
38 % frustrating tries to teach TeX accept
39 % indefinite count of arguments - lerning TeX
40 % in the meanwhile)
41 % 1.1 1998/05/05 Added possibility to typeset ``skew''
42 % tableaux (package option `enableskew')
43 % suggested by Andrew Mathas
44 % <[email protected]>. Added AUC-TeX
45 % support for the youngtab macros (youngtab.el).
46 % 1999/05/19 Only change: added licence informations
47 %\fi
48 %
49 %
50 % \DoNotIndex{\advance,\box,\CurrentOption,\DeclareOption,\def}
51 % \DoNotIndex{\else,\fi,\hbox,\hfil,\hrule,\hspace,\ht,\ifcat}
52 % \DoNotIndex{\ifmmode,\ifnum,\ifvoid,\loop,\MessageBreak,\newcount}
53 % \DoNotIndex{\newdimen,\newif,\newskip,\offinterlineskip}
54 % \DoNotIndex{\PackageWarning,\ProcessOptions,\relax,\repeat,\setbox}
55 % \DoNotIndex{\space,\typeout,\unskip,\vbox,\vcenter,\vrule,\vspace}
56 %
57 % \CheckSum{322}
58 %
59 % \newcommand{\yt}{Young-Tableau}
60 % \newcommand{\yts}{Young-Tableaux}
61 % \newcommand{\newfeature}[1]{\leavevmode%
62 % \marginpar{\small\sffamily\begin{center}
63 % New feature\\#1\end{center}}}
64 %
65 % \begin{abstract}
66 % This package provides two macros for typesetting
67 % \yts\ with \TeX\ or \LaTeX. We use 2 macros, the first for empty
68 % boxes (|\yng|), and the second for labelled boxes (|\young|). The
69 % syntax of the macros is simple to avoid spelling-mistakes.
70 % \end{abstract}
71 %
72 % \tableofcontents
73 %
74 % \section{Introduction}
75 % The \yt-formalism is a strong algrebraic tool in group theory. Of course
76 % we will deal here only with the problems of \emph{typesetting} \yts.
77 % They are mathematical objects, so they usually occur in mathematical
78 % environments. On the surface \yts\ consist of boxes like this:
79 % \yng(1) --- or optionally labelled (usually with letters): \young(a).
80 %
81 % There is already one \LaTeX-package for typesetting \yts, the
82 % \texttt{young.sty} by J\"org Knappen (based on |young.tex| by P. E. S.
83 % Wormer). It provides a \texttt{Young}-environment with a syntax
84 % similar to the \texttt{tabular}-environment.
85 %
86 % An Example for the usage of \texttt{Young}:
87 %
88 % \begin{minipage}[t]{5cm}
89 % \begin{verbatim}
90 % \begin{Young}
91 % $a$&&\cr
92 % &\cr
93 % \cr
94 % \end{Young}
95 % \end{verbatim}
96 % \end{minipage}
97 % \parbox[t]{4cm}{ \young(a\hfil\hfil,\hfil\hfil,\hfil) }
98 %
99 % \iffalse
100 % COMMENT: Maybe that's not the correct way to pretend the use of the
101 % |Young|-environment, but otherwise we had to use |young.sty| only
102 % for this tableau!
103 % \fi
104 %
105 % This way of implementing \yts\ has one big advantage: It can deal with
106 % an indefinite number of rows and columns (of course this is needed!).
107 % A second argument for using a \texttt{tabular}-like environment might
108 % be it's simple encoding.
109 %
110 % Nevertheless we wanted a simpler user-interface, for the use of |&| and
111 % |\cr| is usually a very good source of typing mistakes (e.g. you
112 % have to type \emph{three} |&|'s to get \emph{four} boxes in one
113 % row). In addition the \TeX-code for mathematical relations with more
114 % than two or three \yts\ becomes unreadable.
115 %
116 % The cure would be of course a \emph{macro} with a compact, intuitive
117 % syntax. But there is the above mentioned problem: \TeX\ is not made to
118 % handle an indefinite number of arguments. For \yts\ composed of empty
119 % boxes we would like to have a macro with one argument for each row
120 % (counting the number of boxes per row) for example this way:
121 % |\thisdoesnotwork{5}{3}{1}|\dots. For \yts\ composed of labelled
122 % boxes the problem is even worse since we have one letter
123 % \emph{per box}!
124 %
125 % So we had to hide the fact of having an indefinite number of arguments
126 % from \TeX. The macros in this package have --- as \TeX\ sees it ---
127 % only one argument; this is parsed for the necessary information
128 % by the macros themselves. Whereas, for the user, the number of rows and
129 % number of boxes per row are plain to see.
130 %
131 % \section{Using the youngtab package}
132 % Invoke the |youngtab| package by
133 % requesting it in the preamble:\footnote{Of course this does not work
134 % if you use the |youngtab|-package with \TeX\ instead of \LaTeX. For
135 % compatibility-questions see section \ref{compat}}
136 %
137 % |\usepackage[...]{youngtab}|
138 %
139 % The package has four options (increasing)\DescribeMacro{Options}.
140 % The \emph{first option}, |vcentermath|\DescribeMacro{vcentermath},
141 % \emph{turns on} the vertical centering of the tableaux in math mode. The
142 % \emph{second option}, |noautoscale|\DescribeMacro{noautoscale}, \emph{turns
143 % off} the automatic scaling of the boxes according to the actual font.
144 % The \emph{third one}, |stdtext|\DescribeMacro{stdtext}, switches
145 % to text mode in the inside of labelled boxes. Choosing one of this
146 % options does not mean that you have, for example, to stick to
147 % |noautoscale| till the end of your days. You may change this
148 % settings as often as you like.\\
149 % The \emph{fourth option},
150 % |enableskew|\DescribeMacro{enableskew}\newfeature{1998/05/05}
151 % enables typesetting of skew \yts\ (tableaux that are not
152 % left-aligned). This option is different from the other in the way
153 % that there is no command to enable this feature after the package is
154 % loaded.
155 %
156 % \yts\ usually have more than one row, so the vertical alignment is a
157 % problem\DescribeMacro{vcentermath}. You can turn on vertical centering
158 % (only) in mathmode either by choosing the option |vcentermath| with
159 % |\usepackage| or later with the command
160 % |\Yvcentermath|\meta{num}. Say |\Yvcentermath1| if you want
161 % vertical centering and |\Yvcentermath0| to switch it off. Without
162 % vcentering the tableaux are standing on the baseline.
163 %
164 % Since the boxes are quadratic (if you do not want want this,
165 % complain!), there is only one dimension to determine: the length and
166 % height of the boxes. Usually the macros determine this for
167 % themselves,\footnote{So that a \yt\ e.g.\ \texttt{\bslash young(ab)}
168 % \young(ab) appears smaller in a footnote than in normal text!} but
169 % you can change this behavior by calling the macro
170 % |\Yautoscale|\meta{num}\DescribeMacro{\Yautoscale}. Call it with
171 % an argument of |1| if you want autoscaling after this, or with
172 % the argument |0| if you want to adjust the box dimensions
173 % yourself.
174 %
175 % \DescribeMacro{\Yboxdim}If you switch off autoscaling and
176 % want to change the box dimensions, you have to call the macro
177 % |\Yboxdim|\meta{dim} with a usual \TeX--dimension.
178 % The argument has to be appended to the macro: |\Yboxdim13pt|. This
179 % dimension is the \emph{total} height and width of the boxes --
180 % \emph{including the lines.} (For small linethicknesses this
181 % makes of course only a small difference.) Note that the use of |\Yboxdim|
182 % \emph{implies} |noautoscale|! So to switch from |autoscale| to
183 % |noautoscale| one call to |\Yboxdim| is sufficient.
184 %
185 % There is only one more parameter which determines the appearance of
186 % the \yt\DescribeMacro{\Ylinethick}: the lines' thickness. This is
187 % set by |\Ylinethick|\meta{dim}. (The default is $0.3pt$).
188 %
189 % You may add space between a tableau and surrounding stuff by
190 % invoking the macro
191 % |\Yinterspace|\meta{skip}\DescribeMacro{\Yinterspace}. The advantage
192 % of using a \emph{skip} is that this helps \TeX\ to avoid |Over|-
193 % or |Underful \hbox|es. The default value is |0ex plus 0.3ex|\,.
194 % (Better take |ex| or |em| for the tableaux are scaleable.)
195 %
196 % \subsection{Empty boxes: \texttt{\protect\bslash yng}}
197 % \DescribeMacro\yng
198 % The most used variant of \yts\ are those consisting of empty boxes.
199 % For the tableau \yng(2,1) you have to type
200 % |\yng(2,1)|. If you want it to appear smaller, change the
201 % fontsize: |{\tiny\yng(2,1)}| gives \Yautoscale1
202 % {\tiny\yng(2,1)}; but remember, this only works if |autoscale|
203 % is turned on (default). (If you are in |noautoscale|-mode, restore
204 % autoscaling with |\Yautoscale1|.)
205 %
206 % Some notes on the usage of |\yng| and |\young| in math or
207 % text mode\DescribeMacro{math or text?}: You can generate \yts\ in both
208 % modes, but differences arise from \emph{vertical centering}.
209 % This only works in math mode (if you have chosen it with
210 % |\Yvcentermath1|) or |usepackage| option |vcentermath|.
211 %
212 % The difference is to be seen here:
213 % {\tiny\Yvcentermath1 $\yng(1,1)\oplus\yng(1)=$
214 % \yng(2,1)}$\oplus$ \dots, which has been generated by
215 % \begin{verbatim}
216 % {\tiny\Yvcentermath1 $\yng(1,1)\oplus\yng(1)=$
217 % \yng(2,1)}$\oplus$ \dots
218 % \end{verbatim}
219 %
220 % Here the tableau in math are centered with respect to the axis of
221 % the formula while the one in text mode isn't. Note the
222 % dimensions of the tableau on the one hand and the |\oplus| on the
223 % other: The dimensions of the \yts\ are determined by the actual
224 % text's fontsize (while autoscaling!)\DescribeMacro{sizing}. Try to
225 % understand what happens in the following example. --- Do you
226 % understand the sizes of the math symbols? (Compare to the example
227 % above and have look up the \texttt{.log} file. Don't let \TeX\ fool
228 % you by messages about invalid |\normalsize|!)
229 % \begin{verbatim}
230 % {\tiny\begin{equation}
231 % \Yvcentermath1
232 % \yng(1,1)\oplus\yng(1)= \Yboxdim{12pt}
233 % \yng(2,1)\normalsize\oplus\dots
234 % \end{equation}}
235 % \end{verbatim}
236 % {\tiny\begin{equation}
237 % \Yvcentermath1 \yng(1,1)\oplus\yng(1)=
238 % \Yboxdim{12pt}\yng(2,1)\normalsize\oplus\dots
239 % \end{equation}}
240 % \Yautoscale1
241 %
242 % \subsection{Labelled boxes: \texttt{\protect\bslash young}}
243 % \DescribeMacro\young
244 % While the sizing of the boxes and the behavior in math/text mode are
245 % exactly the same as with |\yng|, we have of course a different syntax:\\
246 % |{\scriptsize\young(aa,b)}| results in
247 % {\scriptsize\young(aa,b)}. Each line of the tableau is represented
248 % by a row of single letters (exactly: ``tokens''). The lines
249 % are separated by commas.
250 %
251 % As you see from the example above the letters |a| and |b| come out in
252 % math italics. This does \emph{not} depend on the \yt\ appearing in
253 % math or text surround. \emph{The label within a tableau-box is math -- no
254 % matter if the tableau is used in text or math mode!} But this is
255 % only the default setting. Use either the option |stdtext| to the
256 % |\usepackage| command to switch to roman letters or use the macro
257 % |\Ystdtext| with an argument of |1|: |\Ystdtext1|. To switch to math
258 % again use |\Ystdtext0|.
259 %
260 % What to do if you don't want to use single letters, but symbols or
261 % perhaps some white boxes? There are no limits but it's a bit
262 % complicated. The |\young| algorithm for parsing his argument depends
263 % strongly on that every label of \emph{one} box,
264 % \begin{enumerate}
265 % \item consists of only \emph{one token}. Assume first you had
266 % \emph{not} said |\Ystdtext1|. To get a single roman `a' then you
267 % must not say |\mbox{a}|, because this makes \emph{four} tokens (1st
268 % is |\mbox|, 2nd is |{|, 3rd is |a|, 4th is |}|). The cure is
269 % simply making one token out of |\mbox{a}| by saying
270 % |\newcommand{\rma}{\mbox{a}}| and everything is OK:\footnote{Note
271 % that the space after \texttt{\bslash rma} belongs to the token itself.}
272 % \newcommand{\rma}{\mbox{a}} |\young(\rma lright\bullet)| = \young(\rma
273 % lright\bullet)\\
274 % After |\Ystdtext1| it is an error to say |$\bullet$|, since the
275 % two math delimiters are single tokens. Do it as described above:
276 % \Ystdtext1\\ |\newcommand{\ybullet}{$\bullet$}|\\ and
277 % everything is OK: \newcommand{\ybullet}{$\bullet$}
278 % |\young(\ybullet works)| = \young(\ybullet works)\,.\Ystdtext0\\
279 % To use a symbol or special letter in both modes (|\Ystdtext 0 or 1|)
280 % put it in a box (here with an extra tuning):\\
281 % |\renewcommand{\ybullet}{\raise1.5pt \hbox{$\bullet$}}|
282 % \item Some characters and macros are not allowed: commas (guess why)
283 % and the other punctuation marks, spaces, the macro |\space| and also
284 % skips like |\,| and |\:|.\footnote{Write to us if you find more.} If
285 % you want to have single empty boxes use (\TeX\ primitive) |\hfil|
286 % (For understanding this limitations see also |\y@lastargtest| and
287 % |\y@nelettertest| in macro section).
288 % \end{enumerate}
289 %
290 %
291 % \subsubsection{Skew \yts\ with \texttt{\protect\bslash young}}
292 % \newfeature{1998/05/05}
293 % As far as described above, the rows of a \yt\ are left-aligned. Since
294 % some authors also assigned a meaning to \emph{``skew''} tableaux, this
295 % package also supports such along with |\young|. If you want to typeset
296 % skew tableaux, you have to enable this via the package option
297 % |enableskew|\DescribeMacro{enableskew}. The default behavior of this
298 % package is to \emph{dis\/}able skew boxes in order to save \TeX's
299 % time, however, it's save to include this option even if you do not use
300 % it.
301 %
302 % Here is an example:
303 % |\young(abcd,:bc,::c)|: \raisebox{-1.9\baselineskip}{\young(abcd,:bc,::c)}
304 %
305 % As you see, the Option |enableskew| makes the colon a special
306 % character (only inside the argument of |\young|). \footnote{If you
307 % want a colon to appear as it is (do you??), you have to do the same
308 % trick as above with an unpleasant extra: define a macro for the
309 % colon using the \TeX-primitive \texttt{\bslash char} like this:
310 % \texttt{\bslash newcommand{\bslash mycolon}{\bslash char58}}.} In
311 % fact all other than the leading colons in a row will simply be
312 % ignored, while the first will move the row to the right.
313 %
314 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315 % \Yboxdim.4ex
316 % \raisebox{-1pt}{\young(:\hfil,\hfil,\hfil,\hfil,\hfil,:\hfil)}
317 % This is a\,
318 % \young(\hfil,\hfil,\hfil,\hfil,\hfil\hfil\hfil)
319 % \young(\hfil,\hfil,\hfil,\hfil,\hfil)
320 % \young(\hfil\hfil\hfil,:\hfil,:\hfil,:\hfil,:\hfil)
321 % \young(\hfil\hfil\hfil,:\hfil,:\hfil,:\hfil,:\hfil)
322 % \young(\hfil,\hfil,\hfil,\hfil,\hfil\hfil\hfil)
323 % \young(\hfil\hfil\hfil,\hfil,\hfil\hfil,\hfil,\hfil\hfil\hfil)
324 % \hspace{.7ex}
325 % \young(\hfil\hfil\hfil,:\hfil,:\hfil,:\hfil,:\hfil)
326 % \young(\hfil\hfil\hfil,\hfil,\hfil\hfil,\hfil,\hfil\hfil\hfil)
327 % \young(:\hfil\hfil\hfil,\hfil,:\hfil\hfil,:::\hfil,\hfil\hfil\hfil)
328 % \young(\hfil\hfil\hfil,:\hfil,:\hfil,:\hfil,:\hfil)
329 % of skew tableaux.
330 % \raisebox{-1pt}{\young(\hfil,:\hfil,:\hfil,:\hfil,:\hfil,\hfil)}
331 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332 % \Yautoscale1
333 %
334 %
335 % \subsection{The \texttt{youngtab} package and \TeX}\label{compat}
336 % \DescribeMacro{Compatibility}Because we do not use \PlainTeX, the
337 % compatibility of this package and \TeX\ is not sufficiently tested.
338 % However there are some changes necessary in |youngtab.sty| (see file
339 % \texttt{youngtab.tex}, part of the distribution):
340 % \begin{itemize}
341 % \item The macros themselves only use two \LaTeX-commands,
342 % |\vspace{|\meta{dim}|}| and |\hspace{|\meta{dim}|}|. One has to
343 % replace them with `|\vskip |\meta{dim}' resp.\ `|\hskip|
344 % \meta{dim}'\,. (The braces also have to get removed) The
345 % \LaTeX-counterparts may be better but no problems should arise
346 % from this replacement (we found none).
347 % \item One has to remove all lines containing \LaTeXe-commands in the
348 % preamble of the |.sty| file, e.g.\ comment out every line that
349 % contains the following commands: |\DeclareOption|,
350 % |\ProcessOptions|, |\NeedsTeXFormat| and |\ProvidesPackage|.
351 % \item Since \TeX-input files must not contain a |@|,
352 % |\catcode`\@11\relax| has to be added to the begin of the |.sty| file to
353 % make |@| a |letter| and |\catcode`\@12\relax| at the end right
354 % before the |\endinput|, to make it |other| again afterwards.
355 % \item \textbf{Skew:}\hspace{1em} \TeX\ knows nothing about
356 % style-options, we have to find a way to enable skew
357 % \yts. (|enableskew| is the only package option that can \emph{not}
358 % be accessed by a macro \emph{after loading} the package since
359 % almost all according actions will be done at loading time).\\
360 % Therefore, we will check if a macro |\enableskew| is defined at loading
361 % time:\\[.3ex]
362 % | \expandafter\ifx\csname enableskew\endcsname\relax|\\
363 % | \y@enable@skewfalse \else \y@enable@skewtrue\fi|\\[.3ex]
364 % (excerpt from |youngtab.tex|) Then this will enable printing of
365 % skew tableaux: \hfil|\def\enableskew{1} \input youngtab|
366 % \item The autoscaling doesn't work as nice as with \LaTeX\ since if
367 % you lower the text's fontsize (which determines the boxsize), you
368 % have to lower also the math fontsize. Otherwise the letters in
369 % labelled boxes (math!) are too big for the box.
370 % \end{itemize}
371 %
372 % \subsection{To do}
373 % We have a \textbf{wish list}, things we think the package should be
374 % capable of:
375 % \begin{itemize}
376 % \item A vertical alignment, in the way that the \emph{top}line of the
377 % \yts\ and the mathsymbols are on the same height (perhaps using
378 % |\vtop|?).
379 % \item The macros should take notice of math fontsize changes e.g.\ with
380 % \texttt{\bslash dis\-play\-style}. (This puts a focus on the autoscale
381 % mechanism -- see |\y@setdim| in the macro section.)
382 % \end{itemize}
383 % \textbf{If You} have any problems, suggestions, critical remarks -- or
384 % whatever according this package write to Volker B\"orchers
385 % (email-adress see title).\\
386 % {\tiny\yng(61)}
387 %
388 % \StopEventually{}
389 %
390 % \section{The Macros}
391 %
392 % \begin{macrocode}
393 %<*package>
394 % \end{macrocode}
395 %
396 % \begin{macro}{\Yautoscale}
397 % \begin{macro}{\ify@autoscale}
398 % If autoscaling is active, the size of the boxes (|\y@boxdim|) is
399 % determined by the package itselve. The default setting is to
400 % allow autoscale. |\Yautoscale|\meta{num} serves as the user
401 % interface.\footnote{I know - it's against the \LaTeXe naming
402 % conventions, but it is nicer\dots} We made an option to |\usepackage|
403 % out of that (see below).
404 % \begin{macrocode}
405 \newif\ify@autoscale \y@autoscaletrue \def\Yautoscale#1{\ifnum #1=0
406 \y@autoscalefalse\else\y@autoscaletrue\fi}
407 % \end{macrocode}
408 % \end{macro}
409 % \end{macro}
410 % \begin{macro}{\Yboxdim}
411 % \begin{macro}{\y@b@xdim}
412 % \begin{macro}{\y@boxdim}
413 % The parameters determining the size of the single boxes and the macro
414 % to set them. |\Yboxdim|\meta{dim} sets |\y@boxdim| (only used, when
415 % autoscaling is turned off) and sets |y@autoscale| to
416 % |false|. |\y@boxdim| is the \emph{total} size of the box (including
417 % the delimiting lines) while |\y@b@xdim| (to be set in |\y@setdim|) is
418 % the height and width of the inner of the box.
419 % \begin{macrocode}
420 \newdimen\y@b@xdim
421 \newdimen\y@boxdim \y@boxdim=13pt
422 \def\Yboxdim#1{\y@autoscalefalse\y@boxdim=#1}
423 % \end{macrocode}
424 % \end{macro}
425 % \end{macro}
426 % \end{macro}
427 %
428 % \begin{macro}{\Ylinethick}
429 % \begin{macro}{\y@linethick}
430 % The line thickness and |\Ylinethick|\meta{dim} as user interface to it.
431 % \begin{macrocode}
432 \newdimen\y@linethick \y@linethick=.3pt
433 \def\Ylinethick#1{\y@linethick=#1}
434 % \end{macrocode}
435 % \end{macro}
436 % \end{macro}
437 %
438 % \begin{macro}{\Yinterspace}
439 % \begin{macro}{\y@interspace}
440 % To give the \yts\ extra-space (before and after) |\y@interspace| can
441 % be set to more than |0pt| by calling |\Yinterspace|. (See |\yng| and
442 % |\young|.) Note that this is a \emph{skip} and no \emph{dimemsion}.
443 % \begin{macrocode}
444 \newskip\y@interspace \y@interspace=0ex plus 0.3ex
445 \def\Yinterspace#1{\y@interspace=#1}
446 % \end{macrocode}
447 % \end{macro}
448 % \end{macro}
449 %
450 % \begin{macro}{\Yvcentermath}
451 % \begin{macro}{\ify@vcenter}
452 % The switch to turn vertical centering in math on or off. The default
453 % is |\y@vcenterfalse|. The second option to |\usepackage|.
454 % \begin{macrocode}
455 \newif\ify@vcenter \y@vcenterfalse
456 \def\Yvcentermath#1{\ifnum #1=0 \y@vcenterfalse\else\y@vcentertrue\fi}
457 % \end{macrocode}
458 % \end{macro}
459 % \end{macro}
460 %
461 % \begin{macro}{\Ystdtext}
462 % \begin{macro}{\ify@stdtext}
463 % Normally the inside of the boxes (|\young|) is in math mode. This code
464 % allows to switch to text mode.
465 % \begin{macrocode}
466 \newif\ify@stdtext \y@stdtextfalse
467 \def\Ystdtext#1{\ifnum #1=0 \y@stdtextfalse\else\y@stdtexttrue\fi}
468 % \end{macrocode}
469 % \end{macro}
470 % \end{macro}
471 %
472 % \begin{macro}{\ify@enable@skew}
473 % In contrast to the other this \texttt{if} may be set only via the
474 % package option |enableskew|.
475 % \begin{macrocode}
476 \newif\ify@enable@skew \y@enable@skewfalse
477 % \end{macrocode}
478 % \end{macro}
479 % \begin{macro}{noautoscale}
480 % \begin{macro}{vcentermath}
481 % \begin{macro}{stdtext}
482 % \begin{macro}{enableskew}
483 % Declaration and processing of the options for use with
484 % \LaTeXe. (For \TeX-users: Comment the following 8 lines out).
485 % \begin{macrocode}
486 \DeclareOption{noautoscale}{\y@autoscalefalse}
487 \DeclareOption{vcentermath}{\y@vcentertrue}
488 \DeclareOption{stdtext}{\y@vcentertrue}
489 \DeclareOption{enableskew}{\y@enable@skewtrue}
490 \DeclareOption*{\PackageWarning{youngtab}{%
491 Unknown option `\CurrentOption' (Known:\MessageBreak
492 `vcentermath', `noautoscale', `stdtext', `enableskew'.)}}
493 \ProcessOptions\relax
494 % \end{macrocode}
495 % \end{macro}
496 % \end{macro}
497 % \end{macro}
498 % \end{macro}
499 %
500 % \begin{macro}{\y@vr}
501 % A single vertical line to build the boxes. The reason for the depht of
502 % the line should be clear. (The values for the depth maybe something
503 % you want to tune)
504 % \begin{macrocode}
505 \def\y@vr{\vrule height0.8\y@b@xdim width\y@linethick depth 0.2\y@b@xdim}
506 % \end{macrocode}
507 % \end{macro}
508 % \begin{macro}{\y@emptybox}
509 % This macro does less than its name pretend: It only makes one vertical
510 % line followed by a empty box (width: |\y@boxdim| -- 2|\y@linethick|).
511 % \begin{macrocode}
512 \def\y@emptybox{\y@vr\hbox to \y@b@xdim{\hfil}}
513 % \end{macrocode}
514 % \end{macro}
515 % \begin{macro}{\y@abcbox}
516 % \begin{macro}{\y@mathabcbox}
517 % If |enableskew| is not choosen (the package options have been
518 % parsed now), a |\y@abcbox| or a |\y@mathabcbox| is the simple
519 % analogue to |\y@emptybox| but it has a \emph{text-font} letter
520 % centered in it.\\
521 % For |\y@mathabcbox| the inside is math. We rather want an
522 % easier access to math italics and symbols than to normal text; so we
523 % usually use |\y@mathabcbox| instead of |\y@abcbox|.
524 %
525 % Skew \yts\ can only be used with |\young|. Then a colon is used to
526 % \emph{shift} the row to the \emph{right} -- instead of ``inserting
527 % a box without border'' -- so the colon boxes must be ignored.
528 % \begin{macrocode}
529 \ify@enable@skew
530 \def\y@abcbox#1{\if :#1\else
531 \y@vr\hbox to \y@b@xdim{\hfil#1\hfil}\fi}
532 \def\y@mathabcbox#1{\if :#1\else
533 \y@vr\hbox to \y@b@xdim{\hfil$#1$\hfil}\fi}
534 \else
535 \def\y@abcbox#1{\y@vr\hbox to \y@b@xdim{\hfil#1\hfil}}
536 \def\y@mathabcbox#1{\y@vr\hbox to \y@b@xdim{\hfil$#1$\hfil}}
537 \fi
538 % \end{macrocode}
539 % \end{macro}
540 % \end{macro}
541 %
542 % \begin{macro}{\y@setdim}
543 % This macro is called at the beginning of the macros |\yng| and
544 % |\young|. If |autoscale| is deactivated the box height and width is
545 % |\y@boxdim| - 2|\y@linethick|. If not we save a box for temporary
546 % usage, use the height of it to find a good size of the box, fill the
547 % boxregister with a empty box, and clear the box again by using it.
548 %
549 % That's not elegant but I didn't know better\dots How can I determine
550 % the height of the font in an other way? (I tried it with the \TeX-measure
551 % |ex| -- but this did not seem to work in any case.) Or -- if I have
552 % to use setbox -- which boxregister should I use? Is the |\ifvoid| test
553 % obsolete? (First I used |\box0| -- till I found me competing with
554 % \AmSTeX\ for this box.)
555 % \begin{macrocode}
556 \def\y@setdim{%
557 \ify@autoscale%
558 \ifvoid1\else\typeout{Package youngtab: box1 not free! Expect an
559 error!}\fi%
560 \setbox1=\hbox{A}\y@b@xdim=1.6\ht1 \setbox1=\hbox{}\box1%
561 \else\y@b@xdim=\y@boxdim \advance\y@b@xdim by -2\y@linethick
562 \fi}
563 % \end{macrocode}
564 % \end{macro}
565 %
566 % \begin{macro}{\y@counter}
567 % A counter for loops.
568 % \begin{macrocode}
569 \newcount\y@counter
570 % \end{macrocode}
571 % \end{macro}
572 %
573 %
574 % \begin{macro}{\y@lastargtest}
575 % This macro is a hack to get \TeX\ to accept a indefinite number of
576 % arguments (here: the number of \emph{lines} separated by commas). It
577 % does nothing with its arguments but to see if the second is a space,
578 % and, if it is to set |\y@islastargtrue|.\footnote{The
579 % \texttt{islastarg} conditions are also used if the end of one line
580 % of labelled boxes is reached.}
581 % \begin{macrocode}
582 \newif\ify@islastarg
583 \def\y@lastargtest#1,#2 {\if\space #2 \y@islastargtrue
584 \else\y@islastargfalse\fi}
585 % \end{macrocode}
586 % How does it work? An Example:
587 %
588 % \verb*+\y@lastargtest first,second +\\
589 % Here |#1| is |first| and |#2| is |second|. The |\if| construction
590 % tests if the (expanded) \emph{first} token of |#2| and |\space|
591 % (here: |s|) are equal. -- They are not. In the next example the
592 % condition is |true|:
593 %
594 % \verb*+\y@lastargtest first, +\\
595 % Here |#1| is again |first| but |\y@lastargtest| catches the blank
596 % after the comma to be |#2|. The |\if| condition now is true and
597 % |\y@islastargtrue| is set. Remember: the blank is essential!
598 % \end{macro}
599 %
600 % \begin{macro}{\y@emptyboxes}
601 % This macro draws |#1| (this is a number) empty boxes (|\y@emptybox|)
602 % -- without a top or bottom line:
603 %
604 % |:\y@emptyboxes3:| \hspace{0.5em} is
605 % :$\mid$\hspace{0.8em}$\mid$\hspace{0.8em}$\mid$\hspace{0.8em}:
606 % \begin{macrocode}
607 \def\y@emptyboxes#1{\y@counter=#1\loop\ifnum\y@counter>0
608 \advance\y@counter by -1 \y@emptybox\repeat}
609 % \end{macrocode}
610 % \end{macro}
611 %
612 % \begin{macro}{\y@nelineemptyboxes}
613 % This calls |\y@emptyboxes| and adds the top and bottom lines (I think
614 % this is faster than draw single, complete boxes) and a right closing
615 % vertical line. Because of the |\vspace| command the top line of the
616 % eventually following next box-row will be drawn over the bottom line of
617 % this box-row.
618 % \begin{macrocode}
619 \def\y@nelineemptyboxes#1{%
620 \vbox{%
621 \hrule height\y@linethick%
622 \hbox{\y@emptyboxes{#1}\y@vr}
623 \hrule height\y@linethick}\vspace{-\y@linethick}}
624 % \end{macrocode}
625 % \end{macro}
626 %
627 %
628 % \begin{macro}{\yng}
629 % The user-macro for empty \yts. As mentioned above it has only one
630 % argument, enclosed in brackets. It first calls |\y@setdim| to
631 % determine the size of the boxes and opens a |\vcenter| if in math mode
632 % and |vcentermath| is set. Otherwise only a (then obsolet) |{| is
633 % opened. |\y@lastargtest| determines if the tableau should have only
634 % one line, setting |\y@islastargtrue| or -|false|. If there is only one
635 % line, |\yng| does the whole job in calling
636 % |\y@nelineemptyboxes| once. Otherwise it calls |\y@ungempty| to do the
637 % real thing. Note the spacing before and after the tableau using
638 % |\hspace|.
639 % \begin{macrocode}
640 \def\yng(#1){%
641 \y@setdim%
642 \hspace{\y@interspace}%
643 \ifmmode\ify@vcenter\vcenter\fi\fi{%
644 \y@lastargtest#1,
645 \vbox{\offinterlineskip
646 \ify@islastarg
647 \y@nelineemptyboxes{#1}
648 \else
649 \y@ungempty(#1)
650 \fi}}\hspace{\y@interspace}}
651 % \end{macrocode}
652 % \end{macro}
653 %
654 % \begin{macro}{\y@ungempty}
655 % It is called with |\y@ungempty(#1)| from |\yng|. Now the parsing of
656 % the arguments starts! As we know from |\y@lastargtest| in
657 % |\yng|, there really are two arguments left. Explicitely: Let the
658 % the initial command (given by the user) be |\yng(3,2,1)|; then
659 % |\yng| calls |\y@ungempty(3,2,1)|. But |\y@ungempty| sees two
660 % arguments: |#1| is |3| and |#2| is |2,1|! (Note the importance of the
661 % brackets). |\y@ungempty| then processes the first argument immediately,
662 % calling |\y@nelineemptyboxes|. (The braces protect numbers with more
663 % than one digit.)
664 %
665 % The next step is to check if |#2| is the last line. If it is, it calls
666 % \texttt{\bslash y@ne\-line\-empty\-boxes} again. Otherwise it calls
667 % \emph{recursively itselve}, till all lines are processed.
668 % \begin{macrocode}
669 \def\y@ungempty(#1,#2){%
670 \y@nelineemptyboxes{#1}
671 \y@lastargtest#2,
672 \ify@islastarg
673 \y@nelineemptyboxes{#2}
674 \else
675 \y@ungempty(#2)
676 \fi}
677 % \end{macrocode}
678 % \end{macro}
679 %
680 %
681 % \begin{macro}{\y@nelettertest}
682 % The first macro especially for labelled boxes, that is, for
683 % |\young|. Like \texttt{\bslash y@last\-arg\-test} it is used for
684 % handling a indefinite number of arguments. (As mentioned before
685 % \yts\ with labelled boxes have problem double.) |\y@nelettertest|
686 % determines if the last box of the line has been reached.
687 %
688 % Again we will examine it's working method by examples:
689 %
690 % |\y@nelettertest ab.|\\
691 % The period after the argument |ab| (and in the definition of
692 % |\y@nelettertest|) is merely a mark for the end of the
693 % arguments. (Otherwise \TeX\ would complain about missing arguments.)
694 % Here |a| is |#1| and |#2| is |b| -- the |\if|-condition is |false|
695 % and so |\y@islastargfalse| is set. Now a little miracle:
696 %
697 % |\y@nelettertest a.|\\
698 % In the opposite to the case of |\y@lastargtest| it's not
699 % understandable for me, why |#2| now is a space -- but it is! (Do
700 % \emph{you} know the reason why?)
701 % The rest is known from |\y@lastargtest|.
702 % \begin{macrocode}
703 \def\y@nelettertest#1#2. {\if\space #2 \y@islastargtrue
704 \else\y@islastargfalse\fi}
705 % \end{macrocode}
706 % \end{macro}
707 %
708 % \begin{macro}{\y@abcboxes}
709 % Again we use a period to mark the end of arguments. Compare to
710 % |\y@emptyboxes| -- Now it is more strenuous! The |\y@nelettertest|
711 % macro makes sure that |\y@abcboxes| is called with at least two boxes
712 % to process. If there are only two boxes |\y@abcboxes| calls
713 % |\y@abcbox| two times, otherwise it calls itselve recursively again.
714 % (The argument-splitting works as in |\y@ungempty|.)
715 % \begin{macrocode}
716 \def\y@abcboxes#1#2.{%
717 \ify@stdtext\y@abcbox#1\else\y@mathabcbox#1\fi%
718 \y@nelettertest #2.
719 % \end{macrocode}
720 % There must be a space or (equivalently) a carriage return after this
721 % line!
722 % \begin{macrocode}
723 \ify@islastarg\unskip%
724 \ify@stdtext\y@abcbox{#2}\else\y@mathabcbox{#2}\fi%
725 \else\y@abcboxes#2.\fi}
726 % \end{macrocode}
727 % The |\unskip| is needed for the case that |#2| is only one token. Then
728 % a space appears between two boxes. (I do not understand really what
729 % happens -- see |\y@nelettertest|.) The |\unskip| resolves this problem.
730 % \end{macro}
731 %
732 % \begin{macro}{\ify@enable@skew}
733 % \begin{macro}{\y@full@b@xdim}
734 % \begin{macro}{\y@m@veright@cnt}
735 % Most of the skew boxes stuff can be found here along the definition
736 % of \texttt{\bslash y@ne\-line\-abc\-boxes}. We need a further dimension,
737 % for the effective lenght of one box in a row, |\y@full@b@xdim| =
738 % |\y@b@xdim| + |1\y@linethick| and one counter for the number of
739 % boxes to be left out on the left side of the tableau (determined by
740 % the number of colons at the beginning of a row), |\y@m@veright@cnt|.
741 % \begin{macrocode}
742 \ify@enable@skew
743 \newdimen\y@full@b@xdim
744 \newcount\y@m@veright@cnt
745 % \end{macrocode}
746 % \end{macro}
747 % \end{macro}
748 % \end{macro}
749 % \begin{macro}{\y@get@m@veright@cnt}
750 % To find out the number of leading colons in a row we have the macro
751 % \texttt{\bslash y@get@\-m@ve\-right@\-cnt}. Here we use exactly the same
752 % trick as in |\y@nelettertest|.
753 % \begin{macrocode}
754 \def\y@get@m@veright@cnt#1#2.{%
755 \if :#1 \advance\y@m@veright@cnt by 1\y@get@m@veright@cnt#2.\fi}
756 % \end{macrocode}
757 % \end{macro}
758 % \begin{macro}{\y@setdim}
759 % Since we now have another dimension that depends on |\y@b@xdim|,
760 % the dimension of the boxes, we have to extend |\y@setdim| to
761 % calculate |\y@full@b@xdim| too. (The dummy |\y@setdim@| is used to
762 % avoid a recursion.)
763 % \begin{macrocode}
764 \let\y@setdim@=\y@setdim
765 \def\y@setdim{%
766 \y@setdim@ \y@full@b@xdim=\y@b@xdim
767 \advance\y@full@b@xdim by 1\y@linethick}
768 % \end{macrocode}
769 % \end{macro}
770 % \begin{macro}{\y@m@veright@ifskew}
771 % Now we put it all into the following macro that computes the offset
772 % and moves the tableau to the right if necessary. If skew \yts\ are
773 % not enabled, |\y@m@veright@ifskew| will be a null-command (but
774 % catches the argument).
775 % \begin{macrocode}
776 \def\y@m@veright@ifskew#1{
777 \y@m@veright@cnt=0 \y@get@m@veright@cnt#1.
778 \moveright \y@m@veright@cnt\y@full@b@xdim}
779 \else
780 \def\y@m@veright@ifskew#1{}
781 \fi
782 % \end{macrocode}
783 % \end{macro}
784 % \begin{macro}{\y@nelineabcboxes}
785 % This is the counterpart of |\y@nelineemptyboxes|. The difference
786 % is the treatment of the case of a row of only one box -- Then only
787 % |\y@abcbox| is called and not |\y@abcboxes|. If this row must be
788 % moved to the right, this is done by |\y@m@veright@ifskew|.
789 % \begin{macrocode}
790 \def\y@nelineabcboxes#1{%
791 \y@nelettertest #1.
792 \ify@islastarg
793 \y@m@veright@ifskew{#1}
794 \vbox{
795 \hrule height\y@linethick%
796 \hbox{\ify@stdtext\y@abcbox#1\else\y@mathabcbox#1\fi\y@vr}
797 \hrule height\y@linethick}\vspace{-\y@linethick}
798 \else
799 \y@m@veright@ifskew{#1}
800 \vbox{
801 \hrule height\y@linethick%
802 \hbox{\y@abcboxes #1.\y@vr}%
803 \hrule height\y@linethick}\vspace{-\y@linethick}
804 \fi}
805 % \end{macrocode}
806 % \end{macro}
807 %
808 %
809 % \begin{macro}{\young}
810 % The user-macro for labelled \yts. It has one argument as |\yng|,
811 % enclosed in brackets. Everything is identical as in the emptybox case
812 % (sizing, vcentering, treatment of multiple rows, \dots).
813 % \begin{macrocode}
814 \def\young(#1){%
815 \y@setdim%
816 \hspace{\y@interspace}%
817 \y@lastargtest#1,
818 \ifmmode\ify@vcenter\vcenter\fi\fi{%
819 \vbox{\offinterlineskip
820 \ify@islastarg\y@nelineabcboxes{#1}%
821 \else\y@ungabc(#1)%
822 \fi}}\hspace{\y@interspace}}
823 % \end{macrocode}
824 % \end{macro}
825 %
826 % \begin{macro}{\y@ungabc}
827 % Again nothing new -- see |\y@ungempty|
828 % \begin{macrocode}
829 \def\y@ungabc(#1,#2){%
830 \y@nelineabcboxes{#1}%
831 \y@lastargtest#2,
832 \ify@islastarg\y@nelineabcboxes{#2}%
833 \else\y@ungabc(#2)%
834 \fi}
835 % \end{macrocode}
836 % \end{macro}
837 % \begin{macrocode}
838 %</package>
839 % \end{macrocode}
840 %
841 % \Finale
842 \endinput