diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/source/latex/cjw/cjw-latex.dtx | 2333 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cjw/cjw-latex.ins | 44 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cjw/cjw-ltr.dtx | 821 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cjw/cjw-ltr.ins | 18 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cjw/cjwoutl.dtx | 656 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cjw/cjwoutl.ins | 18 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cjw/cjwplain.dtx | 1007 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/cjw/cjwplain.ins | 20 |
8 files changed, 4917 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/cjw/cjw-latex.dtx b/Master/texmf-dist/source/latex/cjw/cjw-latex.dtx new file mode 100644 index 00000000000..515dd7d3d0b --- /dev/null +++ b/Master/texmf-dist/source/latex/cjw/cjw-latex.dtx @@ -0,0 +1,2333 @@ +% \iffalse -*- LaTeX -*- +% +% This is file `cjw-latex.dtx'. You can run this file through +% LaTeX2e to produce a DVI file of documentation. The file +% `cjw-latex.ins' should have come with this file. Run it through +% (La)TeX to extract the bundled macro files. +% +% \fi +\def\RCSinfo{$Id: cjw-latex.dtx,v 0.13 1998/09/01 15:54:20 cwynne Exp $} + +\def\RCSsplit $#1: #2,v #3 #4 #5 #6 #7${ + \gdef\filename {#2} + \gdef\fileversion{#3} + \gdef\filedate {#4} + \gdef\filetime {#5} + \gdef\fileauthor {#6} + \gdef\filelocker {#7}} + +\expandafter\RCSsplit\RCSinfo +%% +%% \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 +%% Lower-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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \CheckSum{0} +% +% \iffalse +%<*driver> + +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{cjw-latex.dtx} + [\filedate\space v\fileversion\space + Personal macros for LaTeX2e---CJW] + +\documentclass{ltxdoc} + \usepackage{cjwmacro} + % We need math---call it with all options to make sure they work. + \usepackage[derivs,integrals,physics]{cjwmath} + +\GetFileInfo{cjw-ltr.dtx} +\EnableCrossrefs +% \DisableCrossrefs % Say \DisableCrossrefs if index is ready +% \OnlyDescription % Comment out for implementation details +\RecordChanges + +\begin{document} + \DocInput{cjw-latex.dtx} +\end{document} +%</driver> +% \fi +% +% \DeclareRobustCommand{\cseq}[1]{\texttt{\bslash#1}} +% \DeclareRobustCommand{\pkg} [1]{\textsf{#1}} +% \DeclareRobustCommand{\env} [1]{\textsf{#1}} +% +% \renewcommand{\thefootnote}{\fnsymbol{footnote}} +% +% \title{The \pkg{cjw-latex} Macro Collection\thanks{% +% This file has version \fileversion{} as of \filedate.}} +% \author{Colin J.~Wynne\thanks{E-Mail at: +% \texttt{cwynne@mts.jhu.edu}, \texttt{cwynne@jhu.edu}\,.}} +% \date{\filedate} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% +% {\parskip 0pt ^^A % This is the hack used by |doc.dtx|. +% ^^A % (bug in \LaTeX?) +% \tableofcontents +% } +% +% \section*{Introduction} +% +% I have been a \TeX{} user for quite a long time now. It was in my +% junior year in college, in 1992, that one of my friends and one of +% my math professors decided to warp my perception of reality and +% introduce me to Dr.~Knuth's wonderful creation. In those days, +% Plain-\TeX{} was the tool of choice, we coded everything ourselves +% from primitives on up, logical markup was unknown, and \LaTeX{} was +% known as Lame-\TeX. During my senior year I wrote an honors thesis +% in mathematics which required quite a lot of things not present in +% standard Plain-\TeX. My macro files grew, and grew, and\dots +% +% In the year following my graduation, I converted myself to \LaTeX{}, +% mostly because of the convergence my own personal modified +% ePlain/NFSS1/Plain format was having towards \LaTeX{} in terms of +% logical markup. Most of macros were easily converted into +% \LaTeX{}-ese. They got more complicated from there. +% +% So now I regularly write up papers, letters, mathematical problem +% sets, and just about anything else that uses the English language, +% in \LaTeX. The macros have evolved quite a bit. More has been +% added. I took to using the |dtx| format for most of my input files, +% and finally decided to wrap my big three up into a single documented +% source file. +% +% I hope that these macros will prove useful to somebody out there, +% and if they do, feel free to buy me a beer next time you see me. I +% have other |dtx| files available, including a modified \pkg{letter} +% class which also does German formal letters, and a package for doing +% outlines. Any package of mine should be identifiable on your +% friendly neighborhood CTAN site with a name like +% \verb+cjw*.(dtx|ins)+. +% +% \section{General macros} +% +% \iffalse +% +\NeedsTeXFormat{LaTeX2e} +%<general>\ProvidesPackage{cjwmacro} +%<math>\ProvidesPackage{cjwmath} +%<deriv>\ProvidesFile{cjwderiv.tex} +%<integ>\ProvidesFile{cjwinteg.tex} +%<phys>\ProvidesFile{cjwphys.tex} +%<units>\ProvidesFile{cjwunits} + [\filedate\space v\fileversion\space +%<general> Personal macros for LaTeX2e---CJW] +%<math> Math macros for LaTeX2e---CJW] +%<deriv> Derivative macros for cjwmath.sty---CJW] +%<integ> Integration macros for cjwmath.sty---CJW] +%<phys> Physics macros for cjwmath.sty---CJW] +%<units> Typesetting units in LaTeX2e---CJW] +% +%<*general> +% +%\fi +% +% I tend to organize my package files as follows---first come flow +% control structures for the package itself, usually in the form of +% new conditionals; then come the options; then comes the meat of the +% package in some sort of vaguely thought out order. This package is +% no exception. +% +% \subsection{Package initialization} +% +% Conditionals are usually used in conjunction with package options to +% provide conditional inclusion of certain code, either \emph{via} an +% \cseq{if}\dots{}\cseq{endif} block or using class options. For this +% package, the subsystem in question is the inclusion of verbatim +% typeset files. +% \begin{macrocode} +\newif\if@verbext \@verbextfalse +% \end{macrocode} +% Not surprisingly, this conditional is used directly by an option. +% \begin{macrocode} +\DeclareOption{verbext}{\@verbexttrue} +% \end{macrocode} +% I used to use options for the loading of additional packages. In +% particular, when I used \pkg{psfig.new} which could not be handled +% as a \LaTeXe{} package, I did this. Now that I use the \pkg{epsfig} +% package that comes with \LaTeXe, I simply issue a warning to +% include the package separately. +% \begin{macrocode} +\DeclareOption{psfig}{% + \PackageWarning{cjwmacro}% + {Obsolete option \CurrentOption. Use package `epsfig' instead.}} +% \end{macrocode} +% Since, however, using \pkg{pstricks} requires several files, I still +% use a package option to take care of all of that. This option +% checks for the existence of \emph{both} files before including +% either, hence the nested calls to \cseq{InputIfFileExists}. A +% similar option is used for \pkg{pst-plot.tex}, since is not +% implemented as a package file. +% \begin{macrocode} +\DeclareOption{pstricks}{% + \InputIfFileExists{pstricks.sty}{% + \InputIfFileExists{pst-node.tex}{}{% + \PackageError{cjwmacro}{File `pst-node.sty' not found.}{}}}% + {\PackageError{cjwmacro}{File `pstricks.sty' not found.}{}}} + +\DeclareOption{psplot}{\InputIfFileExists{pst-plot.tex}{}{% + \PackageError{cjwmacro}{File `pst-plot.tex' not found.}{}}} +% \end{macrocode} +% +% The next two options are used to change behavior of some macros on +% draft as opposed to final copies. Currently, only \cseq{ssbreak} +% has such a dependency, and in final form it uses the PS-Tricks +% package to typeset a nice section delimiter. Note the use of +% \cseq{ExecuteOption} by the \pkg{final} option to make sure that +% PS-Tricks is, indeed, available. +% \begin{macrocode} +% What to do for draft vs. final copy. +\DeclareOption{draft}{% + \def\ssbreakbar{\hbox to 2in{\hrulefill}}} +\DeclareOption{final}{% + \ExecuteOptions{pstricks} + \def\ssbreakbar{% + \psset{linewidth=0.4pt,unit=1in}% + \pspicture(-2.5,-0.15)(2.5,0.15)% + \qdisk(0,0){0.04}% + \qdisk(0.33,0){0.02}% + \qdisk(-0.33,0){0.02}% + \pspolygon*(0.33,-0.02)(0.33,0.02)(1.75,0)% + \pspolygon*(-0.33,-0.02)(-0.33,0.02)(-1.75,0)% + \endpspicture}} +% \end{macrocode} +% +% To finish off option handling, we declare a default (warn about +% unknown options), execute defaults, and process the passed option +% list. +% \begin{macrocode} +\DeclareOption*{% + \PackageWarning{cjwmacro}{Unknown option `\CurrentOption'}} +\ExecuteOptions{draft} +\ProcessOptions +% \end{macrocode} +% +% \subsection{General definitions} +% +% These general definitions set up some `meta-macros', to be used by +% other commands. +% +% One of the things I liked a lot about \TeX{} was the use of +% \cseq{let} to make aliases for existing commands without +% sacrificing much of the control sequence space. In the spirit of +% \LaTeXe, however, I have implemented this thrice with name +% checking. Analogously to the \cseq{newcommand}-like macros, we +% offer the following three: +% \begin{macrocode} +\newcommand{\alias} [2]{\@ifdefinable #1{\let #1 #2}} +\alias\realias\let +\newcommand{\providealias}[2]{\@ifundefined #1{\let #1 #2}} +% \end{macrocode} +% Usage is, for example, +% \begin{display}{l} +% \cseq{alias}\cseq{foo}\cseq{bar} +% \end{display} +% which makes \cseq{foo} an alias for \cseq{bar}. As expected, +% \cseq{alias} only works if the new name is currently undefined and +% \cseq{providealias} does nothing if its first argument is already +% defined. Somewhat more lax than its counterpart +% \cseq{renewcommand}, \cseq{realias} does not care if its first +% argument is defined or not. In essence, that command is used to +% unconditionally alias a command. This is why, oddly enough, +% \cseq{realias} is itself just an alias of \cseq{let}. Is this +% getting confusing yet? +% +% Next we input wholesale a few useful packages. These are still in +% the spirit of meta-macros which define this section. The first +% package, \pkg{amstext}, provides the \cseq{text} command, which +% basically puts its argument in text mode inside a box, but in the +% current style (textstyle, scriptstyle, etc.). This is used later +% on. The \pkg{xspace} package is used for control sequences which +% would encounter `the space problem' when expanded as is. +% \begin{macrocode} +\RequirePackage{amstext} +\RequirePackage{xspace} +% \end{macrocode} +% The command \cseq{intertext} from the \pkg{amsmath} package is quite +% useful, but I do not want to include that entire package unless it +% is necessary. Therefore, I make sure that command is defined one +% way or another. I also give it the alias \cseq{rem} since I am +% somewhat nostalgic about ancient forms of \textsf{\small BASIC}\dots{} +% \begin{macrocode} +\providecommand{\intertext}[1]{\noalign{% + \penalty\postdisplaypenalty\addvspace{ 0.5\belowdisplayskip} + \vbox{\normalbaselines\noindent#1}% + \penalty\predisplaypenalty\addvspace{0.5\abovedisplayskip}}} +\alias\rem\intertext +% \end{macrocode} +% +% Next we define some font style names which will be used in some +% contexts later. This is done to avoid hard-coding of certain styles +% and to allow as much customization as possible. +% \begin{macrocode} +\providecommand{\pagenofont} {\normalfont} +\providecommand{\declarefont} {\normalfont\bfseries\mathversion{bold}} +\providecommand{\altdeclarefont}{\normalfont\itshape} +\providecommand{\captionfont} {\normalfont\itshape} +\providecommand{\examplefont} {\normalfont} +\providecommand{\altexamplefont}{\normalfont\itshape} +\providecommand{\labelfont} {\normalfont\bfseries\mathversion{bold}} +\providecommand{\timelinefont} {\normalfont} +\providecommand{\titlefont} {\normalfont\bfseries\Large\mathversion{bold}} +\providecommand{\verbatimfont} {\normalfont\ttfamily} +% \end{macrocode} +% +% The next few commands are for programming convenience. First we +% want to be able to swap the definitions of two control sequences. +% \begin{macrocode} +\newcommand{\swapdef}[2]{{% + \let \@tempa #1\relax + \global\let #1 #2\relax + \global\let #2 \@tempa}} +% \end{macrocode} +% We also want to be able to do the same for lengths (or glue or +% whathaveyou). +% \begin{macrocode} +\newcommand{\swapdim}[2]{{% + \@tempdima #1\relax + \global #1 #2\relax + \global #2 \@tempdima}} +% \end{macrocode} +% Next is a macro constructed from an exercise in \emph{The +% \TeX{}book}, which takes three control sequences and expands them in +% reverse order. +% \begin{macrocode} +\newcommand{\expandthree}[2]{% + \expandafter\expandafter\expandafter #1\expandafter #2} +% \end{macrocode} +% +% This next macro is modified from code I received in the +% |comp.text.tex| newsgroup. According to the e-mail in which I +% received it, the original source is a set of macros for +% \emph{TUGboat}. It turns a number into an ordinal, finding the +% correct ordinal label which is set as a superscript. +% \begin{macrocode} +\newcommand{\nth}[1]{{% + \@tempcnta = #1\relax + \ifnum \@tempcnta < 0\relax % Make sure our number is + \@tempcnta = -\@tempcnta % non-negative. + \fi + \ifnum \@tempcnta < 14\relax % Deal first with the + \ifnum \@tempcnta > 10\relax % exceptions for + \def\@tempa{th} % 11, 12, and 13. + \fi + \else + \loop \ifnum\@tempcnta > 9\relax % Loop until the recursive + \@tempcntb = \@tempcnta % remainder (mod 10) is + \divide \@tempcntb by 10\relax % a single digit in order + \multiply\@tempcntb by 10\relax % to successfully satisfy + \advance \@tempcnta by -\@tempcntb% the ordinality test. + \repeat + \def\@tempa{\ifcase\@tempcnta % Figure the proper label: + th% % 0th + \or st% % 1st + \or nd% % 2nd + \or rd% % 3rd + \else th% % nth + \fi} + \fi + #1\ensuremath{^{\text{\@tempa}}}}} % Superscript the label in + % math mode. +% \end{macrocode} +% +% Continuing in the vein of superscripts, we define two macros which +% put their arguments as sub- and superscripts in script-script +% style. This was motivated by such things as derivative indices +% which look just plain ugly in script style. +% \begin{macrocode} +\alias\sst\scriptscriptstyle +\newcommand{\ssp}[1]{^{\sst#1}} +\newcommand{\ssb}[1]{_{\sst#1}} +% \end{macrocode} +% +% We now come to some very important and necessary macros, namely the +% creation of typeset sideways \textsf{\small ASCII} smiley +% faces. \smiley Since I like to be as general as possible, I have +% also written an \cseq{emote} macro for indicating +% emotions. \emote{smirk} +% \begin{macrocode} +\newcommand{\smiley}[1][\@smiley]{% + \edef\@sf{\spacefactor=\the\spacefactor}% + \unskip\spacefactor=1000\relax\space #1\@sf\xspace} +\newcommand{\@smiley}{% + {\ttfamily\raise 0.078em\hbox{:}\kern-0.1em{-}\kern-0.1em{)}}} +\newcommand{\emote}[1]{% + \smiley[\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}]} +% \end{macrocode} +% +% Since I learned the good habit of doing so at Washington and Lee, I +% often append pledges to my assignments. The generic pledge is +% implemented as an environment. It formerly took an argument, the +% date, but I decided that was superfluous, seeing as how the +% assignment headers set the date once. Why risk inconsistency? Much +% to my surprise, I found out that \LaTeXe's \cseq{maketitle} command +% unsets not only the date holder, but also the command which is used +% to set the date in the first place. Anyhow, this means that the +% date \emph{does} need to be set, but I have left that to be done by +% the headers. The \env{pledge} environment issues a warning if the +% date is not set. +% \begin{macrocode} +\newenvironment{pledge}% + {\ifx\@empty\@date + \PackageWarning{cjwmacro}{Date is not set.} + \fi + \parskip=2pt \parindent=0pt\relax + \null\vfill\begin{flushright} + \itshape\small} + {\\[5ex]\normalfont\footnotesize + \makebox[2in]{\hrulefill}\quad\@date\\ + \makebox[2in]{Colin J.~Wynne}\quad{\hphantom{\@date}}\\ + \end{flushright}} +% \end{macrocode} +% The old Washington and Lee pledge lives on in my macros\dots{} It +% requires one argument, namely the type of assignment being pledged. +% The argument is optional, though, and a paper is assumed by default. +% \begin{macrocode} +\newcommand{\wnlpledge}[1][paper]{% + \ifx\@empty\@date + \PackageWarning{cjwmacro}{Date is not set.} + \fi + \parskip=2pt \parindent=0pt\relax + \null\vfill\begin{flushright} + \itshape\small + On my honour, I have neither given nor received\\ + any unacknowledged aid on this #1.\\[5ex] + \normalfont\footnotesize + \makebox[2in]{\hrulefill}\quad\@date\\ + \makebox[2in]{Colin J.~Wynne,~'94}\quad{\hphantom{\@date}}\\ + \end{flushright}} +% \end{macrocode} +% +% As mentioned in the option section, there is a macro used to put +% fancy section delimiters into, say, a story. The \cseq{ssbreak} +% command expects the type of delimiter, the \cseq{ssbreakbar}, to be +% defined. Since either \pkg{draft} or \pkg{final} must be chosen as +% an option, this should be fine, but I have put a hopefully redundant +% command in just in case. +% \begin{macrocode} +\newcommand{\ssbreak}{\bigskip + \centerline{\ssbreakbar}\bigbreak} +\providecommand{\ssbreakbar}{} +% \end{macrocode} +% +% \subsection{Box formatting} +% +% I have written some of my own commands for handling boxes. The +% first thing I wanted was an analog of \cseq{mbox} or \cseq{hbox} for +% math mode. The simple version---\cseq{mathbox} puts its argument into an +% \cseq{hbox}, in math mode, in the current style. The second version +% is \cseq{Mathbox}, which takes two arguments, the first of which is +% put in the box and evaluated \emph{before} math mode is entered. +% This was done for a specific application where I needed to get the +% contents of the \cseq{mathbox} itself into boldface. Of course, +% \cseq{boldmath} cannot be evaluated within math mode. Note that the +% style is chosen by the \cseq{mathpalette} macro, and that the +% command \cseq{@mathbox} is essentially just a dummy to allow the +% proper expansion of \cseq{mathpalette}. +% \begin{macrocode} +% \mathbox puts its argument into an \hbox, in math mode, with the +% current \...style. +\def\mathbox #1{\hbox{$\mathpalette\@mathbox{#1}$}} +\def\Mathbox #1#2{\hbox{#1$\mathpalette\@mathbox{#2}$}} +\def\@mathbox#1#2{#1#2} +% \end{macrocode} +% Now, there is a reason why these are defined with \cseq{def} and not +% \cseq{newcommand}. You see, what I really wanted to do was +% something like +% \begin{verbatim} +% \newcommand{\mathbox}[2][]{% +% \hbox{#1$\mathpalette\@mathbox{#1}$}} +% \newcommand{\@mathbox}[2]{#1#2} +% \end{verbatim} +% in order to get optional arguments to my \cseq{mathbox}es. The +% problem, though, is that I want to use this command in the context +% of |\box|$N$|=\mathbox{|\dots{}|}|, and for that to work, the first +% token in the expansion of \cseq{mathbox} \emph{must} be a +% |\|$?$|box| command. The overhead imposed by \cseq{newcommand} +% precludes this. So, I use the cheap hack until I figure out a more +% workable way of implementing what I really want. +% +% A more generically applicable box command is one which does unto +% width what \cseq{smash} does to height. Hence \cseq{smush}: +% \begin{macrocode} +\newcommand{\smush}{\relax + \ifmmode + \def\next{\mathpalette\math@smush} + \else + \let\next\make@smush + \fi \next} +\newcommand{\make@smush}[1]{\setbox0=\hbox{#1}\fin@smush} +\newcommand{\math@smush}[2]{\setbox0=\hbox{$\m@th#1{#2}$}\fin@smush} +\newcommand{\fin@smush}{\wd0=0pt \box0 } +% \end{macrocode} +% +% And finally, vaguely in the realm of boxes, we have struts. Here I +% have defined some math struts of various sizes (corresponding to the +% various delimiter sizes on which they are based). +% \begin{macrocode} +\newcommand{\bigmathstrut} {\vphantom{\big()}} +\newcommand{\biggmathstrut}{\vphantom{\bigg()}} +\newcommand{\Bigmathstrut} {\vphantom{\Big()}} +\newcommand{\Biggmathstrut}{\vphantom{\Bigg()}} +% \end{macrocode} +% +% \subsection{Abbreviations, etc.} +% +% I have found myself using particular types of abbreviations quite +% often---often enough that I wanted control sequences for them, +% whence these first few specimens. +% \begin{macrocode} +\newcommand{\ie} {\emph{i.e.}\xspace} +\newcommand{\eg} {\emph{e.g.}\xspace} +\newcommand{\heisst}{d.h\null.\xspace} % \dh is taken. +% \end{macrocode} +% Note the use of \cseq{xspace} so that explicit space need not be +% given afterward. I did this mostly because I have never decided +% whether or not I want to use a comma after either of this. +% +% The second type of abbreviation is the initial, or should I say +% initials. I finally settled on a style I like---two initials should +% be separated by a thinspace, and will of course need to have the +% spacefactor adjusted if at the end of a sentence (followed by a +% period, in particular). Here is the implementation: +% \begin{macrocode} +\newcommand{\initials}[2]{% + \break@init #2 + \@ifdefinable #1{% + \global\edef#1{% + \noexpand\hbox{\@tempa.\noexpand\,\@tempb}% + \noexpand\@ifnextchar.{\noexpand\@}{.\noexpand\xspace}}}} +\def\break@init #1.#2.{% + \def\@tempa{#1}\def\@tempb{#2}} +% \end{macrocode} +% What happens is this. The \cseq{initials} command is given a +% control sequence name and the initials to be used. The initials are +% broken on the periods and returned in the specified tokens. Then, +% if the control sequence is available for definition, it is defined +% in such a way to make all the spacing and punctuation work out. +% Since the tokens need to be expanded back to the separate initials, +% an \cseq{edef} is required---at the same time, use of +% \cseq{noexpand} is made to keep things from going kablooie at +% definition time. Here are some standard initials by way of usage +% example. +% \begin{macrocode} +\initials{\UN}{U.N.} +\initials{\US}{U.S.} +\initials{\AI}{A.I.} +% \end{macrocode} +% +% \subsection{Dates} +% +% I have had call to do a fair amount of \TeX{} in both English and +% German. Therefore, in implementing the examples of date macros from +% \emph{The \TeX{}book}, I have provided for both languages. +% +% \begin{macrocode} +% LaTeX style commands for date-parts, both English and German. +\providecommand{\theday}{\number\day\relax} +\providecommand{\themonth}{% + \ifcase\month\or January\or February\or% + March\or April\or May\or June\or July\or August\or% + September\or October\or November\or December\fi} +\providecommand{\themonat}{% + \ifcase\month\or Januar\or Februar\or% + M\"arz\or April\or Mai\or Juni\or Juli\or August\or% + September\or Oktober\or November\or Dezember\fi} +\providecommand{\theyear}{\number\year\relax} +% \end{macrocode} +% Note that \cseq{today} is unconditionally defined by the following +% underhandedness. +% \begin{macrocode} +\providecommand{\today}{} +\renewcommand{\today}{\theday~\themonth, \theyear\xspace} +\providecommand{\heute}{} +\renewcommand{\heute}{den~\theday.\ \themonat\ \theyear\xspace} + \alias\gdate\heute +% \end{macrocode} +% +% \subsection{Page styles and titles} +% +% We are finally into the realm of more traditional package macros, +% namely creating some general page appearances. Here I have +% redefined the \pkg{plain} pagestyle to take advantage of the +% \cseq{pagenofont} defined above. +% \begin{macrocode} +\renewcommand{\ps@plain}{% + \let\@mkboth \@gobbletwo + \let\@oddhead \@empty + \let\@evenhead\@empty + \def\@oddfoot{\pagenofont\hfil\thepage\hfil} + \let\@evenfoot\@oddfoot} +% \end{macrocode} +% The \pkg{topright} pagestyle has page numbers (strangely enough) at the top +% right of the page. +% \begin{macrocode} +\newcommand{\ps@topright}{% + \let\@mkboth \@gobbletwo + \def\@oddhead{\pagenofont\hfil\thepage} + \let\@evenhead\@oddhead + \let\@oddfoot \@empty + \let\@evenfoot\@empty} +% \end{macrocode} +% +% \subsection{Text formatting} +% +% \subsubsection{Timelines} +% +% A timeline is a long, running, two-column format used, for example, +% to do r\'esum\'es or vit\ae (or, if you are in Germany, a +% \emph{Lebenslauf}). The idea is that a date (or some identifying +% information) appears at the left, and the content is given in the +% righthand column. The usage is +% \begin{display}{l} +% |\timeline[|\meta{pos}|]{|\meta{date}|}| +% \end{display} +% where \meta{pos} is exactly the argument to \cseq{makebox}, the +% justification of the \meta{date} entry within the lefthand column. +% That column has length \cseq{timelineskip}, which can off course be +% set as desired. +% \begin{macrocode} +\newlength{\timelineskip} +\setlength{\timelineskip}{1.75in} +% \end{macrocode} +% The actual entries are not considered to be two separate columns. +% Rather, the first line is padded out to \cseq{timelineskip} with +% makebox, and following lines use a hanging indentation. The control +% sequence \cseq{endtimeline} is defined trivially so that a timeline +% entry may be used as a \env{timeline} environment. +% \begin{macrocode} +\newcommand{\timeline}[2][l]{% + \noindent\hangindent=\timelineskip + \makebox[\timelineskip][#1]{\timelinefont{#2}}\ignorespaces} +\let\endtimeline\relax +% \end{macrocode} +% +% \subsubsection{Mathematical declarations} +% +% In writing up mathematics, one often wishes to declare definitions, +% theorems, and so forth. I have written generic declaration macros +% which can be customized for these uses. Since I prefer to have all +% such things numbered seuqentially, they use a common counter, called +% \cseq{declare}, strangely enough. They are numbered within sections +% if sections are being numbered. +% \begin{macrocode} +\@ifundefined{c@section} + {\newcounter{declare}} + {\newcounter{declare}[section] + \renewcommand{\thedeclare}{\thesection.\arabic{declare}}} +% \end{macrocode} +% When declarations are numbered, it is sometime nice to have the +% declaration type and number appear uniformly wide throughout. This +% is done by forcing the declaration to appear in a box of width +% \cseq{declareindent}. +% \begin{macrocode} +\newlength{\declareindent} + \setlength{\declareindent}{0pt} +% \end{macrocode} +% We use some internal commands to specify exactly how the declaration +% is typeset. In fact, we will be defining not only declaration, but +% an alternate declaration form so that two different methods may be +% used simultaneously in a document---\eg, when theorems and major +% results are to be italicized, but definitions and so forth are not. +% \begin{macrocode} +\newcommand{\@declare} [1]{{\declarefont#1:}\quad} +\newcommand{\@altdeclare}[1]{{\altdeclarefont#1:}\quad} +% \end{macrocode} +% The generic declarations are environments, and are provided in both +% numbered (normal) and unnumbered (starred) forms. The latter are +% more simple. +% \begin{macrocode} +\newenvironment{declaration*}[1]% + {\medbreak\noindent\ignorespaces + \@declare{#1}\ignorespaces}% + {\kern0pt\nobreak\smallskip} +\newenvironment{altdeclaration*}[1]% + {\medbreak\noindent\ignorespaces + \@altdeclare{#1}\ignorespaces}% + {\kern0pt\nobreak\smallskip} +% \end{macrocode} +% The numbered versions introduce nothing surprising, but are a tad +% more involved. +% \begin{macrocode} +\newenvironment{declaration}[1]% + {\medbreak\refstepcounter{declare} + \noindent\ignorespaces + \ifnum\declareindent = 0\relax% + \@declare{\thedeclare\quad #1} + \else + \makebox[\declareindent]{\@declare{\thedeclare\hss #1}} + \fi\ignorespaces} + {\kern0pt\nobreak\smallskip} +\newenvironment{altdeclaration}[1]% + {\medbreak\noindent\ignorespaces + \refstepcounter{declare} + \ifnum\declareindent = 0\relax + \@altdeclare{\thedeclare\quad #1} + \else + \makebox[\declareindent]{\@altdeclare{\thedeclare\hss #1}} + \fi\ignorespaces} + {\kern0pt\nobreak\smallskip} +% \end{macrocode} +% Now, because I am essentially lazy and do not want the extra typing +% needed for an environment, I have shortcuts, \cseq{declare} and +% \cseq{altdeclare}, as well as numbered versions \cseq{ndeclare} and +% \cseq{altndeclare}. The first argument is passed to the +% corresponding environment, and the following paragraph is the body +% of the environment. +% \begin{macrocode} +\def\declare #1#2\par{% + \begin{declaration*}{#1}#2\end{declaration*}\par} +\def\altdeclare #1#2\par{% + \begin{altdeclaration*}{#1}#2\end{altdeclaration*}\par} +\def\ndeclare #1#2\par{% + \begin{declaration}{#1}#2\end{declaration}\par} +\def\altndeclare#1#2\par{% + \begin{altdeclaration}{#1}#2\end{altdeclaration}\par} +% \end{macrocode} +% Genreality is all well and good, but there are some stock +% declarations, given here in both numbered and unnumbered versions. +% \begin{macrocode} +\providecommand{\corollary} {\declare{Corollary}} +\providecommand{\definition} {\declare{Definition}} +\providecommand{\lemma} {\declare{Lemma}} +\providecommand{\proposition} {\declare{Proposition}} +\providecommand{\theorem} {\declare{Theorem}} +\providecommand{\note} {\altdeclare{Note}} + +\providecommand{\ncorollary} {\ndeclare{Corollary}} +\providecommand{\ndefinition} {\ndeclare{Definition}} +\providecommand{\nlemma} {\ndeclare{Lemma}} +\providecommand{\nproposition}{\ndeclare{Proposition}} +\providecommand{\ntheorem} {\ndeclare{Theorem}} +\providecommand{\nnote} {\altndeclare{Note}} +% \end{macrocode} +% In addition, the following German declaration (meaning a claim) is +% also defined. +% \begin{macrocode} +\providecommand{\behaupt} {\declare{Behauptung}} +\providecommand{\nbehaupt} {\ndeclare{Behauptung}} +% \end{macrocode} +% Finally, since one is not likely to mix numbered and unnumbered, +% here is a control sequence that will make sure everything is +% numbered. +% \begin{macrocode} +\newcommand{\allndeclares}{% + \let\declare \ndeclare + \let\altdeclare \altndeclare} +% \end{macrocode} +% +% Now that we have propositions, claims, and theorems (oh my!), we +% want to be able to prove them. The first step is to define a proof +% environment. The environment simply sets up a label and some +% spacing. The label is in |\altdeclarefont|. The label is an +% optional argument which defaults to `Proof', oddly enough. +% \begin{macrocode} +\newenvironment{proof}[1][Proof]% + {\smallbreak\noindent{\altdeclarefont#1:}% + \quad\ignorespaces}% + {\qed} +% \end{macrocode} +% Just in case you are prooving in German, we also have the following: +% \begin{macrocode} +\newenvironment{beweis}[1][Beweis]% + {\smallbreak\noindent{\altdeclarefont#1:}% + \quad\ignorespaces}% + {\qed} +% \end{macrocode} +% Note that the end of a proof has the command |\qed|, which we will +% unconditionally define here. This is adapted from \emph{The +% \TeX{}book}. The idea is to right justify |\qedsymbol| on the line +% where |\qed| is invoked, unless there is not a comfortable amount of +% room. That amount is given as 2\,em. When this happens, the line +% is broken and the |\qedsymbol| appears flush right on the following +% line. +% \begin{macrocode} +\providecommand{\qed}{} + \renewcommand{\qed}{% + {\unskip\nobreak\hfil\penalty 50% + \hskip 2em\hbox{}\nobreak\hfil\qedsymbol% + \parfillskip=0pt \finalhyphendemerits=0 \par}} +% \end{macrocode} +% The standard end-of-proof symbol is a box, but I prefer somewhat +% less ink. I use \TeX's hollow diamond suit symbol (again +% unconditionally defined). +% \begin{macrocode} +\providecommand{\qedsymbol}{} + \renewcommand{\qedsymbol}{\lower 0.35ex\hbox{$\diamondsuit$}} +% \end{macrocode} +% In case it is desired, the box symbol is defined as |\qedbox|, and +% then with a simple alias this can be used to end all proofs. +% \begin{macrocode} + \newcommand{\qedbox}{\vrule height4pt width3pt depth2pt} +% \end{macrocode} +% Now we wish to define control sequences for some constructions +% commonly found in proofs. I often find myself writing out proofs +% which require cases. There are two types of cases. Often I will +% want to have two cases, one for each definition of an equivalence +% for example. In this case, the case delimiters will be something +% like |\then| and |\when| commands, and should be set in parentheses +% to mark them clearly. The other type is the more general `Case +% $n$:' (where $n$, one hopes, will not be \emph{too} large). To +% cover both of these, we use a fairly typical \LaTeX{} conceit: +% \begin{display}{l} +% |\Case*{|\meta{case}|}| +% \end{display} +% where the unstarred argument sets \meta{case} inside parentheses and +% the star supresses the parentheses. A German alias is given. +% \begin{macrocode} +\newcommand{\Case}{\@ifstar{\@starCase}{\@Case}} +\newcommand{\@starCase}[1]{\@@Case{#1}} +\newcommand{\@Case}[1]{\@@Case{(#1)}} +\newcommand{\@@Case}[1]{% + \noindent{\declarefont#1}\quad\ignorespaces} +\alias\Fall\Case +% \end{macrocode} +% And finally, just in case the proof is by contradiction, we have the +% following. +% \begin{macrocode} +\newcommand{\contra}{\ensuremath{\Rightarrow\Leftarrow}} +% \end{macrocode} +% +% +% \subsubsection{Problems and examples} +% +% In addition to declarations, and for subjects other than +% mathematics, one might want to provide examples and worked +% problems. I implement examples as a separate environment (well, +% \emph{four} separate environments) so that they may have fonts +% distinct from declarations. +% \begin{macrocode} +\newenvironment{example*}% + {\@nameuse{declaration*}{Example}\examplefont} + {\medbreak} +\newenvironment{altexample*}% + {\@nameuse{declaration*}{Example}\examplefont} + {\medbreak} +\newenvironment{example}% + {\declaration{Example}\examplefont} + {\medbreak} +\newenvironment{altexample}% + {\declaration{Example}\examplefont} + {\medbreak} +% \end{macrocode} +% +% Problems are handled differently. In my experience, problems do not +% appear in longwinded documents using sectioning, and so the counter +% need not be embedded. +% \begin{macrocode} +\newcounter{problem} + \setcounter{problem}{0} +\renewcommand{\theproblem}{\arabic{problem}} +\renewcommand{\p@problem}{} +% \end{macrocode} +% Often when working a problem, one wishes to include a reference to +% the source. This is accomplished via the \cseq{Page} macro. Usage +% is +% \begin{display}{l} +% |\Page*[|\meta{author}|]{|\meta{pp}|}{|\meta{problem}|}| +% \end{display} +% In the \LaTeX{} tradition, the standard command tries to outguess +% you by prepending a hash `\#' to the problem number, whereas the +% starred version omits this. Thus, the standard version produces +% \begin{display}{l} +% ([\meta{author},~]p.\,\meta{pp}, \#\meta{problem}) +% \end{display} +% and \cseq{Page*} leaves off the hash. Notice that the space between +% author and page number is inserted by the macro. The macro is +% defined robustly so that it can be used in moving arguments. +% \begin{macrocode} +\DeclareRobustCommand{\Page}{% + \@ifstar{\@Page{}}{\@Page{\#}}} +\def\@Page#1{% + \@ifnextchar [{\@@Page{#1}}{\@@Page{#1}[]}} +\def\@@Page#1[#2]#3#4{% + \def\@tempa{#2}% + \ifx\@empty\@tempa% + \let\@tempb\@tempa% + \else% + \edef\@tempb{\@tempa,~}% + \fi% + (\@tempb p.\,#3, #1{#4})} +% \end{macrocode} +% +% The statement of a problem is given in an environment, again so that +% font customization can be easily done. The \env{statement} +% environment takes a single optional argument, which is typeset at +% the beginning of the statement in \cseq{altdeclarefont}. The rest +% of the statement is in \cseq{declarefont}. I use the optional +% argument to pass a \cseq{Page} reference most often---note, though, +% that if the optional argument to \cseq{Page} is used, the whole +% \cseq{Page} command should be put in braces sp that the square +% brackets of optional arguments do not get confused. +% \begin{macrocode} +\newenvironment{statement}[1][\null]% + {\def\@tempa{#1}\def\@tempb{\null}% + \ifx\@tempa\@tempb% + \def\@tempc{\null}% + \else% + \def\@tempc{\altdeclarefont\@tempa\quad}% + \fi% + \declarefont{\@tempc}\ignorespaces} + {\removelastskip\nopagebreak\smallskip} +% \end{macrocode} +% A problem, now, is basically just a wrapper for the statement. It +% generates and sets the problem number, does some spacing, and the +% body of the \env{problem} environment becomes the body of the +% \env{statement}. In essence, a \env{problem} is a numbered +% \env{statement}. There is a starred version which does not do +% numbers and references---this just does the correct spacing and +% calls \env{statement}. Note that the problem number is set using a +% macro from the \pkg{cjw-outl} package. +% \begin{macrocode} +\newenvironment{problem}% + {\setcounter{equation}{0}% + \gdef\theequation{\theproblem.\arabic{equation}}% + \removelastskip\medbreak% + \refstepcounter{problem}% + \noindent\theoutlabel{\theproblem.}% + \statement} + {\endstatement} +\newenvironment{problem*}% + {\removelastskip\medbreak% + \noindent\statement} + {\endstatement} +% \end{macrocode} +% Since I have been known to write assignments in German, we provide +% the aliases to make an \env{aufgabe} environment. +% \begin{macrocode} +\alias \aufgabe \problem +\realias\endaufgabe\endproblem +% \end{macrocode} +% For parts and subparts of problems, the aliases are English and the +% main definitions are German because I wrote these while I was in +% Germany. So, parts (\emph{Teile}) are numbered within problems and +% subparts (\emph{Subteile}) within parts. The defaults for +% cross-referencing (the \cseq{p@} forms) are set, too. +% \begin{macrocode} +\newcounter{teil} [problem] +\newcounter{steil}[teil] +\renewcommand{\theteil} {(\alph{teil})} + \renewcommand{\p@teil} {\theproblem} +\renewcommand{\thesteil} {(\roman{steil})} + \renewcommand{\p@steil}{\p@teil\theteil} +% \end{macrocode} +% The environment \env{part}/\env{teil} used to be implemented +% entirely in terms of the \pkg{cjw-outl} package, but that was a +% little bit of overkill, and made the numbering more difficult to +% implement. I ought to one day implement problems/parts/subparts +% entirely in terms of the outline macros. We'll see. +% +% Anyway, the current implementations still rely on some of the +% definitions from the \pkg{cjw-outl} package. The +% \env{part}/\env{teil} environments take a single optional argument, +% namely the outline depth. Level one starts the text flush left at +% the margin, which is usually where the \env{problem} is, hence a +% \env{part} should be at level two, and this is the default. A more +% detailed explanation of the goings-on here can be found in +% \pkg{cjw-outl.dtx}. +% \begin{macrocode} +\newenvironment{teil}[1][2]% + {\@tempcnta=#1\advance\@tempcnta by -1\relax + \ifnum\@tempcnta < 1\relax + \leftskip=0pt\relax + \else + \leftskip=\@tempcnta\outlindent + \fi + \refstepcounter{teil} + \addvspace{\medskipamount}% + \noindent\theoutlabel{\theteil}% + \ignorespaces} + {\par\smallbreak} +% \end{macrocode} +% The default level for \env{ppart} or \env{steil}, the subpart +% environments, is three. +% \begin{macrocode} +\newenvironment{steil}[1][3]% + {\@tempcnta=#1\advance\@tempcnta by -1\relax + \ifnum\@tempcnta < 1\relax + \leftskip=0pt\relax + \else + \leftskip=\@tempcnta\outlindent + \fi + \refstepcounter{steil} + \addvspace{\medskipamount}% + \noindent\theoutlabel{\thesteil}% + \ignorespaces} + {\par\smallbreak} +% \end{macrocode} +% English aliases are, of course, given. +% \begin{macrocode} +\realias\part \teil +\realias\endpart \endteil +\alias \ppart \steil +\realias\endppart\endsteil +% \end{macrocode} +% +% \subsubsection{Footnotes} +% +% This is a simple modification to a standard \LaTeXe{} internal +% macro, because I prefer hanging indentation on my footnote text. +% \begin{macrocode} +\long\def\@makefntext#1{% + \parindent 1em\noindent\hangindent=\parindent% + \hb@xt@ 1em{\hss \llap{\@makefnmark} }#1} +% \end{macrocode} +% +% \subsubsection{Text displays} +% +% I have turned the \cseq{begindisplay} and \cseq{enddisplay} macro +% pair from \emph{The \TeX{}book} (page~421) into a \LaTeX{} +% environment. As with Knuth's macros, local definitions for use +% within the display can be given, in this case via the +% \env{display}'s optional argument. Since the environment is +% implemented through the standard \env{tabular} environment, there is +% a mandatory argument specifying column layout. Overall, usage is +% \begin{display}{l} +% \cseq{begin}|{display}[|\meta{local}|]{|\meta{cols}|}| +% \end{display} +% with local definitions \meta{local} and column descriptol +% \meta{col}. (By the way, the previous display was created with the +% \env{display} environment\dots) +% +% The display's offset from the left margin is specified by +% \cseq{textdisplay indent}. Default value is equal to +% \cseq{parindent}, and is therefore set below, after +% \cseq{parindent}. +% \begin{macrocode} +\newlength{\textdisplayindent} +% \end{macrocode} +% The actual \env{display} environment uses the spacing and penalties +% of mathematical displays. +% \begin{macrocode} +\newenvironment{display}[2][] + {\vadjust{\penalty\predisplaypenalty} + \@newline[\abovedisplayskip]% + \begingroup% + #1% + \begin{tabular}{@{\null\hspace{\textdisplayindent}\null}#2}} + {\end{tabular}\endgroup + \vadjust{\penalty\postdisplaypenalty} + \@newline[\belowdisplayskip]\ignorespaces} +% \end{macrocode} +% +% \subsection{Verbatim inclusions} +% +% Since I only occassionally need to include verbatim files, the +% following macros need to be specifically included by a package +% option, as was mentioned above. +% \begin{macrocode} +\if@verbext +% \end{macrocode} +% For numbered inclusions, we need a line number counter. +% \begin{macrocode} +\newcounter{vfline} +\renewcommand{\thevfline}{\arabic{vfline}} +% \end{macrocode} +% We need the following command from \emph{The \TeX{}book}. +% \begin{macrocode} +\providecommand{\uncatcodespecials}{% + \def\do##1{\catcode`##1=12 }\dospecials} +% \end{macrocode} +% The basic command is \cseq{verbfile} which takes an optional +% argument specifying the starting line number (default is one), and a +% mandatory argument which is, of course, the name of the file to +% include. There is also \cseq{verbfilenolines} which does not number +% lines, and needs only the one mandatory argument. +% \begin{macrocode} +\providecommand{\verbfile}[2][1]{% + \par\begingroup\@vf@lines{#1}\input{#2}\relax\endgroup} +\providecommand{\verbfilenolines}[1]{% + \par\begingroup\@vf@nolines\input{#1}\relax\endgroup} +% \end{macrocode} +% In the manner of command which need to do \cseq{catcode} trickery, +% the above are primarily wrappers for the real commands. The one +% problem with these as currently implemented is that they do not +% handle leading space in the included file. Oh, well. +% \begin{macrocode} +\newcommand{\@vf@lines}[1]{% + \verbatimfont + \setcounter{vfline}{#1} + \addtocounter{vfline}{-1} + \setlength{\parindent}{0pt} + \setlength{\parskip}{0pt} + \def\par{\leavevmode\endgraf} + \obeylines \uncatcodespecials \obeyspaces + \everypar{\null\stepcounter{vfline}% + \llap{\scriptsize\thevfline\quad}\null}} +\newcommand{\@vf@nolines}{% + \verbatimfont + \setlength{\parindent}{0pt} + \setlength{\parskip}{0pt} + \def\par{\leavevmode\endgraf} + \obeylines \uncatcodespecials \obeyspaces + \everypar{\null}} +% \end{macrocode} +% Now we end the inclusion conditional. +% \begin{macrocode} +\fi +% \end{macrocode} +% +% \subsection{Initialization} +% +% We use the \cseq{AtBeginDocument} command to set up some default +% values when the document is actually started. +% \begin{macrocode} +\AtBeginDocument{% + \setlength{\parindent} {20pt} + \setlength{\parskip} { 2pt plus 1pt} + \setlength{\textdisplayindent}{\parindent}} +% \end{macrocode} +% +% \iffalse +% +%</general> +% +% \fi +% +% +% \section{Math macros} +% +% \iffalse +% +%<*math> +% +% \fi +% +% While some macros useful for typesetting mathematics have already +% been covered, none of them had to do with mathematical equations or +% symbols---they were macros for logical flow and delineation. In +% this package, \pkg{cjwmath}, I have written macros which are +% specifically for typesetting the actual math---the vast majority of +% these macros, if not actually all of them, are meant to be used in +% math mode. +% +% \subsection{Package initialization} +% +% Since different papers require different types of math, I have again +% used the introduction of conditionals and package options to control +% what code is actually loaded. The important one concerns use of the +% AMS math packages in AMS-\LaTeX. This is included as an option to +% my package because some of my definitions depend upon whether the +% AMS macros are being used. There are conditionals for including +% code for calculus (both derivatives and integrals) and some code for +% physics. +% \begin{macrocode} +\newif \if@amsmath +\newif \if@derivatives +\newif \if@integrals +\newif \if@physics +% \end{macrocode} +% There are options corresponding to each conditional. +% \begin{macrocode} +\DeclareOption{amsmath} {\@amsmathtrue} +\DeclareOption{derivs} {\@derivativestrue} +\DeclareOption{integrals}{\@integralstrue} +\DeclareOption{physics} {\@physicstrue} +% \end{macrocode} +% There used to be another option for typesetting units. While I +% originally included that code in this package directly, I found +% several occasions where I wanted units but not the rest of the math +% code. Therefore, units are in a separate package, and the option +% now just reminds the user to input that package by itself. +% \begin{macrocode} +\DeclareOption{units}{% + \PackageWarning{cjwmath}% + {Obsolete option \CurrentOption. Use package `cjwunits' instead.}} +% \end{macrocode} +% Finally, there is a default option, to warn about unknown options, +% and the passed option list is processed. +% \begin{macrocode} +\DeclareOption*{% + \PackageWarning{cjwmath}{Unknown option `\CurrentOption'}} +\ProcessOptions +% \end{macrocode} +% +% This package depends upon the previous one. +% \begin{macrocode} +\RequirePackage{cjwmacro} +% \end{macrocode} +% It also uses the AMS fonts, for which we require \pkg{amssymb}, +% which itself requires \pkg{amsfonts}. +% \begin{macrocode} +\RequirePackage{amssymb} +% \end{macrocode} +% Just in case things get screwy in \pkg{cjwmacro}---which they +% shouldn't, we explicitly require \pkg{amstext} here, too, for the +% \cseq{text} command. +% \begin{macrocode} +\RequirePackage{amstext} +% \end{macrocode} +% I much prefer the following package to AMS's own blackboard bold +% font. +% \begin{macrocode} +\RequirePackage{bbm} +% \end{macrocode} +% If the \pkg{amsmath} option is specified, we load the package (which +% itself brings in a lot of other stuff). +% \begin{macrocode} +\if@amsmath + \RequirePackage{amsmath} +\fi +% \end{macrocode} +% +% \subsection{Miscellaneous macros} +% +% Here is a package command which I have written to cover the +% shortcomings of AMS-\LaTeX's |\DeclareNewMathOperator| command. In +% particular, I would like to be able to set different fonts for some +% operators. The syntax is +% \begin{display}{l} +% |\NewMathOp*[|\meta{font}|]{\cs}{|\meta{text}|}| +% \end{display} +% The optional star makes an operator with limits. The \meta{font} +% is, by default, |\operator@font|. |\cs| is the name of the new +% mathop. \meta{text} should be the printed version of the operator, +% but may also include, for example, extra kerning information, as in +% \begin{display}{l} +% |\NewMathOp[\mathfrak]{\so}{o\kern 0pt}| +% \end{display} +% The command should produce something robust. +% \begin{macrocode} +\DeclareRobustCommand{\NewMathOp}{% + \@ifstar{\@makenewop{\displaylimits}} + {\@makenewop{\nolimits}}} +% \end{macrocode} +% The first iteration applies a font if the optional argument is not +% given. +% \begin{macrocode} +\def\@makenewop#1{% + \@ifnextchar [{\@@makenewop{#1}} + {\@@makenewop{#1}[\operator@font]}} +% \end{macrocode} +% Finally, the net operator itself is declared robustly. The +% arguments are, in order, either |\displaylimits| or |\nolimits|, the +% font, the control sequence, and the operator text. +% \begin{macrocode} +\def\@@makenewop#1[#2]#3#4{% + \DeclareRobustCommand{#3}{% + \mathop{\kern\z@{#2{#4}}}#1}} +% \end{macrocode} +% +% The next few macros have to do with things not specific to any +% particular flavor of mathematics. For example, I like some of the +% alternate Greek characters more than the originals---notice how we +% cleverly required the \pkg{cjwmacro} package which gives us the +% \cseq{swapdef} command. +% \begin{macrocode} +\swapdef{\epsilon}{\varepsilon} +% \swapdef{\theta}{\vartheta} +\swapdef{\rho}{\varrho} +% \end{macrocode} +% I also like the empty set symbol from AMS, to which I also assign a +% German alias. +% \begin{macrocode} +\swapdef{\nothing}{\varnothing} +\alias\leer\nothing +% \end{macrocode} +% The standard symbols `$\exists$' and `$\forall$' do not have +% satisfactory spacing, in my opinion, so I redefine them as +% relations. Notice the aliasing so that the symbols' redefinition +% can be carried out regardless of current math fonts. +% \begin{macrocode} +\alias\@@exists\exists + \renewcommand{\exists}{\mathrel{\@@exists}} +\alias\@@forall\forall + \renewcommand{\forall}{\mathrel{\@@forall}} +% \end{macrocode} +% What \LaTeX{} cleverly calls \cseq{ni} (a backwards `$\in$') really +% ought to mean `such that,' hence I rename it: +% \begin{macrocode} +\newcommand{\st}{\mathrel{\ni}} +% \end{macrocode} +% Being essentially lazy, I also prefer to make a nice control +% sequence for some standard abbreviations. One happens to be +% German (since in German it is more acceptable to use abbreviations +% of long phrases even in a more formal setting). +% \begin{macrocode} +\newcommand{\WLOG}{Without loss of generality\xspace} +\newcommand{\Wlog}{without loss of generality\xspace} +\newcommand{\obda}{o.B.d.A.\xspace} +\newcommand{\fp}{floating-point\xspace} +% \end{macrocode} +% The following two commands are simply for phantoms I often find +% myself using, for example to make alignments in arrays and matrices +% come out right. The mnemonic is `phantom negative' or `phantom equals'. +% \begin{macrocode} +\newcommand{\pneg}{\phantom{-}} +\newcommand{\peq}{\phantom{=}} +% \end{macrocode} +% Going probably too far into the realm of generalization, here are +% some macros to set their arguments inside matching scaled delimiters +% of various sorts. +% \begin{macrocode} +\newcommand{\anglebrackets}[1]{% + \left\langle #1 \right\rangle} +\newcommand{\curlybrackets}[1]{% + \left\{ #1 \right\}} +\newcommand{\squarebrackets}[1]{% + \left[ #1 \right]} +\newcommand{\vertbrackets}[1]{% + \left| #1 \right|} +\newcommand{\Vertbrackets}[1]{% + \left\| #1 \right\|} +% \end{macrocode} +% And now for something completely different---sometimes an operand +% should be left generic, but not in terms of a variable. The usual +% way of accomplishing this is to place a small dot where the argument +% would otherwise go. As I consider this to imply `no argument', the +% command is |\noarg|. +% \begin{macrocode} +\newcommand{\noarg}{\,\cdot\,} +% \end{macrocode} +% We end with a few things that should be fairly obvious. +% \begin{macrocode} +\newcommand{\ee}[1]{\times10^{#1}} +\newcommand{\half}{\sfrac12} +\newcommand{\ninfty}{-\infty} +% \end{macrocode} +% This is shorthand for function definitions, including an extra +% control sequence for some backwards compatibility and an alias to +% German. +% \begin{macrocode} +\newcommand{\fcn}[2]{\colon{#1}\rightarrow{#2}} + \newcommand{\mapping}[3]{{#1}\fkt{#2}{#3}} +\alias\fkt\fcn +% \end{macrocode} +% Restrictions of functions: +% \begin{macrocode} +\newcommand{\restr}[2][\big]{\kern -.1em #1|_{#2}} +% \end{macrocode} +% +% +% \subsection{Combinatorics} +% +% The binomial coefficient $\choose{n}{k}$ is defined, depending on +% whether or not AMS-\LaTeX{} is being used. +% \begin{macrocode} +\if@amsmath + \realias\choose\binom +\else + \renewcommand{\choose}[2]{{{#1}\atopwithdelims(){#2}}} +\fi +% \end{macrocode} +% And lastly, we have the combinatorial doohickie which is read as +% `$n$ multichoose $k$', using doubled parentheses as delimiters. I +% think this comes out looking right. +% \begin{macrocode} +\newcommand{\mchoose}[2]{% + \mathchoice% + {\left(\kern-0.48em\choose{#1}{#2}\kern-0.48em\right)} + {\left(\kern-0.30em + \choose{\smash{#1}}{\smash{#2}}\kern-0.30em\right)} + {\left(\kern-0.30em + \choose{\smash{#1}}{\smash{#2}}\kern-0.30em\right)} + {\left(\kern-0.30em + \choose{\smash{#1}}{\smash{#2}}\kern-0.30em\right)} + } +% \end{macrocode} +% There is also the old-fashioned $\Comb{n}{k}$-type notation, as used +% both in English and in German. +% \begin{macrocode} +\newcommand{\Comb}[2]{% % C + {}_{#1}{\operator@font C}_{#2}} % #1 #2 +\newcommand{\Komb}[2]{% % #2 + {\operator@font Ko}_{#1}^{#2}} % Ko +\newcommand{\Kombun}[2]{\Komb{#1,\neq}{#2}} % #1 +\newcommand{\Perm}[2]{% % #2 + {\operator@font Pe}_{#1}^{#2}} % Pe +\newcommand{\Permun}[2]{\Perm{#1,\neq}{#2}} % #1 +% \end{macrocode} +% +% \subsection{Sets} +% +% The most important macro in this section is named, of course, +% |\set|. The idea is to make sets which look like +% \begin{displaymath} +% \set{x \in \R^2}{\norm{x}_p = 1 \forall p = 1,2,3,\ldots}. +% \end{displaymath} +% That is, there should be scaled braces around two halves separated +% by a scaled logical delimiter, the vertical bar. The problem with +% this is getting everything the same height, since the $\mid$ +% specifier does not scale and there is no middle-counterpart to +% |\left|\dots|\right|. +% +% So, the command has the form: +% \begin{display}{l} +% |\set[|\meta{mid}|]{|\meta{left}|}{|\meta{right}|}| +% \end{display} +% The optional \meta{mid} specifies an alternate delimiter to use +% between the two definition halves of the set. If it is left +% \emph{empty}, the null delimiter `.' will be assumed. If anything +% at all appears in the optional argument, though, the first token +% \emph{must} be a delimiter, as it will immediately be preceded by a +% sizing macro. For example, if you wish to use a colon to separate +% the definitions, use `|[.:]|' as the optional argument. The +% mandatory \meta{left} and \meta{right} are simply the halves of the +% set definition. +% \begin{macrocode} +\newcommand{\set}[3][|]{{% + \newdimen\@tempdimd% +% \end{macrocode} +% Each half is set in its own box, then the larger of the respective +% heights and depths are determined. +% \begin{macrocode} + \setbox0=\mathbox{#2}\@tempdima=\ht0 \@tempdimb=\dp0% + \setbox0=\mathbox{#3}\@tempdimc=\ht0 \@tempdimd=\dp0% + \ifdim\@tempdimc > \@tempdima + \@tempdima=\@tempdimc + \fi + \ifdim\@tempdimd > \@tempdimb + \@tempdimb=\@tempdimb + \fi +% \end{macrocode} +% We create an invisible rule with that height and depth, and make +% sure we have a valid delimiter if the optional argument is empty. +% \begin{macrocode} + \def\@tempa{\vrule width0pt height\@tempdima depth\@tempdimb} + \def\@tempb{#1} + \ifx\@empty\@tempb + \def\@tempb{.} + \fi +% \end{macrocode} +% Finally, we use a null left delimiter to balance the middle +% delimiter, and then a left brace to balance the right brace. The +% rule is set inside both pairs so that they scale identically. Note +% the use of |\expandafter| so that when the first |\right| is +% expanded, it can grab the delimiter in |\@tempb|. +% \begin{macrocode} + \left.\left\{ \@tempa{#2} \,\expandafter\right\@tempb\,{#3} \right\} }} +% \end{macrocode} +% For backwards compatibility, I make two aliases for |\set|; the old +% commands required the user to specify the larger side of the set +% definition in order to get sizing correct. +% \begin{macrocode} +\alias\setl\set +\alias\setr\set +% \end{macrocode} +% +% Here are some macros for typesetting sets symbolically. First off, +% we might want to know how to typeset a level set. +% \begin{macrocode} +\newcommand{\lvl}[2][\alpha]{\Gamma\ssb{#2}\ssp{(#1)}} +% \end{macrocode} +% There are also fuzzy sets, and their corresponding level sets. +% \begin{macrocode} +\if@amsmath + \newcommand{\fset}[1]{\Tilde{#1}} +\else + \newcommand{\fset}[1]{\tilde{#1}} +\fi +\newcommand{\flvl}[2][\alpha]{\lvl[#1]{\fset{#2}}} +% \end{macrocode} +% For want of a better font, I will typeset set collections +% in |\mathcal|. +% \begin{macrocode} +\alias\coll\mathcal +% \end{macrocode} +% +% Finally, we deal with some set operators. +% \emph{The \TeX{}book} points out the difference between |\setminus| +% and |\backslash|. I prefer to think of them as `set +% complementation' and `coset', respectively. +% \begin{macrocode} +\alias\scomp\setminus +\alias\coset\backslash +% \end{macrocode} +% The next macro attempts to create a symmetric difference operator. +% I don't like it, but I probably won't do better until I learn to +% make my own \textsf{M{\small ETAFONT}} characters\ldots +% \begin{macrocode} +\newcommand{\symmdiff}{% + \mathbin{\text{\footnotesize$\bigtriangleup$}}} +% \end{macrocode} +% +% +% \subsection{Sequences and series} +% +% Just a few macros are required for various sequences and series, +% mostly for indexing. The best explanation is simply an example. +% The code +% \begin{display}{l} +% |$y \in \seq{x_{ij}}$, where $i\inset{n}$, $j\inrange[0]{m}$| +% \end{display} +% produces +% \begin{display}{l} +% $y \in \seq{x_{ij}}$, where $i\inset{n}$, $j\inrange[0]{m}$. +% \end{display} +% +% \begin{macrocode} +\newcommand{\seq} [1] {\curlybrackets{#1}} +\newcommand{\inset} [2][1]{\in\{ #1,\ldots,#2 \}} +\newcommand{\inrange}[2][1]{ = #1,\ldots,#2} +% \end{macrocode} +% +% +% \subsection{Calculus} +% +% The calculus macros are relegated to auxiliary files, as I rarely +% need them. +% +% \subsubsection{Derivatives} +% +% We load the derivatives in if they are requested. +% \begin{macrocode} +\if@derivatives + \InputIfFileExists{cjwderiv.tex}{}{% + \PackageWarning{cjwmath}{Option `cjwderiv.tex' not found.} + \@@derivativesfalse} +\fi +% \end{macrocode} +% This loads both simple and partial derivative macros. +%\iffalse +%</math> +%<*deriv> +%\fi +% +% The derivatives are all variations on the basic |\dd| macro, which +% should be fairly self explanatory. +% \begin{macrocode} +\newcommand{\dd} [2]{\frac{d#1}{d#2}} +\newcommand{\ddt}[1]{\dd{#1}{t}} +\newcommand{\ddu}[1]{\dd{#1}{u}} +\newcommand{\ddv}[1]{\dd{#1}{v}} +\newcommand{\ddx}[1]{\dd{#1}{x}} +\newcommand{\ddy}[1]{\dd{#1}{y}} + +\newcommand{\sdd} [2]{\frac{d^2#1}{d#2^2}} +\newcommand{\sddx}[1]{\sdd{#1}{x}} +\newcommand{\sddy}[1]{\sdd{#1}{y}} +\newcommand{\sddt}[1]{\sdd{#1}{t}} +\newcommand{\sddu}[1]{\sdd{#1}{u}} +\newcommand{\sddv}[1]{\sdd{#1}{v}} +% \end{macrocode} +% +% \subsubsection{Partial derivatives} +% +% The partial derivatives are all variations on the theme of |\pard|, +% which is as |\dd|, replacing the $d$ with $\partial$. +% \begin{macrocode} +\newcommand{\pard} [2]{\frac{\partial#1}{\partial#2}} +\newcommand{\pardx}[1]{\pard{#1}{x}} +\newcommand{\pardy}[1]{\pard{#1}{y}} +\newcommand{\pardz}[1]{\pard{#1}{z}} +\newcommand{\pardu}[1]{\pard{#1}{u}} +\newcommand{\pardv}[1]{\pard{#1}{v}} +\newcommand{\pardt}[1]{\pard{#1}{t}} + +\newcommand{\spard} [2]{\frac{\partial^2#1}{\partial#2^2}} +\newcommand{\spardx}[1]{\spard{#1}{x}} +\newcommand{\spardy}[1]{\spard{#1}{y}} +\newcommand{\spardz}[1]{\spard{#1}{z}} +\newcommand{\spardu}[1]{\spard{#1}{u}} +\newcommand{\spardv}[1]{\spard{#1}{v}} +\newcommand{\spardt}[1]{\spard{#1}{t}} + +\newcommand{\spardxy}[1]{\frac{\partial^2#1}{\partial x\partial y}} +\newcommand{\spardyx}[1]{\frac{\partial^2#1}{\partial y\partial x}} +\newcommand{\spardxz}[1]{\frac{\partial^2#1}{\partial x\partial z}} +\newcommand{\spardzx}[1]{\frac{\partial^2#1}{\partial z\partial x}} +\newcommand{\spardyz}[1]{\frac{\partial^2#1}{\partial y\partial z}} +\newcommand{\spardzy}[1]{\frac{\partial^2#1}{\partial z\partial y}} +% \end{macrocode} +%\iffalse +%</deriv> +%<*math> +%\fi +% +% \subsubsection{Integrals} +% +% We load the integrals in if they are requested. +% \begin{macrocode} +\if@integrals + \InputIfFileExists{cjwinteg.tex}{}{% + \PackageWarning{cjwmath}{Option `cjwinteg.tex' not found.} + \@@integralsfalse} +\fi +% \end{macrocode} +%\iffalse +%</math> +%<*integ> +%\fi +% +% The first macro is simply a variation of |\int| using the |\limits| +% macro. +% \begin{macrocode} +\def\integ{\mathop{\int}\limits} +% \end{macrocode} +% Next we have a small shortcut for the differential at the end of an +% integral. We work around \LaTeX's font encoding macro. +% \begin{macrocode} +\alias\latex@d\d + \renewcommand{\d}{\,d} +% \end{macrocode} +% We have macros for double and triple integrals, with and without +% |\limits|. +% \begin{macrocode} +\newcommand{\dint}{\int\!\!\!\int} +\newcommand{\dinteg}{\mathop{\int\!\!\!\int}\limits} +\newcommand{\tint}{\int\!\!\!\int\!\!\!\int} +\newcommand{\tinteg}{\mathop{\int\!\!\!\int\!\!\!\int}\limits} +% \end{macrocode} +% To be honest, I have no idea why I wrote this one. It is probably +% buried in a homework file of mine somewhere, but I'll be a fiddler +% crab if I can remember where\dots +% \begin{macrocode} +\newcommand{\flushintlim}[1]{{\phantom{#1} #1}} +% \end{macrocode} +%\iffalse +%</integ> +%<*math> +%\fi +% +% \subsection{Algebra} +% +% We define how to typeset an algebra. +% \begin{macrocode} +\alias\alg\mathbbm +% \end{macrocode} +% +% \subsubsection{Fields} +% +% A field will also be done in blackboard bold. +% \begin{macrocode} +\alias\field\mathbbm +% \end{macrocode} +% The following fields are defined. +% \begin{macrocode} +\newcommand{\C}{\field{C}} % Complex +\newcommand{\E}{\field{E}} % Euclidean (also Evens) +% \end{macrocode} +% Note that $\H$ is a \LaTeX{} accent, so we save it away before +% redefining it as a field. +% \begin{macrocode} +\alias\latex@H\H % Quaternions + \renewcommand{\H}{\field{H}} % (Hamiltonian field) +\newcommand{\N}{\field{N}} % Natural numbers +\newcommand{\Q}{\field{Q}} % Rationals +\newcommand{\R}{\field{R}} % Reals +% \newcommand{\Rn}[1][n]{\R^{#1}} +\newcommand{\Z}{\field{Z}} % Integers +\newcommand{\pr}{\field{P}} % Primes +% \end{macrocode} +% +% \subsubsection{Groups} +% +% Remember |\NewMathOp|? One use for it is in defining mathematical +% groups. Here are a bunch. +% \begin{macrocode} +% Groups are typeset as operators. +\NewMathOp {\Aut}{Aut} % Automorphisms +\NewMathOp {\End}{End} % Endomorphisms +\NewMathOp {\GL}{GL} % General Linear +\NewMathOp {\Inn}{Inn} % Inner products +\NewMathOp {\Pin}{Pin} % Pin +\NewMathOp {\SL}{SL} % Special Linear +\NewMathOp {\SO}{SO} % Special Orthogonal +\NewMathOp {\SU}{SU} % Special Unitary +\NewMathOp[\mathfrak]{\Sn}{S} % Symmetric +\NewMathOp {\Spin}{Spin} % Spin +\NewMathOp {\Sp}{Sp} % Symplectic +\NewMathOp {\Unit}{U\kern 0pt}% Unitary +\NewMathOp {\Orth}{O\kern 0pt}% Orthogonal +\NewMathOp[\mathfrak]{\slin}{sl} % Tangent group to SL +\NewMathOp[\mathfrak]{\so}{o\kern 0pt} % skew orthogonal +\NewMathOp[\mathfrak]{\sp}{sp} % skew symplectic +\NewMathOp[\mathfrak]{\su}{u\kern 0pt} % skew hermitian +% \end{macrocode} +% +% \subsubsection{Linear algebra} +% +% If matrices are to be typeset specially, we will use the |\mathcal| font. +% \begin{macrocode} +\alias\mtx\mathcal +% \end{macrocode} +% I have often seen the letter $\Theta$ used for the matrix of zeros. +% I like it that way. +% \begin{macrocode} +\newcommand{\nullmtx}{\mtx\Theta} +% \end{macrocode} +% Taken from Horn and Johnson, a matrix norm can be represented with a +% triple-bar delimiter. +% \begin{macrocode} +\newcommand{\mnorm}[1]{% + \left\vert\kern-0.9pt\left\vert\kern-0.9pt\left\vert #1 + \right\vert\kern-0.9pt\right\vert\kern-0.9pt\right\vert} +% \end{macrocode} +% We define the Lie product of two matrices. +% \begin{macrocode} +\newcommand{\lie}[1]{\squarebrackets{#1}} +% \end{macrocode} +% There is an for the trace (Spur, auf Deutsch) of a matrix\dots +% \begin{macrocode} +\NewMathOp{\Spur}{Spur} +\NewMathOp{\Tr}{Tr} +% \end{macrocode} +% \dots as well as for diagonal matrices. +% \begin{macrocode} +\NewMathOp{\Diag}{Diag} +% \end{macrocode} +% +% This is a shortcut for putting delimiters around matrices. With +% AMS-\LaTeX, we use an environment, taking as its two mandatory +% arguments the left and right delimiters, respectively. +% \begin{macrocode} +\if@amsmath + \newenvironment{arbmatrix}[2]% + {\def\@tempa{#2}\left#1 \matrix}{\endmatrix \right\@tempa} +% \end{macrocode} +% Without AMS, we use a command as does standard \LaTeX, and define +% some basic types. +% \begin{macrocode} +\else + \newcommand{\arbmatrix}[3]{\left#1 \matrix{#2} \right#3} + \providecommand{\bmatrix}[1]{\arbmatrix[{#1}]} + \providecommand{\vmatrix}[1]{\arbmatrix|{#1}|} +\fi +% \end{macrocode} +% +% The next bit of code is used to enter sparse matrices which are +% often represented in the literature with an oversized zero marking +% the region of zeros. This takes more than a bit of trickery in +% \LaTeX. The oversized digit will be put in a box, which in most +% cases needs horizontal and/or vertical adjustment from the position +% where it is placed in the matrix by default. The default vertical +% offset will be called |\numoffset|, and is set by default to the +% height of a |\Bigmathstrut|. +% \begin{macrocode} +\newlength{\numoffset} +{\setbox0=\hbox{$\Bigmathstrut$} + \@tempdima=0.8\ht0\relax + \global\numoffset\@tempdima} +% \end{macrocode} +% Occasionally, one might wish to use something other than a zero as +% the oversized digit. We define a generic |\Number| macro to be +% used. The usage is +% \begin{display}{l} +% |\Number|\oarg{raise}\marg{num} +% \end{display} +% where \meta{raise} is the amount by which the number is raised and +% \meta{num} is the number to be used. +% \begin{macrocode} +\newcommand{\Number}[2][-\numoffset]{% + \@tempdima=#1\relax + \smash{\hbox{\raise\@tempdima\@bignumber{#2}}}} +% \end{macrocode} +% The macros |\@bignumber| is called to do the dirty work of +% typesetting the number. +% \begin{macrocode} +\newcommand{\@bignumber}[1]{\hbox{\LARGE$#1$}} +% \end{macrocode} +% Now, the horizontal adjustment mentioned earlier usually refers to +% the need to have the large digit straddle two columns in a matrix. +% This is easily accomplished with |\multicolumn|. Here things start +% to get ugly, though; |\multicolumn| must be the first thing after +% the |&| in the array. But the reasonable way to include an optional +% argument to be passed through to |\Number| is to use the +% |\newcommand| feature, which ends up putting junk in the way---this +% is exactly the same problem which arose in writing |\mathbox| +% earlier. Therefore, there are currently two separate commands, one +% which takes the optional argument, and one which doesn't. I would +% really like to remedy this if I ever figure out how. +% \begin{macrocode} +\def\bignumber #1{\multicolumn{2}{c}{\Number{#1}}} +\def\Bignumber[#1]#2{\multicolumn{2}{c}{\Number[#1]{#2}}} +% \end{macrocode} +% Here are some specific cases for using zero, as is most commonly the +% case. +% \begin{macrocode} +\newcommand{\Zero}[1][-\numoffset]{\Number[#1]{0}} +\def\bigzero {\bignumber{0}} +\def\Bigzero[#1]{\Bignumber[#1]{0}} +% \end{macrocode} +% +% From this we wish to construct various types of matrices. Each +% variation will have two versions, depending on whether or not +% AMS-\LaTeX{} has been invoked. Each version, though, has an +% optional argument which is what will be passed through as +% \meta{raise} to |\Bigzero|. The names of each matrix are an attempt +% to indicate the layout. For example, the command |\iidiagi| takes +% three mandatory arguments which will be the diagonal entries, the +% first two in the upper left, and the third in the lower right with +% |\ddots| separating them. Likewise, we have |\idiagii| and +% |\idiagi|. +% \begin{macrocode} +\if@amsmath + \newcommand{\iidiagi}[4][-\numoffset]{% % 2 0 + \begin{bmatrix} % 3 + #2 & & \Bigzero[#1] \\ % . + & #3 & & \\ % . + \Bigzero[#1] & \ddots & \\ % 0 4 + & & & #4 + \end{bmatrix}} + \newcommand{\idiagii}[4][-\numoffset]{% % 2 0 + \begin{bmatrix} % . + #2 & & \Bigzero[#1] \\ % . + & \ddots & & \\ % 3 + \Bigzero[#1] & #3 & \\ % 0 4 + & & & #4 + \end{bmatrix}} + \newcommand{\idiagi}[3][-1.2pt]{% % 2 0 + \begin{bmatrix} % . + #2 & \Bigzero[#1] \\ % . + & \ddots & \\ % . + \Bigzero[#1] & #3 % 0 3 + \end{bmatrix}} +\else + \newcommand{\iidiagi}[4][-\numoffset]{% % 2 0 + \matrix{% % 3 + #2 & & \Bigzero[#1] \\ % . + & #3 & & \\ % . + \Bigzero[#1] & \ddots & \\ % 0 4 + & & & #4}} + \newcommand{\idiagii}[4][-\numoffset]{% + \pmatrix{% % 2 0 + #2 & & \Bigzero[#1] \\ % . + & \ddots & & \\ % . + \Bigzero[#1] & #3 & \\ % 3 + & & & #4}} % 0 4 + % + \newcommand{\idiagi}[3][-1.2pt]{% % 2 0 + \pmatrix{% % . + #2 & \Bigzero[#1] \\ % . + & \ddots & \\ % . + \Bigzero[#1] & #3}} % 0 3 +\fi +% \end{macrocode} +% +% We now wish to typeset the transpose of a matrix. The most general +% form is +% \begin{display}{l} +% |\@trans|\oarg{pre}\marg{post} +% \end{display} +% which expands to `|^{|\meta{pre}|t|\meta{post}|}|'. Next is +% |\trans| which takes a single optional argument for \meta{post} (no +% \meta{pre}). +% \begin{macrocode} +\newcommand{\@trans}[2][]{^{#1\text{\normalfont\textsf{t}}#2}} +\newcommand{\trans} [1][]{\@trans[]{#1}} +% \end{macrocode} +% Why? I don't know---I needed |\trinv|, below, and decided to +% generalize. +% \begin{macrocode} +\newcommand{\trinv} {\@trans[-]{}} +% \end{macrocode} +% For backwards compatibility, I have |\ct|\marg{mtx} to represent +% matrix \meta{mtx} as conjugated and transposed. +% \begin{macrocode} +\newcommand{\ct}[1]{\conj{#1}\trans} +% \end{macrocode} +% +% The next topic is vectors. I prefer |\vec| to be logical markup as +% opposed to a specific accent. Thus, I create an alias |\sarvec| +% (short arrow vector) for the original |\vec|, and another alias +% |\arvec| for a long arrow, which is just |\overrightarrow|. +% \begin{macrocode} +\alias\sarvec\vec +\alias\arvec \overrightarrow +% \end{macrocode} +% The actual typesetting I prefer for vectors (when I use anything at +% all) is boldface. This requires the |\Mathbox| command defined +% earlier so that the argument can be set in a bold math version. +% \begin{macrocode} +\renewcommand{\vec}[1]{\Mathbox{\boldmath}{#1}} +% \end{macrocode} +% To typeset vectors in long form simply uses the |\matrix| +% command---but this depends, again, on whether AMS-\LaTeX{} is being +% used. In either case, a single argument---the contents of the +% vector---is required. Simply delimit with |\\| for column vectors +% and |&| for rows. +% \begin{macrocode} +\if@amsmath + \newcommand{\bvec}[1]{% + \begin{bmatrix}#1\end{bmatrix}} + \newcommand{\pvec}[1]{% + \begin{pmatrix}#1\end{pmatrix}} +% \end{macrocode} +% There are also two aliases for row vectors for backwards +% compatibility. +% \begin{macrocode} + \alias\brvec\bvec + \alias\prvec\pvec +\else + \newcommand{\bvec}[1]{\bmatrix{#1}} + \newcommand{\pvec}[1]{\pmatrix{#1}} +% \newcommand{\bvec}[2][r]{% +% \left[ \begin{array}{#1}#2\end{array} \right]} +% \newcommand{\pvec}[2][r]{% +% \left( \begin{array}{#1}#2\end{array} \right)} +\fi +% \end{macrocode} +% The null vector, like the null matrix, is given with $\theta$. +% \begin{macrocode} +\newcommand{\nullvec}{\vec{0}} +% \end{macrocode} +% Once we have vectors, we need dot products. The simple version just +% puts its argument inside angled brackets. +% \begin{macrocode} +\newcommand{\dotp}[1]{\anglebrackets{#1}} +% \end{macrocode} +% If special vector notation is required, the two arguments should be +% separated by a comma (which should be the case anyway), and then +% each half is passed to |\vec|. +% \begin{macrocode} +\newcommand{\vdotp}[1]{\@vdotp#1@@@} +\def\@vdotp #1,#2@@@{\dotp{\vec #1,\vec #2}} +% \end{macrocode} +% +% We define some other vector operators to go with the dot product. +% These are the curl, the divergence, and the Laplacian. These are +% usually read as `del dot', `del cross', and `del squared', so the +% first thing to do is rename the |\nabla|(?). +% \begin{macrocode} +\newcommand{\del} {\vec\nabla} +% \end{macrocode} +% \LaTeX{} defines |\div|, so we rename that and renew the command. +% \begin{macrocode} +\alias\@@div\div +\renewcommand{\div}{\del\dot} +% \end{macrocode} +% Finally, we have the other two. +% \begin{macrocode} +\newcommand{\curl} {\del\cross} +\newcommand{\lapl} {\del^2} +% \end{macrocode} +% +% In German texts, the linear hull is usually represented as a list of +% vectors in square brackets. +% \begin{macrocode} +\alias\huelle\squarebrackets +% \end{macrocode} +% +% \subsection{Operators} +% +% This section is simply a gathering point for all sorts of +% mathematical operators---not in the |\NewMathOp| sense, like various +% groups defined above, but in the sense of mathematical doohickies +% which take one or two operands and give you something new. +% +% \subsubsection{Binary operators} +% +% What we have first is a whole bunch of names for the large, `x'-like +% times symbol. In the case of specifying dimension (as in, a 4-by-3 +% matrix), we declare it a |\mathord| so as not to invoke binary +% spacing. Then |\mal| is simply German for `times', and |\cross| is +% the vector space (or group) product using the same symbol. +% \begin{macrocode} +\newcommand{\by}{\mathord{\times}} +\alias\mal \times +\alias\cross \times +% \end{macrocode} +% To indicate isomorphism, I have most often used an equals sign with +% a tilde above it. +% \begin{macrocode} +\alias\iso \simeq +% \end{macrocode} +% This next one stretches the usefulness of aliasing by defining an +% operator for normal subgroups. +% \begin{macrocode} +\alias\nsubgrp \trianglelefteq +% \end{macrocode} +% Next we specify a congruence symbol. +% \begin{macrocode} +\realias\cong \equiv +% \end{macrocode} +% In graph theory, we want a symbol for adjacency of nodes. +% \begin{macrocode} +\alias\adj\leftrightarrow +% \end{macrocode} +% We unconditionally define |\Box| to be a square operator symbol. +% \begin{macrocode} +\providecommand{\Box}{} +\renewcommand{\Box}{\mathbin{\square}} +% \end{macrocode} +% We give a number theoretic division relation, in English and +% German. +% \begin{macrocode} +\newcommand{\teilt}{\mathbin{|}} + \alias\divides\teilt +% \end{macrocode} +% Once upon a time I wanted a `big dot' operator. +% \begin{macrocode} +% \newcommand{\bdot}{\mathop{\lower0.33ex\hbox{\LARGE$\cdot$}}} +% \end{macrocode} +% We can use \LaTeX's built-in |\stackrel| to create a definition +% relation. +% \begin{macrocode} +\newcommand{\defeq}{\stackrel{\text{def}}{=}} +% \end{macrocode} +% The symbol I first saw used to indicate disjoint union was a union +% `cup' with a bar through the middle. Using a naming convention +% similar to AMS-\LaTeX's |\Uplus| we get text and display versions. +% \begin{macrocode} +\newcommand{\uminus}{% + \,\,{\mathbin{\cup\kern-.6em{\raise.05em% + \hbox{-\negthinspace-\kern-.25em-}}}}\,\,} +\newcommand{\Uminus}{% + \mathop{\bigcup\kern-0.9em{\raise.05em% + \hbox{-\negthinspace-\kern-.25em-}}}} +% \end{macrocode} +% We define some handy names for various arrows. +% \begin{macrocode} +\providecommand{\implies}{\;\Longrightarrow\;} + \alias\then\implies +\if@amsmath + \newcommand{\when}{\DOTSB \;\Longleftarrow \;} +\else + \newcommand{\when}{\;\Longleftarrow \;} +\fi +% \end{macrocode} +% The following can be used when tracing a series of implications +% through a multiline equation environment, for example. +% \begin{macrocode} +\newcommand{\limplies}{\llap{$\implies$}\quad} +% \end{macrocode} +% Based on \emph{The \TeX{}book}, I have written a `skewed' fraction, +% which uses a diagonal separator. +% \begin{macrocode} +\newcommand{\sfrac}[2]{% + \hbox{\kern 0.1em% + \raise 0.5ex\hbox {\scriptsize$#1$}% + \kern -0.1em $/$% + \kern -0.15em% + \lower 0.25ex\hbox {\scriptsize$#2$}}% + \kern 0.2em} +% \end{macrocode} +% If we are not using AMS-\LaTeX, the following well not yet be +% defined. +% \begin{macrocode} +\providecommand{\tfrac}{\sfrac} +\providecommand{\dfrac}[2]{{{#1}\over{#2}}} +% \end{macrocode} +% +% +% \subsubsection{Unary operators} +% +% I most often use the longer versions of various math accents, so I +% redefine them by default to be long. The short ones are saved in a +% macro with identical name save for a prepended `s' (as we have +% already seen for |\arvec| and |\sarvec|). The simple ones are bars, +% tildes, and hats. +% \begin{macrocode} +\alias\sbar\bar + \renewcommand{\bar}[1]{\overline{#1}} +\alias\stilde\tilde + \alias\retilde\widetilde +\alias\shat\hat + \realias\hat\widehat +% \end{macrocode} +% We need something better than the default real- and imaginary-part +% macros. +% \begin{macrocode} +\renewcommand{\Im}{% + \mathop{\mathfrak{Im}}} +\renewcommand{\Re}{% + \mathop{\mathfrak{Re}}} +% \end{macrocode} +% Complex conjugation is usually denoted by a bar. +% \begin{macrocode} +\alias\conj \bar +% \end{macrocode} +% Inversion of various types is used often enough to warrant a control +% sequence. +% \begin{macrocode} +\newcommand{\inv}{^{-1}} +% \end{macrocode} +% To denote power sets, I have used to different alternatives. The +% default is the standard |\wp| symbol---I don't know what it is +% supposed to be used for, but it can be modified for the task. On +% the other hand, if we have a real math script font (as one might +% have if using my \pkg{callig} style\dots) we will certainly use +% that. +% \begin{macrocode} +\@ifundefined{mathscript} + {\newcommand{\Pow}{\raise 0.4ex\Mathbox{\Large}{\wp}}} + {\NewMathOp[\mathscript]{\Pow}{P}} +% \end{macrocode} +% And what macro would be complete without a German alias? (Auf +% Deutsch, die Potenzmenge.) +% \begin{macrocode} +\alias\Pot\Pow +% \end{macrocode} +% We can leave the letter `\/I\/' to computer scientists who don't +% know how to write an indicator function. For our purposes, we want +% the neat-o-keen blackboard bold font. +% \begin{macrocode} +\newcommand{\1}{\mathbbm{1}} +% \end{macrocode} +% +% Next we have some trigonometric shortcuts. +% \begin{macrocode} +\alias\acos\arccos +\alias\asin\arcsin +\alias\atan\arctan +% \end{macrocode} +% Using our generic bracketing macros from earlier, we have absolute +% value, cardinality (order of a set), cyclic generators, and norms. +% \begin{macrocode} +\alias\abs \vertbrackets +\alias\ord \abs +\alias\cyc \anglebrackets +\alias\norm\Vertbrackets +% \end{macrocode} +% +% Multiple sums are recurrent enough (no pun intended \smiley) to get +% macros. We have double sums, triple sums, and $n$-fold sums. +% \begin{macrocode} +\newcommand{\dsum}{\mathop{\sum\sum}\limits} +\newcommand{\tsum}{\mathop{\sum\sum\sum}\limits} +\newcommand{\nsum}{\mathop{\sum\sum\cdots\sum}\limits} +% \end{macrocode} +% +% The next two macros indicate monotone limits, respectively ascending +% (mnemonic `limit up') and descending (you guessed it---`limit +% down'). +% \begin{macrocode} +\NewMathOp*{\ulim}{lim\raise0.4ex\mathbox{\mathord{\smash{\uparrow}}}} +\NewMathOp*{\dlim}{lim\raise0.4ex\mathbox{\mathord{\smash{\downarrow}}}} +% \end{macrocode} +% +% +% Finally we have the miscellany, where we can really go to town with +% |\NewMathOp|! These should be pretty clear, unless you don't do +% math in German, in which case some will be pretty odd. +% \begin{macrocode} +\NewMathOp*{\argmax}{arg\,max} % arg min +\NewMathOp*{\argmin}{arg\,min} % arg min +\NewMathOp {\Aff} {Aff} % Affine hull +\NewMathOp {\Bild} {Bild} % Bild +\NewMathOp {\Cone} {Cone} % Cone +\NewMathOp {\Conv} {Conv} % Convex hull +\NewMathOp {\Core} {Core} % Fuzzy set core +\NewMathOp {\diam} {diam} % diameter +\NewMathOp {\dom} {dom} % Domain +\NewMathOp {\Epi} {Epi} % Epigraph +\NewMathOp*{\esssup}{ess\,sup} % Essential supremum +\NewMathOp {\fl} {fl} % float-point +\NewMathOp {\ggT} {ggT} % ggT +\NewMathOp {\Grad} {Grad} % Grad +\NewMathOp {\Hypo} {Hypo} % Hypograph +\NewMathOp {\Int} {Int} % Interior +\NewMathOp {\Kern} {Kern} % Kernel +\NewMathOp {\kgV} {kgV} % kgV +\NewMathOp {\Lin} {Lin} % Linear hull +\NewMathOp {\lcm} {lcm} % LCM +\NewMathOp {\Ord} {Ord} % order +\NewMathOp {\proj} {proj} % Projection +\NewMathOp {\Rang} {Rang} % Rang +\NewMathOp {\range} {range} % Range +\NewMathOp {\Rank} {Rank} % Rank +\NewMathOp {\rot} {rot} % Rotation +\NewMathOp {\Span} {Span} % Span +\NewMathOp {\val} {val} % value +% \end{macrocode} +% +% +% \subsection{Physics} +% +% Now, since physics is a subset of mathematics, physics macros are +% invoked from within the math macro file. +% \begin{macrocode} +\if@physics + \InputIfFileExists{cjwphys.tex}{}{% + \PackageWarning{cjwmath}{Option `cjwphys.tex' not found.} + \@@physicsfalse} +\fi +% \end{macrocode} +%\iffalse +%</math> +%<*phys> +%\fi +% +% The only thing really specific to physics that I ever used---meaning +% not applicable in any more general mathematical setting---was the +% bra/ket notation. Here we have bras (br\ae?), kets, and brakets, +% the latter of which bear uncoincidental resemblance to the |\set| +% macro. +% \begin{macrocode} +\newcommand{\bra}[1]{\left\langle #1 \right|\,} +\newcommand{\ket}[1]{\,\left| #1 \right\rangle} + +\newcommand{\braket}[2]{% + \newdimen\@tempdimd% + \setbox0=\mathbox{#1}\@tempdima=\ht0 \@tempdimb=\dp0% + \setbox0=\mathbox{#2}\@tempdimc=\ht0 \@tempdimd=\dp0% + \ifdim\@tempdimc > \@tempdima + \@tempdima=\@tempdimc + \fi + \ifdim\@tempdimd > \@tempdimb + \@tempdimb=\@tempdimb + \fi + \def\@tempa{\vrule width0pt height\@tempdima depth\@tempdimb} + \left.\left\langle \@tempa{#1} \,\right|\,{#2} \right\rangle } +% \end{macrocode} +%\iffalse +%</phys> +%<*math> +%\fi +% +% +% \subsection{Probability} +% +% Here comes that |\NewMathOp| thingie again. First thing is to +% define some standard probabilistic operators, which really need to +% be typeset in an operator font in order not to look horrible. +% \begin{macrocode} +\NewMathOp{\Prob} {P} % Probability operator +\NewMathOp{\Corr} {Corr} % Correlation +\NewMathOp{\Cov} {Cov} % Covariance +\NewMathOp{\Expct}{E} % Expectation +\NewMathOp{\SD} {SD} % Standard Deviation. +\NewMathOp{\Var} {Var} % Variance +% \end{macrocode} +% Here is a macro to put inside of some of those operators where +% conditional events are being considered. +% \begin{macrocode} +\newcommand{\given}{\,|\,} +% \end{macrocode} +% Usually a single tilde, which as an operator bears the name of +% |\sim| in \LaTeX, indicates a distribution. Hence, we make an +% alias. +% \begin{macrocode} +\alias\distrib\sim +% \end{macrocode} +% And coming back to |\NewMathOp|, we define some standard +% distributions\dots +% \begin{macrocode} +\NewMathOp{\Bin} {Bin} % Binary dist. + \newcommand{\Nbin}{-\!\Bin} % Negative Binom. +\NewMathOp{\Exp} {Exp} % Exponential dist. +\NewMathOp{\Geom}{Geom} % Geometric dist. +\NewMathOp{\Norm}{Norm} % Normal dist. +\NewMathOp{\Poi} {Poi} % Poisson dist. +\NewMathOp{\Unif}{Unif} % Uniform dist. +% \end{macrocode} +% \dots and the normal density and distribution functions (which might +% also be represented as $\Phi$ and $\phi$). +% \begin{macrocode} +\NewMathOp[\mathfrak]{\Ndens}{N} +\NewMathOp[\mathfrak]{\Ndist}{n} +% \end{macrocode} +% The last thing to do is create some macros for probabilistic modes +% of convergence. We go, again, from the general to the specific. +% \begin{macrocode} +\NewMathOp*{\@mapsto}{\mapstochar\rightarrow} +\newcommand{\@probconv}[1]{\mathrel{\@mapsto\limits^{1}}} + \newcommand{\asconv}{\@probconv{a.s.}} % Almost sure conv. + \newcommand{\inprob}{\@probconv{P}} % Conv. in probability + \newcommand{\inlaw} {\@probconv{L}} % Conv. in law + \newcommand{\vague} {\@probconv{v}} % Vague conv. +% \end{macrocode} +% +% \iffalse +% +%</math> +% +% \fi +% +% +% \section{Units} +% +% \iffalse +% +%<*units> +% +% \fi +% +% The package \pkg{cjwunits} simply standardizes how to typeset units +% (or dimensions---things such as seconds, meters, and so forth). +% Most of the work is done by defining a pretty simple macro, +% |\unit|. The rest is just a collection of standard units which may +% be invoked (meaning ones I have used, and therefore stuck into the +% file). +% +% \subsection{Package initialization} +% +% The initialization does most everything. We first specify a font +% for the unit types. +% \begin{macrocode} +\newcommand{\unitfont}{\operator@font} +% \end{macrocode} +% Now the workhorse of the package is defined. It is pretty +% foolproof, in that it can be invoked in or out of math, may or may +% not be followed by explicit space, and the font as defined above is +% pretty customizable. +% \begin{macrocode} +\newcommand{\unit}[1]{\ensuremath{\,{\unitfont{#1}\kern\z@}}\xspace} +% \end{macrocode} +% +% Now come the examples. +% +% \subsection{Distance} +% \begin{macrocode} +\newcommand{\ang} {\unit{\AA}} % angstroms + \alias\Ao\ang +\newcommand{\cm} {\unit{cm}} % centimetres +\newcommand{\inch}{\unit{in}} % inches +\newcommand{\km} {\unit{km}} % kilometres +\newcommand{\mi} {\unit{mi}} % miles +\newcommand{\m} {\unit{m}} % metres +% \end{macrocode} +% +% \subsection{Electricity and magnetism} +% +% \begin{macrocode} +\newcommand{\Hz} {\unit{Hz}} % herz +\newcommand{\J} {\unit{J}} % joules +\newcommand{\V} {\unit{V}} % volts +\newcommand{\eV} {\unit{eV}} % electron volts +\newcommand{\erg} {\unit{erg}} % ergs +% \end{macrocode} +% +% \subsection{Mass} +% +% \begin{macrocode} +\newcommand{\amu} {\unit{amu}} % atomic mass units +\newcommand{\gram}{\unit{g}} % grams +\newcommand{\kg} {\unit{kg}} % kilograms +\newcommand{\Ton} {\unit{T}} % tons +\newcommand{\kT} {\unit{kT}} % kilotons +\newcommand{\MT} {\unit{MT}} % megatons +% \end{macrocode} +% +% \subsection{Thermodynamics} +% +% \begin{macrocode} +\newcommand{\kelv}{\unit{K}} % kelvins +% \end{macrocode} +% +% \subsection{Time} +% +% It seems that |\sec| already means secant, so we need a preservation +% and renewal here. +% \begin{macrocode} +\alias\secant\sec +\renewcommand{\sec} {\unit{s}} % seconds +% \end{macrocode} +% +% \subsection{Velocity} +% +% \begin{macrocode} +\newcommand{\cee} {\unit{c}} % speed o' light +% \end{macrocode} +% +% \iffalse +% +%</units> +% +% \fi diff --git a/Master/texmf-dist/source/latex/cjw/cjw-latex.ins b/Master/texmf-dist/source/latex/cjw/cjw-latex.ins new file mode 100644 index 00000000000..447e39c97c0 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjw/cjw-latex.ins @@ -0,0 +1,44 @@ +% -*- TeX -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\batchfile{cjw-latex.ins} +\input docstrip.tex +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\preamble + + Copyright (C) 1997 by: Colin J. Wynne <cwynne@mts.jhu.edu> + +This file is part of cjw-latex, a collection of package files for +LaTeX2e, written by Colin J. Wynne. It may be freely distributed in +any form---electronic, physical, or otherwise---so long as the +distributor provides this file in its entirety (including this +copyright announcement) and charges no fee (except for reasonable +recompense for the duplication process). Fair 'nough? + +I would also prefer that the entire source file `cjw-latex.dtx', +together with `cjw-latex.ins', be propagated instead of any one +subfile. + +Please feel free to improve on or alter any code herein as suits your +needs, and by all means notify me of any suggestions, improvements, or +requests. + +This file is beer-ware. If you use it and like it, then you should +buy me a beer if you ever meet me. :-) + +RCS: $Id: cjw-latex.ins,v 1.3 1998/04/10 14:30:18 cwynne Exp $ + +\endpreamble +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Don't display progress +\keepsilent + +\generateFile{cjwmacro.sty}{t}{\from{cjw-latex.dtx}{general}} +\generateFile{cjwmath.sty} {t}{\from{cjw-latex.dtx}{math}} +\generateFile{cjwderiv.tex}{t}{\from{cjw-latex.dtx}{deriv}} +\generateFile{cjwinteg.tex}{t}{\from{cjw-latex.dtx}{integ}} +\generateFile{cjwphys.tex} {t}{\from{cjw-latex.dtx}{phys}} +\generateFile{cjwunits.sty}{t}{\from{cjw-latex.dtx}{units}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/source/latex/cjw/cjw-ltr.dtx b/Master/texmf-dist/source/latex/cjw/cjw-ltr.dtx new file mode 100644 index 00000000000..42e80bc36ee --- /dev/null +++ b/Master/texmf-dist/source/latex/cjw/cjw-ltr.dtx @@ -0,0 +1,821 @@ +% \iffalse -*- LaTeX -*- +% +% This is file `cjw-ltr.dtx'. You can run this file through LaTeX2e +% to get a .dvi file of documentation. The file `cjw-ltr.ins' should +% have come with this file. Run it through LaTeX2e to extract the +% actual class file. +% +% \fi +\def\fileversion{0.9} +\def\filedate{1997/01/01} +%% \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 +%% Lower-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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \CheckSum{592} +% +% \iffalse +% +%<*driver> + +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{cjw-ltr.dtx} + [\filedate\space v\fileversion\space + Modified Letter Class for LaTeX2e---CJW] + +\documentclass{ltxdoc} + +\GetFileInfo{cjw-ltr.dtx} +\EnableCrossrefs +% \DisableCrossrefs % Say \DisableCrossrefs if index is ready +% \OnlyDescription % comment out for implementation details +\RecordChanges + +\begin{document} + \DocInput{cjw-ltr.dtx} +\end{document} +%</driver> +% \fi +% +% \DeclareRobustCommand{\cseq}[1]{\texttt{\bslash#1}} +% \DeclareRobustCommand{\pkg} [1]{\textsf{#1}} +% \DeclareRobustCommand{\env} [1]{\textsf{#1}} +% +% \providecommand{\ie}{\emph{i.e.},\ } +% +% \renewcommand{\thefootnote}{\fnsymbol{footnote}} +% +% \hyphenation{white-space} +% +% \title{The \pkg{cjw-ltr} Class\thanks{% +% This file has version \fileversion{} as of \filedate.}} +% \author{Colin J.~Wynne\thanks{E-Mail at: +% \texttt{cwynne@mts.jhu.edu}, \texttt{cwynne@jhu.edu}\,.}} +% \date{\filedate} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% +% {\parskip 0pt ^^A % This is the hack used by |doc.dtx|. +% ^^A % (bug in \LaTeX?) +% \tableofcontents +% } +% +% \section*{Introduction} +% +% I recently made the change to \LaTeXe{} after some years of +% dedication to \PlainTeX{} and that code which I had already +% written for it. Among that code were macros for writing letters. +% Since I am studying in Germany this year, I had also written a set +% of macros for writing proper letters according to accepted German +% format. +% +% After switching to \LaTeX, I of course gave the \pkg{letter} class a +% try. I didn't like some of the default behaviour that the class +% produces. Furthermore, there was no support for writing German +% letters. I am aware that a style file \pkg{dinbrief} exists for +% \LaTeX{} 2.09 or \LaTeXe{} in compatibility mode, but I would prefer +% to use something exclusively \LaTeXe. Since I planned on doing some +% cosmetic alterations to the basic \pkg{letter} class anyway, I +% figured it wouldn't be too much extra to include the capability of +% formatting German letters as well. +% +% So, this is what I have come up with. Feel free to e-mail me +% comments, suggestions, bugs, etc. +% +% +% \section{Creating Letters} +% +% \DescribeMacro{\letterskip} +% The first problem that I had with the \pkg{letter} class was +% spacing. I do not like having the paragraphs of my letters +% unindented and separated by white space. This poses a problem since +% the vertical space between the components of the letter are defined +% (nay, \emph{hard-wired}) as multiples of \cseq{parskip}. Therefore, +% all vertical space has been defined in terms of \cseq{letterskip}, a +% length which is set initially to 0.7\,em, which happens to be the +% \pkg{letter} class's default value for \cseq{parskip}. +% +% \subsection{Standard Letters} +% +% \DescribeEnv{letter} +% \DescribeMacro{fax} +% American format letters are still delineated by the \env{letter} +% environment. No changes have been made here; the single mandatory +% argument (which may be left empty) is still the address of the +% recipient. I have, however, added a macro \cseq{fax}, analagous to +% \cseq{telephone}, for including a fax number in the return address. +% If the recipient's fax is also desired, it should probably just be +% included in the argument to the \env{letter} environment, perhaps +% using the \cseq{faxlabel} macro, as well (see below). +% +% Now, one of the things that I have always been taught about proper +% business letters is that the closing and the sender's address should +% line up, and be as far right as possible. The standard \pkg{letter} +% class does not do this; instead, the address is set as far right as +% possible and the closing begins \cseq{indentedwidth} from the right +% margin. By default, this is exactly in the middle of the page. I +% can not express satisfactorily just how ugly and unbalanced this +% seems to me. +% \DescribeMacro{\addresswidth} +% So, first I have \cseq{let} the length \cseq{indentedwidth} to the slightly +% more intuitive \cseq{addresswidth}. When the letter's \cseq{opening} is +% declared, \cseq{addresswidth} is fixed at the size of the return +% address. Both the sending address and the closing will be set +% at in a box of width \cseq{addresswidth}; the box is flush right, +% the material within the box is flush left. +% +% \DescribeMacro{\opening} +% The \cseq{opening} macro still takes the text of the opening as its one +% argument, and still begins the letter by typesetting the addresses +% and date. There are a few differences in the typesetting, though. +% First, if a \cseq{telephone} command has been entered, the number will +% be set as the last line of the address. Then comes the skip between +% the address and the date. This skip is rather smaller that that +% provided by the \pkg{letter} class. I found this to be +% preferable. Then come the recipient's address and the greeting. +% After these are typeset, the \cseq{parindent} is set to 20\,pt and the +% \cseq{parskip} to 0\,pt plus 1\,pt. The values can be reset after the +% \cseq{opening} call and before the text of the body if such is desired. +% +% \DescribeMacro{\closing} +% The only change to the closing macro is the substitution of +% \cseq{letterskip} for the original \cseq{medskipamount}. This means that +% all vertical space in a letter---between address and date and +% recipient's address, between address and greeting, etc.---are +% proportional. I considered defining each of those quantities to be +% their own macro, such as \cseq{beforedateskip}, \cseq{beforerecipientskip}, +% and so forth, but that seemed a little bit excessive. If, however, +% such flexibility is desired, feel free to ask for it. +% +% \subsection{German Letters} +% +% \DescribeEnv{brief} +% \llap{\footnotemark}\footnotetext{Dies soll wirklich auf Deutsch +% sein, oder? Das hatte ich betrachtet, aber es schien mir ein +% bi\ss chen durcheinander, die beiden Sprachen in dieser +% Dokumentation zu mischen. Wenn jemand die \"Ubersetzung will, +% k\"onnte er mich fragen. Anderseits ist jeder frei, die +% \"Ubersetzung selbst zu erledigen.}^^A% +% The environment for a German letter is, appropriately enough, named +% \env{brief} (the German word for letter). As for |begin{letter}|, +% the invocation takes the recipient's address as the one mandatory +% argument. However, in standard format, the address line containing +% the \emph{Postleitzahl} (zip code, postal code---whatever) and the +% city is separated by a bit of whitespace from the rest of the +% address. Thus, whereas other lines of the address are delineated +% by the |\\| macro, the sequence |!!| indicates the beginning of the +% PLZ. Thus, my former address would most likely be entered as: +% \begin{verbatim} +% \begin{brief}{% +% Herrn \\ +% Colin J. Wynne \\ +% Klosterweg 28 / L110 !! +% 76131 Karlsruhe} +% \end{verbatim} +% +% \DescribeMacro{\totitle} +% \DescribeMacro{\toPLZ} +% I have not included any macros for creating mailing labels---other +% than the standard macros from the \pkg{letter} class. However, if +% someone feels the need to write such, then the following is +% significant. For a standard letter, the first line is taken as the +% recipient's `title'. This can be a proper academic or professional +% title, or, more commonly, simply a polite \emph{Herrn}, as in the +% example above. This is stored in the macro \cseq{totitle}. The PLZ +% information (everything in the argument after |!!|) is stored in +% \cseq{toPLZ}. These complement the standard \cseq{toname} and \cseq{toaddress}. +% I would add appropriate macros myself, but I have no facilities for +% printing mailing labels to check the result. I imagine, though, +% that setting +% \begin{verbatim} +% \edef\toname{\totitle \\ \toname} +% \edef\toaddress{\toaddress \\ \toPLZ} +% \end{verbatim} +% would allow existing labelling functions to suffice. (\cseq{edef} to +% avoid a recursive definition, of course.) +% +% \DescribeMacro{\ort} +% \DescribeMacro{\datum} +% \DescribeMacro{\heute} +% \DescribeMacro{\absender} +% \DescribeMacro{\telefon} +% \DescribeMacro{\unterschrift} +% German equivalents are allowed for the standard information +% providing macros. \cseq{ort} is equivalent to \cseq{location}, and can be +% used to provide the place name on the dateline. The date itself can +% be entered with the \cseq{datum} command, and the \cseq{heute} macro +% produces the current date in German format. Thus, the input +% |\ort{Karlsruhe} \datum{\heute}| could produce the dateline +% `Karlsruhe, den 14. Mai 1995' +% at the top of the letter. \cseq{absender} is used as \cseq{address} to +% indicate the sender's address, with \cseq{telefon} to provide a +% telephone number, and \cseq{fax} is of course the same as in +% English. Finally, \cseq{unterschrift} provides the signature after +% the closing. +% \DescribeMacro{\betreff} +% \DescribeMacro{\bezug} +% Commands are also given for entering the optional \emph{Betreff} and +% \emph{Bezug} information. A note to purists: one should include +% both or neither of these lines. By default, the labels ``Betreff'' +% and ``Bezug'' are printed at the beginning of their respective +% lines. The actual label (including an empty label) can be entered +% as an optional argument to the \cseq{betreff} or \cseq{bezug} commands. +% +% \DescribeMacro{\anrede} +% \DescribeMacro{\gruss} +% The opening and closing of a letter are called by macros named for +% the German equivalents to \cseq{opening} and \cseq{closing}, namely +% \cseq{anrede} and \cseq{gruss}. +% +% \DescribeMacro{\anlage} +% Enclosures are indicated by the \cseq{anlage} command, which calls the +% standard \cseq{encl} macro. \cseq{anlage} takes an optional argument, +% namely the \cseq{enclname} macro, which is used to label the enclosures. +% By default, ``Anlage'' is the label. Since multiple enclosures are +% fairly standard, one can enter simply `n' (that is, +% |\anlage[n]|\meta{enclosures}) and produce the expected label +% ``Anlagen.'' +% +% +% \StopEventually{\PrintChanges\PrintIndex} +% +% \iffalse +%<*class> + +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{cjw-ltr} + [\filedate\space v\fileversion\space + Modified Letter Class for LaTeX2e---CJW] + +% \fi +% +% \section{The Code} +% +% The very first thing to do is to include the file |letter.cls|, +% since most of what's in there is very good, and I don't want to +% have to rewrite it and bloat this file. We make sure as well that +% it inherits any options. +% \begin{macrocode} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}} +\ProcessOptions + +\LoadClass{letter} +% \end{macrocode} +% Now we can start to change things. I think the default \cseq{headsep} +% is too large; so, we will make it a bit smaller. +% \begin{macrocode} +\setlength\headsep {25\p@} +% \end{macrocode} +% Next, we provide the length that will be used for vertical space +% within a letter. We initialise it to a reasonable value. +% \begin{macrocode} +\newlength{\letterskip} + \setlength{\letterskip}{0.7em} +% \end{macrocode} +% +% \subsection{Standard Letters} +% +% \begin{macro}{\addresswidth} +% We first declare the length \cseq{addresswidth}, which is used to +% determine how far from the right margin the sender's adress and the +% closing should be set. Since the \pkg{letter} class uses the +% \cseq{indentedwidth} length to help place the sender's address, we +% will simply recycle that length for our own purposes. +% \begin{macrocode} +\let\addresswidth\indentedwidth +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\faxlabel} +% \begin{macro}{\tellabel} +% If a fax number is included, it should be labeled so as not to be +% confused with a telephone number. The labels (appropriate to both +% German and English) will simply be `Tel:' and `Fax:'. But, in the +% interest of \ae{}sthetics, we want the printed versions to have the +% same width, so that the actual numbers line up nicely. Since `Fax:' +% is clearly the wider label, we use it to determine the width we +% want. +% \begin{macrocode} +\newlength\lblwd +{\setbox0=\hbox{Fax:\enskip}\global\setlength{\lblwd}{\wd0}} +\newcommand*{\faxlabel}{\hbox to\lblwd{Fax:\enskip\hfil}} +\newcommand*{\tellabel}{\hbox to\lblwd{Tel:\enskip\hfil}} +% \end{macrocode} +% \end{macro} +% \end{macro} + +% \begin{macro}{\fax} +% \begin{macro}{\check@iffax} +% The \cseq{fax} command simply sets a global placeholder. +% \begin{macrocode} +\newcommand*{\fax}[1]{\def\faxnum{#1}} + \fax{} +% \end{macrocode} +% The \cseq{check@iffax} macro inserts the labels if appropriate. +% \begin{macrocode} +\def\check@iffax{% + \ifx\@empty\faxnum\else + \edef\faxnum{\protect\faxlabel\faxnum} + \ifx\@empty\telephonenum\else + \edef\telephonenum{\protect\tellabel\telephonenum} + \fi\fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\opening} +% The \cseq{opening} macro will collect all information for the +% \env{letter} environment and begin the typesetting. First, we +% calculate the actual width of the given address. +% \begin{macrocode} +\def\opening#1{% +% \end{macrocode} +% The first step is to determine what actual address information we +% have. We will figure this out and put it into a placeholder. If a +% fax number is included, we will want to use labels for telephone and +% fax. +% \begin{macrocode} + \check@iffax + \def\from@address{% +% \end{macrocode} +% We see if a return address was supplied. If not, we simply set +% the date. +% \begin{macrocode} + \ifx\@empty\fromaddress% + \@date% +% \end{macrocode} +% If so, we typeset the address including a telephone number if one is +% supplied. Then comes a bit of whitespace and the date. +% \begin{macrocode} + \else% home address + \fromaddress% + \ifx\@empty\telephonenum\else% + \\ \telephonenum% + \fi% + \ifx\@empty\faxnum\else% + \\ \faxnum% + \fi% + \\*[\letterskip]\@date% + \fi} + \setbox0=\hbox{% + \begin{tabular}{l}\from@address\end{tabular}} +% \end{macrocode} +% With these values we set out global value for \cseq{addresswidth}. +% \begin{macrocode} + \global\setlength{\addresswidth}{\wd0} +% \end{macrocode} +% With no address, we want the |firstpage| pagestyle. +% \begin{macrocode} + \ifx\@empty\fromaddress + \thispagestyle{firstpage}% +% \end{macrocode} +% With one, we want the |empty| pagestyle for the first page. +% \begin{macrocode} + \else + \thispagestyle{empty} + \fi +% \end{macrocode} +% In either case, we fill horizontally and dump the box with the +% address information. +% \begin{macrocode} + \noindent\hfill\box0 + \par +% \end{macrocode} +% After the date comes some more whitespace and the recipient--- +% \begin{macrocode} + \vspace{2\letterskip}% + {\raggedright\toname\\ \toaddress\par}% +% \end{macrocode} +% ---then more whitespace and the text of the greeting. Note that all +% of the whitespace is given in terms of \cseq{letterskip}. +% \begin{macrocode} + \vspace{2\letterskip}% + \noindent#1% +% \end{macrocode} +% Finally, we reset the values of \cseq{parindent} and \cseq{parskip} and +% inhibit a break before the body. (What set of addresses would make +% \TeX{} \emph{want} to break after the greeting?) +% \begin{macrocode} + \setlength{\parindent}{20\p@} + \setlength{\parskip}{0\p@ \@plus\@ne\p@\relax} + \par\nobreak} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\closing} +% The \cseq{closing} macro is unchanged from the \pkg{letter} class, +% except for the change from \cseq{parindent} to \cseq{letterskip} and +% the use of \cseq{addresswidth} in determining the box size. +% \begin{macrocode} +\long\def\closing#1{\par\nobreak\vspace{2\letterskip}% + \stopbreaks + \noindent\hfill + \parbox{\addresswidth}{\raggedright% + #1\\[6\letterskip]% + \ifx\@empty\fromsig + \fromname + \else + \fromsig + \fi\strut} + \par} +% \end{macrocode} +% \end{macro} +% +% \subsection{German Letters} +% +% First, we \cseq{let} several appropriate macros for German usage. +% \begin{macrocode} +\let\unterschrift \signature +\let\absender \address +\let\ort \location +\let\telefon \telephone +\let\datum \date +% \end{macrocode} +% \begin{macro}{\heute} +% Here are some simple definitions which I use in my own macro files. +% \begin{macrocode} +\newcommand{\theday}{\number\day\relax} +\newcommand{\themonth}{% + \ifcase\month\or January\or February\or% + March\or April\or May\or June\or July\or August\or% + September\or October\or November\or December\fi} +\newcommand{\themonat}{% + \ifcase\month\or Januar\or Februar\or% + M\"arz\or April\or Mai\or Juni\or Juli\or August\or% + September\or Oktober\or November\or Dezember\fi} +\newcommand{\theyear}{\number\year\relax} +% \end{macrocode} +% From these we can construct a German date macro, \cseq{heute}. +% \begin{macrocode} +\newcommand{\heute}{den~\theday.\ \themonat\ \theyear} +% \end{macrocode} +% These are also useful if one prefers a different (\ie date first) +% format for the \cseq{today} macro. +% \end{macro} +% +% \begin{macro}{\betreff} +% \begin{macro}{\bezug} +% Next come the macros for the additional information which may be +% included in the headers of a German letter. +% \changes{v0.5}{1995/06/10}{Fixed a bug (incorrect macro parameter) +% in \cseq{betreff} and \cseq{bezug}.} +% \begin{macrocode} +\newcommand{\betreff}[2][Betreff]{% + \def\betreffname{#1}\long\def\@betreff{#2}} +\newcommand{\bezug}[2][Bezug]{% + \def\bezugname{#1}\long\def\@bezug{#2}} +% \end{macrocode} +% These are initialised to be empty. +% \begin{macrocode} +\betreff[]{} +\bezug[]{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{environment}{brief} +% Now comes the \env{brief} environment itself. German letters are +% suppose to use unindented and separated paragraphs, so we will set +% the proper values as soon as the environment is entered. +% \begin{macrocode} +\long\def\brief#1{% + \newpage + \setlength{\parindent}{0pt} + \setlength{\parskip}{0.7em} +% \end{macrocode} +% Further initialisations are taken from the \cseq{letter} macro. +% \begin{macrocode} + \if@twoside \ifodd\c@page + \else\thispagestyle{empty} \hbox{}\newpage\fi + \fi + \c@page\@ne + \interlinepenalty=200 % Smaller than the TeXbook value +% \end{macrocode} +% Since the supplied argument has more information in it than that +% given to a \env{letter} environment, we must have our own equivalent +% to the \pkg{letter} class's |\@processto|. +% \begin{macrocode} + \@prozessan{\leavevmode\ignorespaces #1} +% \end{macrocode} +% Lastly, we make the default date a German one. +% \begin{macrocode} + \date{\heute}} +% \end{macrocode} +% \begin{macro}{\@prozessan} +% \changes{v0.5}{1995/06/10}{The \cseq{@prozessan} macro and its +% subprocesses completely rewritten, as the previous version (v0.1) +% was very broken.} +% The address processing is based on the |\@processto| macro from +% \pkg{letter.cls}. We call the first subprocess, |\@xproz|, to fetch +% the PLZ part of the address. +% \begin{macrocode} +\long\def\@prozessan#1{% + \@xproz #1!!@@@% +% \end{macrocode} +% If there is a PLZ, the first test includes an extra occurrence of +% |!!| in the \cseq{toPLZ} macro. So, we call |\@xproz| again without the +% extra characters (which were necesary to make sure that we didn't +% get a `usage doesn't match definition' error the first time around). +% \begin{macrocode} + \ifx\@empty\toPLZ\else\@xproz #1@@@\fi% +% \end{macrocode} +% The |\@xproz| macro has now stored all the address parts before the +% PLZ in |\@tempa|. Now there are up to three different parts that +% may be in |\@tempa| which we will try to separate out. We use +% \cseq{expandafter} in order that the tokens within |\@tempa| get +% properly considered. +% \begin{macrocode} + \expandafter\@yproz \@tempa\\@@@% +% \end{macrocode} +% The |\@yproz| splits the input into |\@tempb|, the part before the +% first linebreak, and |\@tempc|, the rest. If the second part, that +% in |\@tempc|, is empty, then we want to set the third part, +% |\@tempd|, to be empty, too. +% \begin{macrocode} + \ifx\@empty\@tempc + \let\@tempd\@empty +% \end{macrocode} +% Otherwise, we call |\@zproz| to further subdivide the address input. +% \begin{macrocode} + \else + \expandafter\@zproz \@tempa\\@@@% +% \end{macrocode} +% If there is a third part, |\@tempd|, we have the same problem with +% extra characters as above in \cseq{toPLZ}. We call |\@zproz| one more +% time in order to read |\@tempd| correctly. +% \begin{macrocode} + \ifx\@empty\@tempd + \else + \expandafter\@zproz \@tempa{}@@@% + \fi + \fi +% \end{macrocode} +% Now we need to decide what to call whichever address pieces actually +% exist. Obviously, if everything back to |\@tempb| was empty, all of +% the address parts should be likewise. +% \begin{macrocode} + \ifx\@empty\@tempb + \let\totitle\@empty \let\toname\@empty \let\toaddress\@empty + \else +% \end{macrocode} +% Now we have at least one address part. If that is the only one, it +% is most certainly not a title, so \cseq{totitle} must be set empty. +% \begin{macrocode} + \ifx\@empty\@tempc + \let\totitle\@empty +% \end{macrocode} +% One line with a PLZ is almost assuredly an address proper. Without +% a PLZ it is probably a name. +% \begin{macrocode} + \ifx\@empty\toPLZ + \let\toname\@tempb \let\toaddress\@empty + \else + \let\toname\@empty \let\toaddress\@tempb + \fi +% \end{macrocode} +% If |\@tempb| and |\@tempc| contain something, but |\@tempd| is +% empty, the two lines should be name and address. +% \begin{macrocode} + \else + \ifx\@empty\@tempd + \let\totitle\@empty \let\toname\@tempb \let\toaddress\@tempc +% \end{macrocode} +% The last option is that title, name and address are all present. +% \begin{macrocode} + \else + \let\totitle\@tempb \let\toname\@tempc \let\toaddress\@tempd + \fi + \fi + \fi} +% \end{macrocode} +% This is my second implementation of the |\@prozessan| macro. The +% first was truly ugly and had the added disadvantage of, well, not +% working. In fact, it failed miserably for a few relatively simple +% cases. That the current version (as far I can tell) works does not, +% however, excuse the fact that it is still somewhat ugly and seems to +% me to be very efficient. I am still open to any suggested +% improvements. +% +% The subproceses to |\@prozessan| are simply designed to be able to +% make assignments based on the structure of the passed argument. +% \begin{macrocode} +\long\def\@xproz #1!!#2@@@{\def\@tempa{#1}\def\toPLZ{#2}} +\long\def\@yproz #1\\#2@@@{\def\@tempb{#1}\def\@tempc{#2}\def\@tempd{}} +\long\def\@zproz #1\\#2\\#3@@@{\def\@tempc{#2}\def\@tempd{#3}} +% \end{macrocode} +% \end{macro} +% +% The end of the \env{brief} environment is identical to that of the +% \env{letter} environment. +% \begin{macrocode} +\let\endbrief\endletter +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\anrede} +% As for the \cseq{opening} macro in the \env{letter} environment, the +% \cseq{anrede} macro signals the beginning of the letter. We begin by +% setting the dateline. +% \changes{v0.5}{1995/06/10}{Use \cseq{@dateline} instead of +% \cseq{@tempa}, because \cseq{raggedright}, or \emph{something}, +% seemed to mess with \cseq{@tempa}. Also move the conditional +% outside of the definition of \cseq{@dateline}.} +% \begin{macrocode} +\def\anrede#1{% + \check@iffax + \ifx\@empty\fromlocation + \def\@dateline{\@date} + \else + \def\@dateline{\fromlocation,\space\@date} + \fi +% \end{macrocode} +% Set with a typewriter, a German letter should leave two blank lines +% before the return address. Since we are using something a little +% more capable than a typewriter, we will leave a small amount of +% whitespace, in the form of a multiple of \cseq{letterskip}. +% \begin{macrocode} + \null\vspace{1.2\letterskip} + \noindent\ignorespaces +% \end{macrocode} +% If there is no return address (a situation which I don't actually +% see happening with this format), just set the dateline at the right +% margin. +% \begin{macrocode} + \ifx\@empty\fromaddress% + \pagestyle{firstpage}% + {\raggedleft \@dateline}% +% \end{macrocode} +% Otherwise, the address is set at the left margin and the dateline +% right justified at the level of the first line of the sender +% information. A telephone number and fax, if provided, follow the address. +% \changes{v0.5}{1995/06/10}{Added code to include a telephone number +% in the return address information.} +% \begin{macrocode} + \else % Home address + \pagestyle{empty}% + {\raggedright% + \fromname \hfill \@dateline\\ + \fromaddress} + \ifx\@empty\telephonenum + \else + \\ \telephonenum + \fi + \ifx\@empty\faxnum + \else + \\ \faxnum + \fi + \fi + \par +% \end{macrocode} +% Next comes whitespace approximately twice as large as the topskip. +% \begin{macrocode} + \vspace{2.2\letterskip} +% \end{macrocode} +% We then set the recipient's address. Using the information provided +% from the |\@prozessan| macro above, we include those pieces which +% were supplied. +% \begin{macrocode} + {\raggedright + \ifx\@empty\totitle + \else + \totitle \\ + \fi + \toname + \ifx\@empty\toaddress + \else + \\ \toaddress + \fi + \ifx\@empty\toPLZ + \else + \\*[0.6\letterskip]\toPLZ + \fi + \par} +% \end{macrocode} +% After the address come, if supplied, the \emph{Betreff} and +% \emph{Bezug} lines. First, though, we check to see if only one is +% supplied---if so, we issue a warning. +% \begin{macrocode} + \@checkbetreffbezug +% \end{macrocode} +% Now we can typeset those lines. A small amount of whitespace +% separates them from one another and from the address. +% \begin{macrocode} + \ifx\@empty\@betreff + \else + \vspace{\letterskip} + \ifx\@empty\betreffname + \else + \betreffname:\quad + \fi + \@betreff\par + \fi + \ifx\@empty\@bezug + \else + \vspace{1\letterskip} + \ifx\@empty\bezugname + \else + \bezugname:\quad + \fi + \@bezug\par + \fi +% \end{macrocode} +% A slightly larger amount of whitespace precedes the actual +% \emph{Anrede}. +% \begin{macrocode} + \vspace{1.4\letterskip}% + #1\par\nobreak} +% \end{macrocode} +% \end{macro} +% The |\@checkbetreffbezug| macro emits a warning if only one of those +% two lines is supplied. +% \begin{macrocode} +\def\@checkbetreffbezug{% + \ifx\@empty\@betreff + \ifx\@empty\@bezug + \else + \ClassWarningNoLine{cjw-ltr}{% + Die \protect\betreff und \protect\bezug Befehlen sollen nur + \MessageBreak + zusammen verwendet werden. Ihnen fehlt die \MessageBreak + Betreff-Zeile.} + \fi + \else + \ifx\@empty\@bezug + \ClassWarningNoLine{cjw-ltr}{% + Die \protect\betreff und \protect\bezug Befehlen sollen nur + \MessageBreak + zusammen verwendet werden. Ihnen fehlt die \MessageBreak + Bezug-Zeile.} + \fi + \fi} +% \end{macrocode} +% +% \begin{macro}{\gruss} +% The command \cseq{gruss} ends a letter by first adding some whitespace +% and disabling further pagebreaks. +% \begin{macrocode} +\long\def\gruss#1{\par\nobreak\vspace{2\letterskip}% + \stopbreaks + \noindent% +% \end{macrocode} +% The closing itself is set, leaving enough whitespace for the actual +% signature. +% \begin{macrocode} + {\raggedright #1 \\[5\letterskip] + \ifx\@empty\fromsig + \fromname + \else + \fromsig + \fi} + \par +% \end{macrocode} +% Finally, a bit of white space separates the bottom of the closing +% from any postscripts. +% \begin{macrocode} + \vspace{\letterskip}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\anlage} +% Enclosures, \emph{Anlagen}, are specified by the \cseq{anlage} command. +% As with \cseq{betreff} and \cseq{bezug}, the label is given by an optional +% argument. +% \begin{macrocode} +\newcommand{\anlage}[1][Anlage]{% +% \end{macrocode} +% If the optional argument is simply `n', we pluralize the label. +% \begin{macrocode} + \def\@tempa{n} \def\@tempb{#1} + \ifx\@tempa\@tempb + \renewcommand{\enclname}{Anlagen} +% \end{macrocode} +% Otherwise, the optional argument (or the default, if none is given) +% becomes the label. +% \begin{macrocode} + \else + \renewcommand{\enclname}{\@tempb} + \fi\encl} +% \end{macrocode} +% \end{macro} +% And with that, we are done. +% +% \iffalse +%</class> +% \fi +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex/cjw/cjw-ltr.ins b/Master/texmf-dist/source/latex/cjw/cjw-ltr.ins new file mode 100644 index 00000000000..4a33db2f3cf --- /dev/null +++ b/Master/texmf-dist/source/latex/cjw/cjw-ltr.ins @@ -0,0 +1,18 @@ +\def\batchfile{cjw-ltr.ins} +\input docstrip.tex + +\preamble + +Copyright (C) 1995 by Colin J. Wynne + +This file is part of cjw-ltr, a class for creating modified standard +letters as well as German style letters under LaTeX2e. + +\endpreamble + +% Don't display progress +\keepsilent + +\generateFile{cjw-ltr.cls}{t}{\from{cjw-ltr.dtx}{class}} + +\endinput diff --git a/Master/texmf-dist/source/latex/cjw/cjwoutl.dtx b/Master/texmf-dist/source/latex/cjw/cjwoutl.dtx new file mode 100644 index 00000000000..c77c01ad0be --- /dev/null +++ b/Master/texmf-dist/source/latex/cjw/cjwoutl.dtx @@ -0,0 +1,656 @@ +% \iffalse -*- LaTeX -*- +% +% This is file `cjwoutl.dtx'. You can run this file through LaTeX2e +% to produce the .dvi documentation. You should also have received +% the file `cjwoutl.ins'. Run it through LaTeX2e to extract the +% actual package file. +% +% \fi +\def\fileversion{0.6} +\def\filedate{1996/04/26} +%% \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 +%% Lower-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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \CheckSum{327} +% +% \iffalse +% +%<*driver> + +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{cjwoutl.dtx} + [\filedate\space v\fileversion\space + Auto-Numbered Outlines--CJW] + +\documentclass{ltxdoc} +\IfFileExists{cjwoutl.sty} + {\usepackage{cjwoutl}} + {\GenericError{(cjwoutl.dtx)\@spaces\@spaces\@spaces}{Error: + You must first LaTeX the file `cjwoutl.ins' \MessageBreak + and extract the `cjwoutl.sty' package before \MessageBreak + processing the documentation}{}{}} +\GetFileInfo{cjwoutl.sty} +\EnableCrossrefs +% \DisableCrossrefs % Say \DisableCrossrefs if index is ready +% \OnlyDescription % comment out for implementation details +\RecordChanges + +\begin{document} + \DocInput{cjwoutl.dtx} +\end{document} +%</driver> +% \fi +% +% \def\pkg#1{\textsf{#1}} +% \def\env#1{\textsf{#1}} +% \providecommand{\ie}{\emph{i.e.},\ } +% +% ^^A % Change List: +% +% \changes{v0.5}{1995/05/13}{Added \texttt{\protect\bslash outlindent} as +% indentation size.} +% +% \title{The \pkg{cjwoutl} Package\thanks{% +% This file has version \fileversion{} as of \filedate.}} +% \author{Colin J.~Wynne\thanks{E-Mail at: +% \texttt{cwynne@brutus.mts.jhu.edu}, +% \texttt{cwynne@jhu.edu}\,.}} +% \date{\filedate} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% +% {\parskip 0pt ^^A % This is the hack used by |doc.dtx|. +% ^^A % (bug in \LaTeX?) +% \tableofcontents +% } +% +% \section*{Introduction} +% +% This package originated as a simple set of macros for doing outlines +% under \PlainTeX. The original macros simply provided +% $n$|\parindent| as a left indentation for a single paragraph. +% This was almost three years ago. The macros improved somewhat with +% my knowledge of (and experience with) \TeX. Last summer I finally +% had the time to add what I had always wanted---automatic level +% numbering. +% +% This year I decided to find out just what \LaTeX{} was all about. +% After deciding that it wasn't that bad, I rewrote (and improved yet +% again) the outlining macros. Conveniently enough, a large chunk of +% the original \PlainTeX{} code dedicated to resetting the proper +% counters disappeared with the change to \LaTeX. +% +% At a basic level, the \env{outline} environment functions like +% \env{enumeration}. However, one needn't nest the calls of the +% \env{outline} environment. Rather, the macros used to identify the +% entries of the outline itself take care of this. +% +% I think this code is now both fairly generic and rather useful, and +% I would be more than happy to know that it is useful to others. +% Feel free to e-mail me with comments, suggestions, etc. The +% \PlainTeX{} version is still available by request for anyone who +% might want it. +% +% +% \section{Making an Outline} +% +% \DescribeEnv{outline} +% An outlined portion of a document is implemented, naturally enough, +% inside an environment, the \env{outline} environment. There is one +% optional argument to the |\begin| command. If the argument |new| is +% given, then the outline counters will be reset. Otherwise, the +% values of the counters will be exactly as they were at the end of +% the last \env{outline} environment. +% +% \DescribeMacro{\outl} +% Inside of an \env{outline} environment, there are two main user +% macros, one for auto-labelled entries and one for user-supplied +% labels. For labels to be automatically numbered and printed, the +% user simply enters |\outl|\meta{level}. The \meta{level} is simply +% an integer which corresponds to the depth within the outline. For +% example, level one of an outline begins at the left margin (more +% precisely, the \emph{text} begins at the left margin with the label +% offset by 1\,en to the left of that) and in a standard outline, and, +% indeed, according to this package's defaults, a capitalised roman +% numeral is used as a label. Therefore +% \begin{verbatim} +% \begin{outline} +% \outl{1}This is outline level one. +% \end{outline} +% \end{verbatim} +% will produce +% \begin{outline} +% \outl{1}This is outline level one. +% \end{outline} +% The package supplies seven defined levels of outline as well as a +% default `level'. The default is used for any levels over seven. +% These levels will still receive the correct indentation +% \DescribeMacro{\outlindent} +% (specifically, level $n$ is prefaced by |\leftskip = |^^A +% $(n-1)$|\outlindent| worth of space), but will all receive the +% default label, normally a bullet. Thus, the user is provided with +% the following: +% \begin{outline}[new] +% \outl{1}\dots +% \outl{2}\dots +% \outl{3}\dots +% \outl{4}\dots +% \outl{5}\dots +% \outl{6}\dots +% \outl{7}\dots +% \outl{8}\dots +% \outl{9}\dots +% \outl{10}\dots +% \end{outline} +% Note that levels eight through ten have the default bullet for a +% label, though the indentation levels are preserved. There are a few +% special symbols which can be given as the \meta{level} argument. If +% the user enters a |+|, |-| or |=| then the indentation level of that +% entry will be respectively one greater, one less or the same as that +% of the previous entry. Thus, +% \begin{verbatim} +% \begin{outline} +% \outl{1} Level one, +% \outl{+} Level two, +% \outl{=} Level two, +% \outl{-} Level one. +% \end{outline} +% \end{verbatim} +% gives +% \begin{outline}[new] +% \outl{1} Level one, +% \outl{+} Level two, +% \outl{=} Level two, +% \outl{-} Level one. +% \end{outline} +% +% \DescribeMacro{\ol} +% The macro |\ol| is almost identical to the |\outl| macro, except +% that it takes a second argument: |\ol|\meta{level}\meta{label}. The +% \meta{level} argument functions identically, and the \meta{label} +% argument is set as entered 1\,en to the left of the text. +% \DescribeMacro{\npp}\DescribeMacro{\unpp} Two macros are derived from +% |\ol|. Both take a \meta{level} argument. The |\npp| macro is +% essentially |\ol|\meta{level}|{\null}\indent|. The |\unpp| macro +% does not indent the first line of text. (The macros stand for ``new +% paragraph'' and ``unindented |\npp|''.) +% +% \DescribeMacro{\outlstyle} +% There is also a macro to allow for some modifications in how an +% outline entry is typeset. The default style, |plain|, does nothing. +% \DescribeMacro{firstpar} +% \DescribeMacro{\firstparfont} +% An alternate style, called |firstpar|, sets the first paragraph of +% an outline entry in |\firstparfont|. By default, this is italics, +% but the font command can, of course, be renewed by the user. To +% change styles, one simply calls |\outlstyle|\meta{style}; for +% example, +% \begin{verbatim} +% \outlstyle{firstpar} +% \end{verbatim} +% calls the |firstpar| outline style. +% +% N.B.: There is one `secret' left to tell. Unless one wants to reset +% the counters by calling |\begin{outline}[new]|, it is really +% unnecessary to call the environment. Instead, one can simply use +% the |\ol| or |\outl| commands as desired. The only caveat is that +% the final outline grouping must be closed. Therefore, the +% |\endoutline| macro \emph{must} be called. Granted, this doesn't +% make a whole big difference. I happen to use this `feature' simply +% because I have used these macros since long before it was written in +% a \LaTeX-environment format. YMMV. +% +% \subsection{Outline Labels} +% +% \DescribeMacro{outlN} +% The counters for the different levels are named |outl|$n$, where $n$ +% is a lowercase roman numeral. Therefore, this package defines +% |outli|, |outlii|,\ldots,|outlvii|. This is, as one easily sees, +% similar to the numbering scheme for the \env{enumeration} +% environment. +% \DescribeMacro{\theoutlN} +% \DescribeMacro{\labeloutlN} +% The numbering style for level $n$ is given by the macro |\theoutlN|. +% The actual label which is printed for an entry at level $n$ is given +% (naturally enough) by |\labeloutlN|. The default label is +% |\labeloutldef|. The example above showed the label at the sixth +% level as `(a)'. The relevant definitions are: +% \begin{verbatim} +% \renewcommand{\theoutlvi}{\alph{outlvi}} +% \renewcommand{\labeloutlvi}{(\theoutlvi)} +% \end{verbatim} +% \DescribeMacro{\labelfont} +% The labels themselves are typeset in |\labelfont|, which can also be +% set by the user. The default is bold-extended. +% +% \changes{v0.6}{1996/04/26}{Added info about cross-referencing.} +% \subsection{Cross References} +% +% Cross references function as expected for outlines, using the +% |\label| and |\ref| commands. The |\outl| function defines the +% current reference string, so the |\label| should be put after the +% |\outl| to which it refers. For example, we might have the code +% \begin{verbatim} +% \begin{outline}[new] +% \outl{1} Main entry. +% \outl{+} Next level. +% \outl{+} The price of tea in China.\label{ol:tea} +% \end{outline} +% \end{verbatim} +% producing +% \begin{outline}[new] +% \outl{1} Main entry. +% \outl{+} Next level. +% \outl{+} The price of tea in China.\label{ol:tea} +% \end{outline} +% whereupon the reference |ol:tea| would refer to tea in +% China~\ref{ol:tea}. +% +% \StopEventually{\PrintChanges\PrintIndex} +% +% +% \section{The Code} +% +% \iffalse +%<*package> + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{cjwoutl} + [1995/04/24 v0.5 Auto-Numbered Outlines--CJW] + +\DeclareOption*{% + \PackageWarning{cjwoutl}{Unknown option `\CurrentOption'}} + +\ProcessOptions + +% \fi +% +% \subsection{Allocations} +% +% Since the levels of an outline are defined by a |\leftskip| command, +% it is necessary to determine when a group needs to be closed. +% Therefore, we define a test to see if we are in a group. +% \begin{macrocode} +\newif\ifoutl@group +% \end{macrocode} +% This essentially keeps the first outline entry from closing a +% non-existent group. Two lengths, |\aboveoutlskip| and +% |\belowoutlskip|, initially set to the equivalent values for math +% displays, are used to separate an \env{outline} environment from the +% surrounding text. +% \changes{v0.6}{1996/04/26}{Added \texttt{\protect\bslash aboveoutlskip} +% and \texttt{\protect\bslash belowoutlskip} lengths based on values for +% displays.} +% \begin{macrocode} +\newlength{\aboveoutlskip} + \setlength{\aboveoutlskip}{\abovedisplayskip} +\newlength{\belowoutlskip} + \setlength{\belowoutlskip}{\belowdisplayskip} +% \end{macrocode} +% The |\outlindent| macro controls the increment between adjacent +% outline levels. Its default value is |\parindent|. +% \begin{macrocode} +\newlength{\outlindent} + \setlength{\outlindent}{\parindent} +% \end{macrocode} +% +% Now we define the counters to be used. The first two identify the +% requested indentation level and the previous level. +% \begin{macrocode} +\newcounter {outl@indsize} +\newcounter {outl@lastind} +% \end{macrocode} +% \begin{macro}{outlN} +% Next come the counters for the levels themselves. +% \begin{macrocode} +\newcounter {outli} % I. +\newcounter {outlii} [outli] % A. +\newcounter {outliii}[outlii] % 1. +\newcounter {outliv} [outliii] % a. +\newcounter {outlv} [outliv] % i. +\newcounter {outlvi} [outlv] % (a) +\newcounter {outlvii}[outlvi] % (i) +% \end{macrocode} +% There is also a counter definition for the default label. This will +% be explained below. +% \begin{macrocode} +\newcounter {outldef}[outlvii] +% \end{macrocode} +% \end{macro} +% \begin{macro}{\theoutlN} +% Now we can set the proper level numbering. +% \begin{macrocode} +\renewcommand{\theoutli} {\Roman{outli}} +\renewcommand{\theoutlii} {\Alph{outlii}} +\renewcommand{\theoutliii} {\arabic{outliii}} +\renewcommand{\theoutliv} {\alph{outliv}} +\renewcommand{\theoutlv} {\roman{outlv}} +\renewcommand{\theoutlvi} {\alph{outlvi}} +\renewcommand{\theoutlvii} {\roman{outlvii}} +% \end{macrocode} +% Again we have the default label, which I \emph{promise} will be +% explained. +% \begin{macrocode} +\renewcommand{\theoutldef} {} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\labeloutlN} +% Now the label formats will be defined. +% \begin{macrocode} +\newcommand{\labeloutli} {\theoutli.} +\newcommand{\labeloutlii} {\theoutlii.} +\newcommand{\labeloutliii} {\theoutliii.} +\newcommand{\labeloutliv} {\theoutliv.} +\newcommand{\labeloutlv} {\theoutlv.} +\newcommand{\labeloutlvi} {(\theoutlvi)} +\newcommand{\labeloutlvii} {(\theoutlvii)} +\newcommand{\labeloutldef} {\ensuremath{\bullet}} +% \end{macrocode} +% \end{macro} +% This next group of definitions are taken from the standard classes' +% definitions for the \env{enumeration} environment. I have not +% plumbed the cross-referencing code deeply enough to see how these +% macros are applied, but I take it on faith from |classes.dtx| that +% it works. +% \changes{v0.6}{1996/04/26}{Tweaked \texttt{\protect\bslash p@}\ldots{} +% definitions based on information in \emph{The \LaTeX{} Companion}.} +% \begin{macrocode} +\renewcommand{\p@outli} {} +\renewcommand{\p@outlii} {\theoutli.} +\renewcommand{\p@outliii} {\p@outlii\theoutlii.} +\renewcommand{\p@outliv} {\p@outliii\theoutliii.} +\renewcommand{\p@outlv} {\p@outliv\theoutliv.} +\renewcommand{\p@outlvi} {\p@outlv\labeloutlv.} +\renewcommand{\p@outlvii} {\p@outlvi\labeloutlvi.} +% \end{macrocode} +% And now we have the promised explanation of having a counter for the +% default labels. Simply put, the |\p@|\ldots{} commands are defined +% \emph{via} |\setcounter|. To be able to supply cross-references for +% outline entries above the seven numbered levels it seems necessary +% to have the relevant counter definition already made. I could be +% wrong on this, and maybe I could have defined the cross-reference +% label directly. If so, let me know. Anyway, that was the +% explanation---probably not worth the wait, was it? +% \begin{macrocode} +\renewcommand{\p@outldef} {\p@outlvii\ldots} +% \end{macrocode} +% +% \subsection{The Environment} +% +% \begin{environment}{outline} +% The \env{outline} environment itself has a very simple definition. +% It has a single optional argument. The default value of the +% argument is fairly arbitrary, so long as it isn't |new|. +% \changes{v0.6}{1996/04/26}{Added the new skip values to the beginning +% and end macros for the environment.} +% \begin{macrocode} +\newenvironment{outline}[1][keep]% +% \end{macrocode} +% To start the environment, we must simply test to see if the counters +% should be reset or not. +% \begin{macrocode} + {\def\@tempa{#1} \def\@tempb{new} + \ifx\@tempa\@tempb + \outl@reset + \fi + \penalty\predisplaypenalty\vspace{\aboveoutlskip}}% +% \end{macrocode} +% To finish an outlined section of a document, we include a |\par| (to +% make sure the |\leftskip| functions correctly), close the last +% outline group and let it be known that we are no longer in an +% outline. +% \begin{macrocode} + {\par\endgroup\global\outl@groupfalse% + \penalty\postdisplaypenalty\vspace{\belowoutlskip}} +% \end{macrocode} +% The macro to reset the outline counters is about as straightforward +% as possible. +% \begin{macrocode} +\newcommand{\outl@reset}{% + \setcounter{outli} {0} + \setcounter{outlii} {0} + \setcounter{outliii}{0} + \setcounter{outliv} {0} + \setcounter{outlv} {0} + \setcounter{outlvi} {0} + \setcounter{outlvii}{0}} +% \end{macrocode} +% \end{environment} +% +% \subsection{Outline Styles} +% +% \begin{macro}{\outlstyle} +% Outline styles are implemented as a macro call to the desired style +% just before the text of the outline entry is typeset. \ie in +% abstract terms, the |\ol| or |\outl| macros will have +% \begin{tabular}{l} +% \meta{label}\meta{style-macro}\textit{Text text text\ldots} +% \end{tabular} +% The styles are macros named |\ols@|\meta{style}. Thus, the +% |\outlstyle| macro shecks to see if the style is defined. If not, +% it emits a warning and selects the plain style. +% \begin{macrocode} +\newcommand{\outlstyle}[1]{% + \@ifundefined{ols@#1} + {\PackageWarning{cjwoutl}{Outline style `#1' is undefined. Using + style `plain' instead}% + \def\outl@style{\ols@plain}} +% \end{macrocode} +% \end{macro} +% If the requested style exists, we point the macro |\outl@style| +% towards it. (Note: if anyone can think of a better way to write +% this, let me know. I wanted to do it as a |\let|, but couldn't +% figure out the correct sequence of |\expandafter|s to get it to +% evaluate correctly.) +% \begin{macrocode} + {\def\outl@style{\csname ols@#1\endcsname}}} +% \end{macrocode} +% Now we define the two basic styles, |plain| and |firstpar|. +% \begin{macrocode} +\def\ols@plain{\@empty} +% \end{macrocode} +% The |firstpar| style simply takes the first paragraph of the entry +% as an argument and sets it in |\firstparfont|. +% \begin{macrocode} +\def\ols@firstpar#1\par{% + \bgroup\firstparfont #1\par\egroup} + +\DeclareOldFontCommand{\firstparfont}{\normalfont\itshape}{\relax} +% \end{macrocode} +% Lastly, we select |plain| as the default style. +% \begin{macrocode} +\outlstyle{plain} +% \end{macrocode} +% +% \subsection{The Entries} +% +% \begin{macro}{\ol} +% The |\ol| macro first takes care of the outline groupings and then +% processes the \meta{level} argument given by the user. +% \begin{macrocode} +\newcommand{\ol}[2]{% + \outl@checkgroups \outl@processlvl{#1}% +% \end{macrocode} +% We do some minor error handling---like disallowing negative numbers. +% If a numerical argument is given, the |\outl@processlvl| macro +% decrements it by one---thus, the actual |outl@indsize| is not the +% level number that the user enters, but rather the number of +% |\outlindent|s for the requested level, and the first entry occurs at +% zero indents, \ie on the left margin. Thus zero, and not one, is +% the minimum value which can be assigned to |\outl@indsize|. +% \begin{macrocode} + \ifnum \c@outl@indsize < 1\relax% + \setcounter{outl@indsize}{0}% + \leftskip = 0pt% + \else% + \leftskip = \c@outl@indsize\outlindent% + \fi% +% \end{macrocode} +% We specify that the first paragraph of an entry should not be +% indented and we make the label. +% \changes{v0.6}{1996/04/26}{Moved the \texttt{\protect\bslash llap} command +% into \texttt{\protect\bslash theoutlabel}---otherwise the reference +% strings were being defined inside groups and being lost.} +% \begin{macrocode} + \noindent\theoutlabel{#2}% +% \end{macrocode} +% The |\ignorespaces| macro allows the user to enter |\outl{1} Text| +% instead of the slightly less readable |\outl{1}Text| in the source +% file without the extra spaces showing up in the document. Anyway, +% then we call |\outl@style| which has been defined to be the selected +% style macro. +% \begin{macrocode} + \ignorespaces\outl@style} +% \end{macrocode} +% \end{macro} +% +% The |\npp| and |\unpp| macros are straightforward derivatives of the +% |\ol| macro. +% \begin{macrocode} +\newcommand{\npp}[1]{\ol{#1}{\null}\null\indent} +\newcommand{\unpp}[1]{\ol{#1}{\null}} +% \end{macrocode} +% +% \begin{macro}{\outl} +% The |\outl| macro is more or less identical to |\ol| above. +% \begin{macrocode} +\newcommand{\outl}[1]{% + \outl@checkgroups \outl@processlvl{#1}% + \ifnum \c@outl@indsize < 1\relax% + \setcounter{outl@indsize}{0}% + \leftskip = 0pt% + \else% + \leftskip = \c@outl@indsize\outlindent% + \fi% +% \end{macrocode} +% The difference is in calling the |\outl@label| macro which takes +% care of the automatic labels. +% \begin{macrocode} + \noindent\outl@label{\c@outl@indsize}% + \ignorespaces\outl@style} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\outl@checkgroups} +% Now we define the macro that balances the outline groupings. If we +% are already in a group, provide a |\par| to get the |\leftskip| +% right, then close the group and change the group flag. +% \begin{macrocode} +\newcommand{\outl@checkgroups}{% + \ifoutl@group + \par\endgroup\global\outl@groupfalse + \smallbreak + \fi +% \end{macrocode} +% Since we have just finished an outline group, we can set +% |outl@lastind|, then provide appropriate space (encouraging breaks +% between enries) and start a new group. +% \begin{macrocode} + \setcounter{outl@lastind}{\c@outl@indsize} + \smallbreak + \begingroup + \global\outl@grouptrue} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\outl@processlvl} +% The \meta{level} argument can be a number or one of |+|, |-| and +% |=|. The check is implemented as a set of nested |\if| statements. +% \begin{macrocode} +\newcommand{\outl@processlvl}[1]{% + \def\@tempa{+}\def\@tempb{-}\def\@tempc{=} + \def\@tempd{#1} + \ifx\@tempa\@tempd + \addtocounter{outl@indsize}{1} + \else\ifx\@tempb\@tempd + \addtocounter{outl@indsize}{-1} + \else\ifx\@tempc\@tempd + % Nothing---stay at same level. + \else + \setcounter{outl@indsize}{\@tempd} +% \end{macrocode} +% If we are setting to a new level number, we decrement by one, as +% mentioned in the definition of |\ol|, in order to convert the level +% number to an indentation size. +% \begin{macrocode} + \addtocounter{outl@indsize}{-1} + \fi + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{Labels} +% +% \begin{macro}{\outl@label} +% The |\outl@label| macro, called by |\outl| with the |outl@indsize| +% as an argument, simply decides which level to make by way of an +% |\ifcase| statement. +% \begin{macrocode} +\newcommand{\outl@label}[1]{% + \ifcase #1 + \@dolabeli\or\@dolabelii\or\@dolabeliii% + \or\@dolabeliv\or\@dolabelv\or\@dolabelvi% + \or\@dolabelvii\else\@dolabeldef% + \fi} +% \end{macrocode} +% \end{macro} +% The labels are set in |\labelfont|. I have a set of personal macros +% that define a |\labelfont| for other uses, so the declaration is +% surrounded by a test. +% \begin{macrocode} +\@ifundefined{labelfont} + {\DeclareOldFontCommand{\labelfont}% + {\normalfont\bfseries\mathversion{bold}}{\mathbf}} + {} % Do nothing---|\labelfont| is already defined +% \end{macrocode} +% The generic form of the outline labels is given by |\theoutlabel|. +% \begin{macrocode} +\newcommand{\theoutlabel}[1]{% + \llap{\hbox{\labelfont#1\enskip}}} +% \end{macrocode} +% Finally we define the macros which are called for the auto-numbering +% and label creation for the |\outl| macro. +% \changes{v0.6}{1996/04/26}{Changed \texttt{\protect\bslash stepcounter} +% call to \texttt{\protect\bslash refstepcounter} in order to get +% cross-referencing to work right.} +% \begin{macrocode} +\newcommand{\@dolabeli}{% + \refstepcounter{outli}\theoutlabel{\labeloutli}} +\newcommand{\@dolabelii}{% + \refstepcounter{outlii}\theoutlabel{\labeloutlii}} +\newcommand{\@dolabeliii}{% + \refstepcounter{outliii}\theoutlabel{\labeloutliii}} +\newcommand{\@dolabeliv}{% + \refstepcounter{outliv}\theoutlabel{\labeloutliv}} +\newcommand{\@dolabelv}{% + \refstepcounter{outlv}\theoutlabel{\labeloutlv}} +\newcommand{\@dolabelvi}{% + \refstepcounter{outlvi}\theoutlabel{\labeloutlvi}} +\newcommand{\@dolabelvii}{% + \refstepcounter{outlvii}\theoutlabel{\labeloutlvii}} +\newcommand{\@dolabeldef}{% + \refstepcounter{outldef}\theoutlabel{\labeloutldef}} +% \end{macrocode} +% And with that, we are finished. +% +% \iffalse +%</package> +% \fi +% +% \Finale diff --git a/Master/texmf-dist/source/latex/cjw/cjwoutl.ins b/Master/texmf-dist/source/latex/cjw/cjwoutl.ins new file mode 100644 index 00000000000..f93dcfa0587 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjw/cjwoutl.ins @@ -0,0 +1,18 @@ +\def\batchfile{cjwoutl.ins} +\input docstrip.tex + +\preamble + +Copyright (C) 1995 by Colin J. Wynne + +This file is part of cjwoutl, a package +for generating outlines with LaTeX2e. + +\endpreamble + +% Don't display progress +\keepsilent + +\generateFile{cjwoutl.sty}{t}{\from{cjwoutl.dtx}{package}} + +\endinput diff --git a/Master/texmf-dist/source/latex/cjw/cjwplain.dtx b/Master/texmf-dist/source/latex/cjw/cjwplain.dtx new file mode 100644 index 00000000000..494882b5a55 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjw/cjwplain.dtx @@ -0,0 +1,1007 @@ +% \iffalse -*- LaTeX -*- +% +% This is file `cjwplain.dtx'. You can run this file through +% LaTeX2e to get a .dvi file of documentation. The file +% `cjwplain.ins' should have come with this file. Run LaTeX2e on +% it to produce the actual input files. +% +%<+package|tabbing|output> \NeedsTeXFormat{LaTeX2e} +%<+package> \ProvidesPackage{cjwplain} +%<+tabbing> \ProvidesFile{cjwpltab.clo} +%<+output> \ProvidesFile{cjwplout.clo} +%<+package|tabbing|output> [1995/05/01 v0.5 +%<+package> Plain TeX Macros for LaTeX2e---CJW] +%<+tabbing> Plain TeX Tabbing Macros for LaTeX2e---CJW] +%<+output> Plain TeX Output Macros for LaTeX2e---CJW] +% +% \fi +\def\RCSinfo{$Id: cjwplain.dtx,v 1.2 1998/08/31 22:57:40 cwynne Exp $} + +\def\RCSsplit $#1: #2,v #3 #4 #5 #6 #7${ + \gdef\filename {#2} + \gdef\fileversion{#3} + \gdef\filedate {#4} + \gdef\filetime {#5} + \gdef\fileauthor {#6} + \gdef\filelocker {#7}} + +\expandafter\RCSsplit\RCSinfo +%% \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 +%% Lower-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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \CheckSum{1208} +% +% \iffalse +% +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{cjwplain.dtx} + [\filedate\space v\fileversion\space + The cjwplain Package for LaTeX2e---CJW] +\documentclass{ltxdoc} + \GetFileInfo{cjwplain.dtx} + \RecordChanges +\begin{document} + \DocInput{\filename} +\end{document} +%</driver> +% \fi +% +% \DeclareRobustCommand{\cseq}[1]{\texttt{\bslash#1}} +% \DeclareRobustCommand{\pkg} [1]{\textsf{#1}} +% \DeclareRobustCommand{\env} [1]{\textsf{#1}} +% +% \title{The \textsf{cjwplain} Package\thanks{% +% This file has version \fileversion.} \\ +% (\PlainTeX{} under \LaTeXe)} +% \author{Colin J.~Wynne\thanks{E-Mail at: +% \texttt{cwynne@brutus.mts.jhu.edu}, +% \texttt{cwynne@jhu.edu}\,.}} +% \date{\filedate} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% +% {\parskip 0pt ^^A% This is the hack used by |doc.dtx|. +% ^^A% (bug in \LaTeX?) +% \tableofcontents +% } +% +% \section*{Introduction} +% +% I first started using \TeX{} some two-and-a-half years ago, having +% been introduced to it by several \TeX nophiles in my college math +% department. I was aware from the start that there was a somehow +% `bastardised' version of this very good program which went by the +% name `\LaTeX'---invariably referred to by my \TeX{} mentors as +% `Lame\TeX'. Most of you have probably heard this epithet before. +% +% Well, I count it as a good thing that I was discouraged from using +% \LaTeX{} at first, as I ended up writing quite a lot of \TeX{} code +% for myself before I ever got around to actually reading \textit{The +% \TeX book} in its entirety, which I did only a few +% months ago. My first real project for \TeX{} was writing a large +% macro set for my undergraduate thesis---table of contents, marks for +% the running heads, chapter and section delineation and so forth. +% This growing library was expanded as I decided I wanted a good set +% of macros for writing outlines and by requirements for various +% papers, such as using endnotes in lieu of footnotes. This rather +% haphazard collection of mine underwent a major change when I found +% the macro package for NFSS (version 1) under \PlainTeX{}, of which I +% promptly took advantage. +% +% This year I finally got my own computer, mainly to run \TeX{}. +% Given my newly purchased copy of \textit{The \TeX book} and some +% free time, I began to try to organise that cluster of code. Having +% learned something in the meanwhile about generic markup, and why +% it is preferable, I started rewriting for more generalisation. Also +% in the meanwhile, \LaTeXe{} had come along, greatly enhancing +% \LaTeX's own use of generic markup. It also standardised the NFSS, +% which I had so come to appreciate. Basically, between the various +% chunks of \LaTeXe{} which I had already hacked to work under my +% custom format and the movement towards increasingly generic code by +% both myself and the \LaTeX{} folks, that a convergence was taking +% place, so I finally decided to give \LaTeXe{} a serious looking-at. +% +% I started by printing out the documented source code. I liked a lot +% of what I saw---but there were two problems. Some of my favourite +% bits of \PlainTeX{} got left by the wayside. For doing a lot of +% mathematics, I still find |\eqalign| to be the easiest way of +% aligning a bunch of related equations. First, it involves less +% typing than a |\begin|\ldots|\end| pair, and I don't often need +% equation numbers---something not easily done away with under vanilla +% \LaTeX. The bigger concern was that I had a bunch of source files +% that were written under \PlainTeX{} (or, rather, under \emph{my} +% \PlainTeX), and I didn't want to have to make the dozens of minor +% modifications necessary to get them to work under \LaTeX. +% +% So, I decided to learn how \LaTeX{} does things and to do so by +% writing a package that would, at its simplest, let me add a +% |\documentclass| and a |\begin{document}| line to one of my existing +% \PlainTeX{} sourc files and get it to compile under \LaTeX. +% +% Thus, I have written my first \LaTeX{} package. I consider the main +% feature to be the ability to very easily add NFSS commands to a +% document written under \PlainTeX. Secondly, maybe it will help +% convince some other \PlainTeX{} die-hards to give \LaTeX{} a try, +% inasmuch as all of their standard commands will be supported. +% Finally, it should let those who use \LaTeX{} exclusively to easily +% deal with \PlainTeX{} files if the need arises. +% +% \pagebreak +% Feel free to let me know if you find this package useful or, of +% course, if you find any bugs or wish to suggest improvements. +% +% \subsection*{This Package} +% +% This package is built over the file |ltplain.dtx|, or, more +% correctly, over those parts of |ltplain.dtx| which were changes to +% or omissions of the original \PlainTeX{} source. Some parts, +% specifically font changes, have not been reproduced in their +% entirety, due basically to the fact that such would be a pointless +% exercise. See the comments in Section \ref{sec:font} for the +% explanation. +% +% Finally, this document prints with all source code because I feel +% the source itself, and the modifications to it, are the best +% documentation. +% +% +% \section{Package Options} +% +% According to the documented \LaTeXe{} source file |ltplain.dtx|, +% \begin{quote} +% \LaTeX\ includes almost all of the functionality of Knuth's +% original `Basic Macros' That is, the plain \TeX\ format described +% in Appendix~B of the \TeX{}Book. +% \end{quote} +% It seems to me that removing the qualifying `almost' would be no bad +% thing. +% +% The idea behind the available options is that a given user may need +% only certain aspects of \PlainTeX{} added back in for a document. +% Furthermore, the additional code can sometimes be specified in +% different ways---\emph{i.e.}, either strictly according to the +% definitions of \PlainTeX{} or in a manner syntactically identical to +% \PlainTeX{} but functionally grounded in \LaTeX. The overall goal, +% though, is completeness; I have therefore included everything, in +% one form or another, even when I can't think of a reason why some +% things would be necessary. +% +% There are nineteen regular and two special options available for the +% |cjwplain| package. (All are entered in standard \LaTeX{} form, as +% optional arguments to the |\usepackage| command. I only call two of +% them `special' so as to draw attention to them.) +% +% \subsection{Regular Options} +% +% \DescribeMacro{Options} +% The regular options are: +% \changes{v0.5}{1995/06/08}{Added \env{plainskips} and +% \env{plainskipsoff}.} +% \begin{center} +% \begin{tabular}{llll} +% outerallocs & diagnostics & plainskips \\ +% outerallocsoff & diagnosticsoff & plainskipsoff \\ +% strictline & tabbing & strictitem \\ +% strictlineoff & tabbingoff & strictitemoff \\ +% eqalign & magnification & plainoutput \\ +% eqalignoff & magnificationoff & plainoutputoff \\ +% strictfootnotes & altfootnotes & footnotesoff \\ +% \end{tabular} +% \end{center} +% Note that most of these options come in +% \meta{option}/\meta{option}|off| pairs. These are +% particularly useful in conjunction with the special options +% (\ref{sec:spec-opts}) or to toggle the default options. By default, +% the options |diagnostics|, |tabbing| and |eqalign| are active (just +% what I tend to use\ldots). +% +% The actual options will be explained in section \ref{sec:code}. +% Keep in mind, though, that some options affect others---for example +% selecting one of |strictfootnotes| and |altfootnotes| will +% automatically turn the other off; you can, however, disable both +% forms either with |footnotesoff| or by giving the two separate +% \ldots|off| commands separately. Also, |plainoutput| requires +% |strictfootnotes| and |magnification|, but |plainoutputoff| itself +% does not disable the \PlainTeX{} footnote macros or magnification. +% +% \subsection{Special Options} +% \label{sec:spec-opts} +% +% \DescribeMacro{none}\DescribeMacro{all} +% Two options, called |none| and |all|, are available to allow maximum +% flexibility. These function because |cjwplain| calls the starred +% command |\ProcessOptions*| and therefore processes options in the +% order specified to |\usepackage|, and not the package's internal +% declaration order. Thus, to make only \PlainTeX's tabbing commands +% available, one would use the call +% \begin{verbatim} +% \usepackage[none,tabbing]{cjwplain} +% \end{verbatim} +% and to use everything while leaving \LaTeX's |\item| command alone +% one would enter the command +% \begin{verbatim} +% \usepackage[all,strictitemoff]{cjwplain} +% \end{verbatim} +% in the preamble. +% +%\StopEventually{\PrintChanges\PrintIndex} +% +% \section{The Code} +% \label{sec:code} +% +% \subsection{Declarations} +% +% The options are implemented as |\if| statements, as that seemed to +% me to be the easiest way of including or excluding relatively large +% sections of code. First we allocate the |\if|s. +% \changes{v0.5}{1995/06/04}{Added \cseq{if@plainskips} and related macros +% for the \textsf{plainskips} option.} +% \begin{macrocode} +%<*package> +\newif\if@outerallocs \@outerallocsfalse +\newif\if@diagnostics \@diagnosticstrue +\newif\if@plainskips \@plainskipsfalse +\newif\if@strictline \@strictlinetrue +\newif\if@tabbing \@tabbingtrue +\newif\if@strictitem \@strictitemfalse +\newif\if@eqalign \@eqaligntrue +\newif\if@strictfootnotes \@strictfootnotesfalse +\newif\if@altfootnotes \@altfootnotesfalse +\newif\if@plainoutput \@plainoutputfalse +\newif\if@magnification \@magnificationfalse +% \end{macrocode} +% +% Now we declare how the options affect these |\if| tests. +% +% \begin{macrocode} +\DeclareOption{outerallocs}{\@outerallocstrue} +\DeclareOption{outerallocsoff}{\@outerallocsfalse} + +\DeclareOption{diagnostics}{\@diagnosticstrue} +\DeclareOption{diagnosticsoff}{\@diagnosticsfalse} + +\DeclareOption{plainskips}{\@plainskipstrue} +\DeclareOption{planiskipsoff}{\@plainskipsfalse} + +\DeclareOption{strictline}{\@strictlinetrue} +\DeclareOption{strictlineoff}{\@strictlinefalse} + +\DeclareOption{tabbing}{\@tabbingtrue} +\DeclareOption{tabbingoff}{\@tabbingfalse} + +\DeclareOption{strictitem}{\@strictitemtrue} +\DeclareOption{strictitemoff}{\@strictitemfalse} + +\DeclareOption{eqalign}{\@eqaligntrue} +\DeclareOption{eqalignoff}{\@eqalignfalse} +% \end{macrocode} +% +% We will have two possible ways of providing a |\footnote| command. +% As these are mutually exclusive, we make sure that they cannot both +% be true. +% \begin{macrocode} +\DeclareOption{strictfootnotes}{% + \@strictfootnotestrue \@altfootnotesfalse} +\DeclareOption{altfootnotes}{% + \@altfootnotestrue \@strictfootnotesfalse} +\DeclareOption{footnotesoff}{% + \@altfootnotesfalse \@strictfootnotesfalse} + +\DeclareOption{magnification}{\@magnificationtrue} +\DeclareOption{magnificationoff}{\@magnificationfalse} +% \end{macrocode} +% To use \PlainTeX's entire output routine will require that +% magnification code as well as \PlainTeX{} style footnotes be +% defined. +% \begin{macrocode} +\DeclareOption{plainoutput}{% + \@plainoutputtrue \@strictfootnotestrue + \@altfootnotesfalse \@magnificationtrue} +\DeclareOption{plainoutputoff}{\@plainoutputfalse} +% \end{macrocode} +% The two special options are given. +% \begin{macrocode} +\DeclareOption{none}{% + \@outerallocsfalse \@eqalignfalse + \@diagnosticsfalse \@plainskipsfalse + \@strictfootnotesfalse\@strictlinefalse + \@altfootnotesfalse \@tabbingfalse + \@magnificationfalse \@strictitemfalse + \@plainoutputfalse} + +\DeclareOption{all}{% + \@outerallocstrue \@eqaligntrue + \@diagnosticstrue \@plainskipstrue + \@strictfootnotestrue\@strictlinetrue + \@altfootnotestrue \@tabbingtrue + \@magnificationtrue \@strictitemtrue + \@plainoutputtrue} +% \end{macrocode} +% Finally we define a default option handling routine. I prefer only +% a warning as opposed to an error. +% \begin{macrocode} +\DeclareOption*{% + \PackageWarning{cjwplain}{Unknown option `\CurrentOption'}} +% \end{macrocode} +% Now that all the options are declared, we process them in the order +% specified in the package call. +% \begin{macrocode} +\ProcessOptions* +% \end{macrocode} +% +% \subsection{Allocation Calls: \env{outerallocs}} +% +%\DescribeMacro{\newcount} +%\DescribeMacro{\newdimen} +%\DescribeMacro{\newskip} +%\DescribeMacro{\newbox} +%\DescribeMacro{\newwrite} +%\DescribeMacro{\newfam} +% Originally \PlainTeX{} had all allocation macros (|\newcount|, etc.) +% defined as |\outer|. \LaTeX{} redefines several of them to be +% non-outer. Careful consideration has failed to yield to me why +% these would need to be rewritten as |\outer| in this package---any +% \PlainTeX{} file which expects |\outer| definitions would not call +% them in a non-outer position, and any other files would themselves +% have redefined versions of the macros. +% +% Since, however, it is such a small change, we will provide it. +% \textsc{Note:} Using the |outerallocs| option will break a good +% deal of standard \LaTeX{} code, namely the standard macros for +% counters and lengths. This means you probably do \emph{not} want +% to use it. It is here only for completeness's sake. +% \begin{macrocode} +\if@outerallocs + +\outer\def\newcount{\alloc@0\count\countdef\insc@unt} +\outer\def\newdimen{\alloc@1\dimen\dimendef\insc@unt} +\outer\def\newskip{\alloc@2\skip\skipdef\insc@unt} + +\outer\def\newbox{\alloc@4\box\chardef\insc@unt} +\outer\def\newwrite{\alloc@7\write\chardef\sixt@@n} +\outer\def\newfam{\alloc@8\fam\chardef\sixt@@n} + +\fi +% \end{macrocode} +% +% \subsection{Error Processing: \env{diagnostics}} +% +% Any \PlainTeX{} afficianados using this package will feel more +% comfortable to have the standard values for error processing +% information. One change, though. \LaTeXe{} uses a \emph{counter} +% named |errorcontextlines|, and not a count. +% +% \begin{macrocode} +\if@diagnostics + +\showboxbreadth=5 +\showboxdepth=3 +\setcounter{errorcontextlines}{5} + +\fi +% \end{macrocode} +% +% \subsection{Skips: \env{plainskips}} +% \changes{v0.5}{1995/06/08}{Added the sub-section `Skips'.} +% +% When the |plainskips| option is selected, the three |\|\dots|skip| +% macros should unconditionally leave horizontal mode and insert a +% skip, like in \PlainTeX. +% \begin{macrocode} +\if@plainskips + \def\smallskip{\vskip\smallskipamount} + \def\medskip{\vskip\medskipamount} + \def\bigskip{\vskip\bigskipamount} +\fi +% \end{macrocode} +% +% \subsection{Fonts} +% \label{sec:font} +% +% A package already exists whereby oldstyle font commands can be +% given, namely |oldlfont|. Furthermore, one can use |rawfonts|, if +% necessary, to load in such specific fonts as |\ninebf|, etc. +% +% \begin{macrocode} +%\font\tenrm=cmr10 % roman text +% \end{macrocode} +% \qquad$\vdots$ +% \begin{macrocode} +%\textfont\ttfam=\tentt +% \end{macrocode} +% +% \subsection{The \cseq{line} Macro: \env{strictline}} +% +%\DescribeMacro{\line} +%\DescribeMacro{\latex@line} +% Now we get to the first tricky part. The |\line| macro needs to be +% available to the |picture| environment in \LaTeX, as well as +% restoring the original \PlainTeX{} definition for our usage here. +% The good news is that \LaTeX{} \emph{only} uses |\line| inside of +% the |picture| environment. So we employ the following solution: we +% keep the definition of |\@@line| as per \LaTeX{} convention, and +% give in any case a user accessible |\plainline|. +% \begin{macrocode} +\let\plainline\@@line + +\if@strictline + +%\def\@@line{\hbox to\hsize} % Defined in |ltplain.dtx| +% \end{macrocode} +% Now we define an internal name for the standard \LaTeX{} macro and +% restore the \PlainTeX{} definition. +% \begin{macrocode} +\let\latex@line\line +\let\line\@@line +% \end{macrocode} +% The definitions of |\leftline|, |\rightline| and |\centerline| can +% be left as is (though users depending upon personal redefinitions of +% |\line| for special effects in these macros should simply put their +% redefinition into the macro |\@@line|). +% \begin{macrocode} +%\def\leftline#1{\@@line{#1\hss}} +%\def\rightline#1{\@@line{\hss#1}} +%\def\centerline#1{\@@line{\hss#1\hss}} +% \end{macrocode} +% Now we make a patch to the definition of |\@picture| (the workhorse +% macro for the |picture| environment) which will restore the \LaTeX{} +% definition only within that environment. +% \begin{macrocode} +\def\@picture(#1,#2)(#3,#4){% + \let\line\latex@line% + \@picht#2\unitlength + \setbox\@picbox\hbox to#1\unitlength\bgroup + \hskip -#3\unitlength + \lower #4\unitlength\hbox\bgroup + \ignorespaces} + +\fi +% \end{macrocode} +% +% \subsection{Tab Alignments: \env{tabbing}} +% +% The tabbing macros from \PlainTeX{} use the |\newif| construction, +% so must occur at an |\outer| level. Thus, they are included in a +% separate package. +% \changes{v0.5}{1995/06/04}{Use \cseq{InputIfFileExists} instead of +% \cseq{RequirePackage} to input \pkg{cjwpltab.clo}; otherwise a +% warning (error?) is produced, since the latter expects a +% \pkg{.sty} file.} +% \begin{macrocode} +\if@tabbing + \InputIfFileExists{cjwpltab.clo}{}{% + \PackageWarning{cjwplain}{Option `cjwpltab.clo' not found.} + \@tabbingfalse} +\fi +%</package> +%<*tabbing> +% \end{macrocode} +% +%\DescribeMacro{\cleartabs} +%\DescribeMacro{\settabs} +%\DescribeMacro{\tabalign} +%\DescribeMacro{\+} +% \LaTeX{} may have it's own tabbing environment, but I like +% \PlainTeX's. The only potential conflict I saw was with the +% \verb|\+| macro. However, \LaTeX{} only defines \verb|\+| inside of +% the |tabbing| environment itself, so there should be absolutely no +% problem. +% \begin{macrocode} +\newif\ifus@ \newif\if@cr +\newbox\tabs \newbox\tabsyet \newbox\tabsdone + +\def\cleartabs{\global\setbox\tabsyet\null \setbox\tabs\null} +\def\settabs{\setbox\tabs\null \futurelet\next\sett@b} +\let\+=\relax % in case this file is being read in twice +\def\sett@b{\ifx\next\+\let\next\relax +\def\next{\afterassignment\s@tt@b\let\next}% + \else\let\next\s@tcols\fi\next} +\def\s@tt@b{\let\next\relax\us@false\m@ketabbox} +\def\tabalign{\us@true\m@ketabbox} % non-\outer version of \+ +\outer\def\+{\tabalign} +\def\s@tcols#1\columns{\count@#1 \dimen@\hsize + \loop\ifnum\count@>\z@ \@nother \repeat} +\def\@nother{\dimen@ii\dimen@ \divide\dimen@ii\count@ + \setbox\tabs\hbox{\hbox to\dimen@ii{}\unhbox\tabs}% + \advance\dimen@-\dimen@ii \advance\count@\m@ne} + +\def\m@ketabbox{\begingroup + \global\setbox\tabsyet\copy\tabs + \global\setbox\tabsdone\null + \def\cr{\@crtrue\crcr\egroup\egroup +\ifus@\unvbox\z@\lastbox\fi\endgroup +\setbox\tabs\hbox{\unhbox\tabsyet\unhbox\tabsdone}}% + \setbox\z@\vbox\bgroup\@crfalse +\ialign\bgroup&\t@bbox##\t@bb@x\crcr} + +\def\t@bbox{\setbox\z@\hbox\bgroup} +\def\t@bb@x{\if@cr\egroup % now \box\z@ holds the column + \else\hss\egroup \global\setbox\tabsyet\hbox{\unhbox\tabsyet + \global\setbox\@ne\lastbox}% now \box\@ne holds its size +\ifvoid\@ne\global\setbox\@ne\hbox to\wd\z@{}% +\else\setbox\z@\hbox to\wd\@ne{\unhbox\z@}\fi +\global\setbox\tabsdone\hbox{\box\@ne\unhbox\tabsdone}\fi + \box\z@} +%</tabbing> +%<*package> +% \end{macrocode} +% +% \subsection{Itemising: \env{strictitem}} +% +%\DescribeMacro{\@@item} +%\DescribeMacro{\plainitem} +% Now we have another problem, namely the |\item| macro. I +% unfortunately see no way to get around the fact that |\item| is a +% general macro in \LaTeX{}, and that the formats are completely +% different: i.e., \PlainTeX{} expects the \meta{label} to be the one +% mandatory argument, whereas \LaTeX's |\item| macro takes the +% \meta{label} as an optional argument. Thus, the best I can think of +% is the following. We redefine \PlainTeX's |\item| after standard +% \LaTeX{} practice, +% \begin{macrocode} +\def\@@item{\par\hang\textindent} +% \end{macrocode} +% and we |\let| it to something accessible in normal documents, the +% command |\plainitem|. +% \begin{macrocode} +\let\plainitem\@@item +% \end{macrocode} +% The command |\itemitem| can be taken care of directly. +% \begin{macrocode} +\def\itemitem{\par\indent \hangindent2\parindent \textindent} +% \end{macrocode} +% +% Now a user will have to replace all occurrences of |\item{foo}| with +% either |\item[foo]| or |\plainitem{foo}| (I imagine the choice will +% depend upon one's editor's facilities with regexps\ldots). It's not +% perfect, but it's the only way I can think of to provide maximum +% compatibility. Of course, we will still give the option, +% |strictitem|, of using +% just the original definition, but that will probably not be terribly +% convenient for anyone trying to add \LaTeX{} features on top of an +% existing \PlainTeX{} source. Thus, we will also provide the +% (slightly longwinded) replacement |\latexitem|. +% \begin{macrocode} +\if@strictitem + \let\latexitem\item + \let\item\@@item +\fi +% \end{macrocode} +% +% \subsection{Miscellaneous} +% +% \subsubsection{Sectioning} +% +% I have personally never used the \PlainTeX{} |\beginsection| macro, +% but somebody might have\ldots +% \begin{macrocode} +\outer\def\beginsection#1\par{\vskip\z@ plus.3\vsize\penalty-250 + \vskip\z@ plus-.3\vsize\bigskip\vskip\parskip + \message{#1}\leftline{\bf#1}\nobreak\smallskip\noindent} +% \end{macrocode} +% +% \subsubsection{Proclamations} +% +% Once again we will leave \LaTeX's NFSS based redefinition, this time +% for the |\proclaim| command, in place. +% \begin{macrocode} +%\outer\def\proclaim #1. #2\par{\medbreak +% \noindent{\bfseries#1.\enspace}{\slshape#2\par}% +% \ifdim\lastskip<\medskipamount \removelastskip\penalty55\medskip\fi} +% \end{macrocode} +% +% \subsubsection{Paragraph Formatting} +% +% I have done some simple tests of \LaTeX's |\raggedright| macro, and +% it seems to me that it mimics the functionality of the \PlainTeX{} +% macro of the same name. Therefore I see no reason to redefine it as +% part of this package. +% \begin{macrocode} +%\def\raggedright{% +% \rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax} +% \end{macrocode} +% Another \LaTeX{} font change will also be left as is. +% \begin{macrocode} +%\def\ttraggedright{\reset@font\ttfamily\rightskip\z@ plus2em\relax} +% \end{macrocode} +% +% \subsubsection{Accents and Miscellaneous} +% +% These should work as is for \PlainTeX{} documents. +% \begin{macrocode} +%\def\_{\leavevmode \kern.06em \vbox{\hrule \@width.3em}} +%\def\AA{\leavevmode\setbox0\hbox{h}\dimen@\ht0\advance\dimen@-1ex% +% \rlap{\raise.67\dimen@\hbox{\char'27}}A} +% \end{macrocode} +% Nor do I see a reason to change these back to \PlainTeX{} +% definitions. +% \begin{macrocode} +%\def\pd#1{\oalign{#1\crcr\hidewidth\sh@ft{08}.\hidewidth}} +%\def\d{\protect\pd} +% +%\def\pb#1{\oalign{#1\crcr\hidewidth\sh@ft{29}% +%\vbox to.2ex{\hbox{\char22}\vss}\hidewidth}} +%\def\b{\protect\pb} +% +%\def\pc#1{\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1% +% \else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi} +%\def\c{\protect\pc} +% +%\def\pt#1{{\edef\next{\the\font}\the\textfont1\accent127\next#1}} +%\def\t{\protect\pt} +% \end{macrocode} +% +% The \LaTeX{} definition of |\ldots| is more or less identical to the +% \PlainTeX{} macro |\dots|. So we will leave this alone, too. +% \begin{macrocode} +%\def\dots{\ldots} +% \end{macrocode} +% +% These changes, as others before, only add functionality without +% seeming to limit \PlainTeX{} usage, so no change will be made. +% \begin{macrocode} +%\def\hrulefill{\leavevmode\leaders\hrule\hfill\kern\z@} +%\def\dotfill{\leavevmode\cleaders +% \hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfill\kern\z@} +% +%\def\longrightarrow{\protect\@lra} +% \def\@lra{\relbar\joinrel\rightarrow} +%\def\longleftarrow{\protect\@lla} +% \def\@lla{\leftarrow\joinrel\relbar} +% \end{macrocode} +% +% \subsubsection{Ending the Document} +% +% We simply add the |\bye| macro back in, though the |\end| should be +% changed to the \LaTeX{} |\end{document}|. +% \begin{macrocode} +\outer\def\bye{\end{document}} +% \end{macrocode} +% +% +% \subsubsection{Math Commands} +% +% Operators and other math-mode font-related changes will be ignored +% with as other NFSS alterations already mentioned. +% \begin{macrocode} +%\def\log{\mathop{\rm log}\nolimits} +%\def\lg{\mathop{\rm lg}\nolimits} +%\def\deg{\mathop{\rm deg}\nolimits} +% \end{macrocode} +%\qquad$\vdots$ +% \begin{macrocode} +%\def\bmod{\mskip-\medmuskip\mkern5mu +% \mathbin{\rm mod}\penalty900\mkern5mu\mskip-\medmuskip} +%\def\pmod#1{\allowbreak\mkern18mu({\rm mod}\,\,#1)} +% \end{macrocode} +% Various |\matrix| type command, including |\bordermatrix| and +% |\cases| have similarly been rewritten for NFSS commands under +% \LaTeX. +% +% \subsection{Math Alignment: \env{eqalign}} +% +%\DescribeMacro{\eqalign} +%\DescribeMacro{\eqalignno} +%\DescribeMacro{\leqalignno} +% If the |eqalign| option has been selected, we add |\eqalign| back +% in, as well as related macros. Notice that we use the |\@centering| +% macro provided by \LaTeX, because \LaTeX{} itself reserves +% |\centering|. We also supply a user macro |\plaincentering| in case +% such is needed. +% \begin{macrocode} +\let\plaincentering\@centering + +\if@eqalign + +\def\eqalign#1{\null\,\vcenter{\openup\jot\m@th + \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil + \crcr#1\crcr}}\,} + +\def\eqalignno#1{\displ@y \tabskip\@centering + \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip + &$\@lign\displaystyle{{}##}$\hfil\tabskip\@centering + &\llap{$\@lign##$}\tabskip\z@skip\crcr + #1\crcr}} +\def\leqalignno#1{\displ@y \tabskip\@centering + \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip + &$\@lign\displaystyle{{}##}$\hfil\tabskip\@centering + &\kern-\displaywidth\rlap{$\@lign##$}\tabskip\displaywidth\crcr + #1\crcr}} + +\else +% \end{macrocode} +%\DescribeEnv{eqnarray*} +% If the user does not choose this option, we will instead define an +% |eqnarray*| environment which does not number equations. +% \begin{macrocode} +\@namedef{eqnarray*}{% + \let \\ \cr $$\null\,\vcenter{\openup\jot\m@th + \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil\crcr}}} +\@namedef{endeqnarray*}{\crcr} + +\fi +% \end{macrocode} +% +% \subsection{Output Routine: \env{plainoutput}} +% +% The output routines also involve |\newif| commands, and are +% therefore also relegated to a separate package. +% \changes{v0.5}{1995/06/04}{Use \cseq{InputIfFileExists} instead of +% \cseq{RequirePackage} to input \pkg{cjwplout.clo}; otherwise a +% warning (error?) is produced, since the latter expects a +% \pkg{.sty} file.} +% \begin{macrocode} +\if@plainoutput + \InputIfFileExists{cjwplout.clo}{}{% + \PackageWarning{cjwplain}{Option `cjwplout.clo' not found.} + \@tabbingfalse} +\fi +%</package> +%<*output> +% \end{macrocode} +% +%\DescribeMacro{\headline} +%\DescribeMacro{\footline} +%\DescribeMacro{\pageno} +%\DescribeMacro{\folio} +% If the user wishes to use the entire \PlainTeX{} output routine, we +% first redefine the normal versions of |headline|, |footline| and +% |pageno|, as well as related macros. We will use NFSS definitions +% in place of |\tenrm|. +% \begin{macrocode} +\countdef\pageno=0 \pageno=1 % first page is number 1 +\newtoks\headline \headline={\hfil} % headline is normally blank +\newtoks\footline \footline={\hss\reset@font\folio\hss} + % footline is normally a centered page number in font \tenrm +\def\nopagenumbers{\footline{\hfil}} % blank out the footline +\def\folio{% + \ifnum\pageno<\z@ \romannumeral-\pageno \else\number\pageno \fi} +\def\advancepageno{\ifnum\pageno<\z@ \global\advance\pageno\m@ne + \else\global\advance\pageno\@ne \fi} % increase |pageno| +% \end{macrocode} +%\DescribeMacro{\raggedbottom} +%\DescribeMacro{\normalbottom} +% We also supply the |\raggedbottom| macro and its counterpart, +% |\normalbottom|. +% \begin{macrocode} +\newif\ifr@ggedbottom +\def\raggedbottom{\topskip 10\p@ plus60\p@ \r@ggedbottomtrue} +\def\normalbottom{\topskip 10\p@ \r@ggedbottomfalse} + % undoes \raggedbottom +% \end{macrocode} +% +%\DescribeMacro{\topinsert} +%\DescribeMacro{\midinsert} +%\DescribeMacro{\pageinsert} +% If the entire output routine is being used, we define the +% \PlainTeX{} insertion macros as normal. +% \begin{macrocode} +\newinsert\topins +\newif\ifp@ge \newif\if@mid +\def\topinsert{\@midfalse\p@gefalse\@ins} +\def\midinsert{\@midtrue\@ins} +\def\pageinsert{\@midfalse\p@getrue\@ins} +\skip\topins=\z@skip % no space added when a topinsert is present +\count\topins=1000 % magnification factor (1 to 1) +\dimen\topins=\maxdimen % no limit per page +\def\@ins{\par\begingroup\setbox\z@\vbox\bgroup} % start a \vbox +\def\endinsert{\egroup % finish the \vbox + \if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@ \advance\dimen@12\p@ + \advance\dimen@\pagetotal \advance\dimen@-\pageshrink + \ifdim\dimen@>\pagegoal\@midfalse\p@gefalse\fi\fi + \if@mid \bigskip\box\z@\bigbreak + \else\insert\topins{\penalty100 % floating insertion + \splittopskip\z@skip + \splitmaxdepth\maxdimen \floatingpenalty\z@ + \ifp@ge \dimen@\dp\z@ + \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero + \else \box\z@\nobreak\bigskip\fi}\fi\endgroup} +% \end{macrocode} +% +%\DescribeMacro{\plainoutput} +% Now we define the main part of the output routine. We use |\@@line| +% instead of |\line|, since |\@@line| is guaranteed to have the +% definition we want. +% \begin{macrocode} +\def\plainoutput{\shipout\vbox{\makeheadline\pagebody\makefootline}% + \advancepageno + \ifnum\outputpenalty>-\@MM \else\dosupereject\fi} +\def\pagebody{\vbox to\vsize{\boxmaxdepth\maxdepth \pagecontents}} +\def\makeheadline{\vbox to\z@{\vskip-22.5\p@ + \@@line{\vbox to8.5\p@{}\the\headline}\vss}\nointerlineskip} +\def\makefootline{\baselineskip24\p@\@@line{\the\footline}} +\def\dosupereject{\ifnum\insertpenalties>\z@ + % something is being held over + \@@line{}\kern-\topskip\nobreak\vfill\supereject\fi} + +\def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi + \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255 + \ifvoid\footins\else % footnote info is present + \vskip\skip\footins + \footnoterule + \unvbox\footins\fi + \ifr@ggedbottom \kern-\dimen@ \vfil \fi} +% \end{macrocode} +% Finally, we make the \PlainTeX{} output routines active again. +% \begin{macrocode} + \output{\plainoutput} +%</output> +%<*package> +% \end{macrocode} +% +% \subsubsection{Page Numbering, Running Heads and Miscellaneous} +% +% We can make the \PlainTeX{} head and foot commands accessible (after +% a fashion), even if the entire output routine is not being used. +% \LaTeXe{} provides the commands |\@oddhead| and |\@evenhead|, as +% well as their footline equivalents. Therefore we can give the +% following versions. +% \begin{macrocode} +\if@plainoutput\else + +\def\footline{\@ifnextchar ={\@@footline}{\@@footline=}} +\def\@@footline=#1{\gdef\@oddfoot{#1} \gdef\@evenfoot{#1}} + +\def\headline{\@ifnextchar ={\@@headline}{\@@headline=}} +\def\@@headline=#1{\gdef\@oddhead{#1} \gdef\@evenhead{#1}} + +\def\nopagenumbers{\let\@oddfoot\relax \let\@evenfoot\relax} +% \end{macrocode} +% Since the \PlainTeX{} |\headline| and |\footline| macros are +% actually tokens, we have to allow that the assignments to them can +% be made with an optional $=$. The use of |\@ifnextchar =| nicely +% takes care of that. This will alas be a slightly inefficient use of +% the macros, as many \PlainTeX{} heads and feet already test for odd +% and even pages---but not all of them. So, we compromise. +% +% Now we can simply make |\pageno| an equivalent for the \LaTeX{} +% counter |\c@page|. +% \begin{macrocode} +\let\pageno\c@page +% \end{macrocode} +% This means that assignments can either be made in primitive fashion +% directly to |\pageno| or in \LaTeX fashion to the |page| counter. +% We would also like to have the \PlainTeX{} |\folio| macro. We are +% going to expand upon this slightly, though. I find |\folio| +% generally to be a useful command, so we will write it in such a way +% as to make it useful with \LaTeX{} counters (as with, say, the +% |\arabic| macro) as well as with counts. +% \begin{macrocode} +\newcommand{\folio}[1][\pageno]{\@folio{#1}} +\def\@folio#1{% + \edef\@tempa{\string#1}% + \expandafter\@ifundefined{c@\@tempa}% % Does the counter exist? + {% % No such counter. + \ifnum #1 <\z@ \romannumeral-#1 + \else \number #1 + \fi + }% + {% % It is a counter. + \ifnum\value{#1}<\z@ \roman{#1} \else \arabic{#1} \fi} + } +% \end{macrocode} +% This is not, unfortunately, perfect, in that it must be used with an +% optional argument (|\folio[section]|) as opposed to the normal style +% (|\arabic{section}|). On the other hand, I can't think of many +% applications for |\folio| \emph{other} than page numbering. At any +% rate, we finish page numbering with the incrementation command. +% \begin{macrocode} +\def\advancepageno{\ifnum\pageno<\z@ \global\advance\pageno\m@ne + \else\global\advance\pageno\@ne \fi} +% \end{macrocode} +% +% One more bit from the \PlainTeX{} output routine needs to be dealt +% with. Although \LaTeX's |\raggedbottom| macro will suffice to +% simulate \PlainTeX's command of the same name, we need to add a +% |\let| command to enable \PlainTeX's counterpart, |\normalbottom|. +% \begin{macrocode} +\let\normalbottom\flushbottom +% \end{macrocode} +% +% \subsubsection{Insertions} +% +% If the \PlainTeX{} output routine is not being used, we simulate the +% insertions using \LaTeX's |figure| environment. +% \begin{macrocode} +\def\topinsert{\begin{figure}[t]} +\def\pageinsert{\begin{figure}[p]} +\def\midinsert{\begin{figure}[htpb]} +\def\endinsert{\end{figure}} + +\fi +% \end{macrocode} +% +% \subsubsection{Footnotes: \env{srictfootnotes}, +% \env{altfootnotes}} +% +% We define |\@@footnote| as \PlainTeX's footnoting macro. +% \begin{macrocode} +%\newinsert\footins + +\let\latex@footnote\footnote + +\def\@@footnote#1{\let\@sf\empty % parameter #2 (the text) is read later + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi + #1\@sf\vfootnote{#1}} +\def\vfootnote#1{\insert\footins\bgroup + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox \floatingpenalty\@MM + \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip + \xspaceskip\z@skip + \textindent{#1}\footstrut\futurelet\next\fo@t} +\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t + \else\let\next\f@t\fi \next} +\def\f@@t{\bgroup\aftergroup\@foot\let\next} +\def\f@t#1{#1\@foot} +\def\@foot{\strut\egroup} +\def\footstrut{\vbox to\splittopskip{}} +% \end{macrocode} +% \LaTeX{} leaves these initializations for the |\footins| insert. +% \begin{macrocode} +%\skip\footins=\bigskipamount % space added when footnote is present +%\count\footins=1000 % footnote magnification factor (1 to 1) +%\dimen\footins=8in % maximum footnotes per page +% \end{macrocode} +% +% Now we have several options for how to really deal with footnotes. +% The easy answer is to do them entirely according to \PlainTeX. +% \begin{macrocode} +\if@strictfootnotes + \let\footnote\@@footnote +\fi +% \end{macrocode} +% The second option is to just use the \LaTeX{} |\footnote| command. +% This needs no rewriting, of course. The last option is to rewrite +% \LaTeX's |\footnote| macro to use the \PlainTeX{} format instead of +% the \LaTeX{} format, which uses an optional argument. +% \begin{macrocode} +\if@altfootnotes + \def\footnote#1{\latex@footnote[#1]} +\fi +% \end{macrocode} +% \LaTeX{} keeps \PlainTeX's |\footnoterule| as the default. +% \begin{macrocode} +%\def\footnoterule{\kern-3\p@ +% \hrule \@width 2in \kern 2.6\p@} % the \hrule is .4pt high +% \end{macrocode} +% +% \subsubsection{Magnification: \env{magnification}} +% +% The last part of \PlainTeX{} for which we need to account is +% magnification. +% The magnification macros are easily reinstated, either as part of +% the overall \PlainTeX{} output routine or standalone. Since the +% |\mag| primitive is not disabled, it \emph{could} still be used in +% \LaTeX. However, \LaTeX{} does not itself work with |true| units +% any usage of |\magnification| could do some strange things to your +% page layouts. +% \begin{macrocode} +\if@magnification + \def\magnification{\afterassignment\m@g\count@} + \def\m@g{\mag\count@ + \hsize6.5truein\vsize8.9truein\dimen\footins8truein} +\fi +% \end{macrocode} +% +% This brings us to the end of the main package. +% \begin{macrocode} +%</package> +% \end{macrocode} +%\Finale diff --git a/Master/texmf-dist/source/latex/cjw/cjwplain.ins b/Master/texmf-dist/source/latex/cjw/cjwplain.ins new file mode 100644 index 00000000000..05ea718657e --- /dev/null +++ b/Master/texmf-dist/source/latex/cjw/cjwplain.ins @@ -0,0 +1,20 @@ +\def\batchfile{cjwplain.ins} +\input docstrip.tex + +\preamble + +Copyright (C) 1995 by Colin J. Wynne + +This file is part of cjwplain, a style providing +Plain TeX functionality under LaTeX2e. + +\endpreamble + +% Don't display progress +\keepsilent + +\generateFile{cjwplain.sty}{t}{\from{cjwplain.dtx}{package}} +\generateFile{cjwpltab.clo}{t}{\from{cjwplain.dtx}{tabbing}} +\generateFile{cjwplout.clo}{t}{\from{cjwplain.dtx}{output}} + +\endinput |