diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/plain/contrib/tbe |
Initial commit
Diffstat (limited to 'macros/plain/contrib/tbe')
-rw-r--r-- | macros/plain/contrib/tbe/tbemacros.tex | 286 | ||||
-rw-r--r-- | macros/plain/contrib/tbe/tbesamples.tex | 548 |
2 files changed, 834 insertions, 0 deletions
diff --git a/macros/plain/contrib/tbe/tbemacros.tex b/macros/plain/contrib/tbe/tbemacros.tex new file mode 100644 index 0000000000..bcd9d29528 --- /dev/null +++ b/macros/plain/contrib/tbe/tbemacros.tex @@ -0,0 +1,286 @@ +% TBEMACROS, Version 1.0, July 10, 1991 + +%This file contains some new commands defined in the book `TeX by Example', +%by Arvind Borde (copyright (c) 1992, Academic Press). The commands may be +%copied and modified freely, as long as (1) such copies and modifications are +%not made or distributed for re-sale, (2) this notice is retained, and +%(3) the date of any modifications is added below this notice. + +%The commands are provided `as is'. The author provides no warranty whatsoever, +%either express or implied, regarding them, or with respect to their fitness +%for any particular purpose. + +%The commands were put together to demonstrate the versatility of TeX and the +%variety of applications possible with it. They are not all equally useful. +%An effort has been made to keep them reasonably simple and to avoid +%certain advanced constructions. Though this has meant sacrificing +%sophistication at various points, it should allow even new users to edit +%the definitions to suit their own purposes with relative ease. + +%Samples of the uses of these commands are to be found in a companion file, +%`TBESAMPLES.TEX'. + +%********** LETTERS ************************************************************ +\def\letterhead {\hrule height 1pt depth 0pt width\hsize + \medskip + \rightline{\vbox{\hsize 1.5true in \baselineskip=12pt \parindent=0pt + Your name, \hfil\break + Your address, \hfil\break + Etc. }}} + +\def\date #1{\rightline{\vbox{\hsize 1.5true in\noindent #1}}\bigskip} + +\def\address #1{\vbox{\baselineskip=12pt\halign{## \hfil\cr #1}}} + +\def\sal #1{\noindent #1} + +\def\endletter #1#2{\nobreak\medskip\rightline{\vbox{\hsize 1.5true in + \parindent=0pt #1\vskip 1.25 true cm #2}}} + +%********** MEMORANDA ********************************************************** +\def\block #1{\vbox{\hsize 2.5 true cm\noindent \bf#1:}} + +\def\memo TO:#1FROM:#2SUBJECT:#3DATE:#4\par{\centerline{\sl MEMO!} + \bigskip \hrule height1pt \medskip + \vbox{\parindent=75pt\parskip=1pt + \item{\block{TO}}#1 + \item{\block{FROM}}#2 + \item{\block{SUBJECT}}#3 + \item{\block{DATE}}#4 }\medskip \hrule height1pt \bigskip} + +%********** SCRIPTS ************************************************************ +\newcount\spk +\def\beginscript {\bgroup \parindent=0pt \spk=1 \sl \rightskip.4in + \def\par {\ifnum\spk=1 \endgraf \it \spk=2 \leftskip.4in \rightskip0in + \else \endgraf \sl \spk=1 \leftskip0in \rightskip.4in \fi}} + +\def\endscript {\egroup} + +%********** FERMAT ************************************************************* +\newcount\var \newcount\pw \newcount\tmp \newcount\cnt +\def\pow#1#2#3{\var=#1 \pw=#2 \tmp=\var \cnt=1 + \loop \multiply\var by\tmp \advance\cnt by1 \ifnum\cnt<\pw \repeat + \global#3=\var} + +\newcount\xf \newcount\xnf \newcount\yf \newcount\ynf \newcount\zf \newcount\znf +\def\n {\number} + +\def\fermat#1#2#3{$\global\xf=#1 \global\yf=#2 \global\pw=#3 + \pow{\xf}{\pw}{\xnf} \pow{\yf}{\pw}{\ynf} + \global\tmp=\ynf \global\advance\tmp by\xnf + {\n\xf}^{\n\pw}+{\n\yf}^{\n\pw}={\n\tmp}$.\hfil\break + \ifnum\xf>\yf \zf=\xf \else \zf=\yf \fi + \loop {\pow{\zf}{\pw}{\znf}} \ifnum\znf<\tmp \advance\zf by1 \repeat + \ifnum\znf=\tmp The sum seems to be exactly ${\n\zf}^{\n\pw}$. + \ifnum\pw=2 {\it Yawn!\/} Tell me something I don't know, will you? + \else Incredible! But, perhaps you'd better check my work.\fi + \else \advance\zf by-1 + This lies between ${\n\zf}^{\n\pw}$\pow{\zf}{\pw}{\znf}($={\n\znf}$) + \advance\zf by1 + and ${\n\zf}^{\n\pw}$\pow{\zf}{\pw}{\znf}($={\n\znf}$).\fi}% + +%********** FRAMING ************************************************************ +\def\frame #1#2#3#4{\vbox{\hrule height #1pt% TOP RULE + \hbox{\vrule width #1pt\kern #2pt% RULE AND SPACE ON LEFT + \vbox{\kern #2pt% SPACE AT TOP + \vbox{\hsize #3\noindent #4}% MATERIAL THAT WILL BE BOXED + \kern #2pt}% SPACE AT BOTTOM + \kern #2pt\vrule width #1pt}% SPACE AND RULE ON RIGHT + \hrule height0pt depth #1pt}}%, BOTTOM RULE + +\def\fitframe #1#2#3{\vbox{\hrule height#1pt% TOP RULE + \hbox{\vrule width#1pt\kern #2pt% RULE AND SPACE ON LEFT + \vbox{\kern #2pt\hbox{#3}\kern #2pt}% TOP, MATERIAL, BOTTOM + \kern #2pt\vrule width#1pt}% SPACE AND RULE ON RIGHT + \hrule height0pt depth#1pt}}% BOTTOM RULE + +\def\shframe #1#2#3#4{\vbox{\hrule height 0pt% NO TOP SHADOW + \hbox{\vrule width #1pt\kern 0pt% LEFT SHADOW + \vbox{\kern-#1pt\frame{.3}{#2}{#3}{#4}% SHADOW STARTS #1 PT FROM TOP + \kern-.3pt}% MOVE UP RULE THICKNESS AT BOT. + \kern-#1pt\vrule width 0pt}% STOPS #1 PT FROM RT; NO RT SHAD + \hrule height #1pt}}% BOTTOM SHADOW + +\def\s #1{\frame{.3}{2}{8pt}{\centerline{#1\vphantom{(}}}\ } + +%********** RULED TRAPEZOID **************************************************** +\newcount\tw %top width in pt +\newcount\bw %bottom width in pt +\newcount\h %height in pt +\newcount\bs %bottom shift in pt +\newcount\th %line thickness in 1/64th of a pt +\newcount\gp %line gap in 1/64th of a point +\newcount\rs %running shift +\newcount\rw %running width +\newcount\rh %running height +\newcount\tmp %for temporarily storing variables + +\def\trap #1#2#3#4#5#6{\vbox{\offinterlineskip + \tw=#1 \bw=#2 \h=#3 \bs=#4 \th=#5 \gp=#6 \rh=0 + \multiply\tw by 65536 \multiply\bw by 65536 \multiply\bs by 65536 + \multiply\th by 1024 \multiply\gp by 1024 + \loop + \tmp=\bs \multiply\tmp by\rh \divide\tmp by\h + \rs=\tmp %running shift calculated + \tmp=\bw \advance\tmp by-\tw \multiply\tmp by\rh + \divide\tmp by\h \advance\tmp by\tw \rw=\tmp %running width calculated + \hbox{\kern\rs sp\vrule height0sp depth\th sp width\rw sp}%RULE DRAWN HERE + \vskip\gp sp %GAP LEFT HERE + \ifnum\rh<\h \tmp=\rh \multiply\tmp by 65536 + \advance\tmp by\th \advance\tmp by\gp \divide\tmp by65536 \rh=\tmp + \repeat}}% + +\def\rect #1#2#3#4{\trap{#1}{#1}{#2}{0}{#3}{#4}}% + +%********** MULTIPLE COLUMN **************************************************** +\newcount\colnumber \newbox\col \newdimen\tmpdim \newdimen\size +\newdimen\coljump \coljump=.2 true in %GAP BETWEEN COLUMNS + +\def\niceskip {\vskip\baselineskip} +\def\nstrut {\vrule height\topskip depth0pt width0pt} %TO PROP THINGS UP +\def\divider{\hskip\coljump} +\def\dividerule{\dimen0=.4pt \dimen1=\coljump \advance\dimen1 by-\dimen0 + \divide\dimen1 by2 + \def\divider{\hskip\dimen1 \vrule width\dimen0 \hskip\dimen1}} + +\def\beginart #1/#2{\vbox\bgroup#1 \colnumber=#2 \parskip=0pt + \advance\colnumber by-1 \tmpdim=\coljump \multiply\tmpdim by\colnumber + \size=\hsize \advance\size by-\tmpdim + \advance\colnumber by1 \divide\size by\colnumber + \vbadness=10000 \hbadness=2000 \tolerance=2000 + \setbox\col=\vbox\bgroup\hsize\size \noindent\nstrut} + +\def\endart {\global\size=\baselineskip \vfil \egroup + \multiply\size by\colnumber \advance\size by-\baselineskip + \tmpdim=\ht\col \advance\tmpdim by\size \divide\tmpdim by\colnumber + \hbox{\splittopskip=\topskip \doittoit}\egroup} + +\def\doittoit{\ifnum\colnumber>0 \vsplit\col to \tmpdim + \global\advance\colnumber by-1 + \ifnum\colnumber>0 \divider \fi \doittoit \fi} + +%********** FONT AND CODE TABLE ************************************************ +\def\chartable #1{\smallbreak\vbox{\noindent% + \underbar{Characters in the {\sl#1\/} font, with decimal codes:} + \raggedright \hbadness5000 \tolerance10000 \medskip + \font\ft=#1 \ft \dimen0=14pt \baselineskip=\dimen0 + \ifdim\dimen0<3.25ex \baselineskip=3.25ex \fi \count255=0 \dimen0=10pt + \loop \setbox0=\hbox{\char\count255} + \ifdim\wd0>\dimen0 \dimen0=\wd0 \fi \advance\count255 by1 + \ifnum\count255<128 \repeat \count255=0 + \advance\dimen0 by 25pt \noindent \loop + \hbox to\dimen0{\hbox to23pt{\hfil\rm\the\count255:\ }\char\count255\hfil} + \advance\count255 by1 \ifnum\count255<128 \quad\repeat + \smallbreak} \font\tenrm=cmr10 } + +%********** THE `IGNORE' COMMAND *********************************************** +\def\ignore {\count255=0 \begingroup + \loop \catcode\count255=14 % Make everything a comment character. + \advance\count255 by1 \ifnum\count255<127 + \repeat \catcode`\!=0 } % Makes ! an escape character. +{\catcode`\!=0 !gdef!E{!endgroup}}% Defines the `stop ignoring' command. + +%********** STACKSYMBOLS ******************************************************* +\def\stacksymbols #1#2#3#4{\def\theguybelow{#2} + \def\verticalposition{\lower#3pt} + \def\spacingwithinsymbol{\baselineskip0pt\lineskip#4pt} + \mathrel{\mathpalette\intermediary#1}} +\def\intermediary#1#2{\verticalposition\vbox{\spacingwithinsymbol + \everycr={}\tabskip0pt + \halign{$\mathsurround0pt#1\hfil##\hfil$\crcr#2\crcr + \theguybelow\crcr}}} + +\def\lapproxeq{\stacksymbols{<}{\sim}{2.5}{.2}} +\def\gapproxeq{\stacksymbols{>}{\sim}{3}{.5}} + +%********** DATING ************************************************************* +\def\monthname {\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} + +\newcount\mins \newcount\hours \hours=\time \mins=\time +\def\now{\divide\hours by60 \multiply\hours by60 \advance\mins by-\hours + \divide\hours by60 % NOTE: \divide only gives integer answers. + \ifnum\hours>12 \advance\hours by-12 + \number\hours:\ifnum\mins<10 0\fi\number\mins\ P.M.\else + \number\hours:\ifnum\mins<10 0\fi\number\mins\ A.M.\fi} +\def\today {\monthname\ \number\day, \number\year} + +%********** TABLE COMMANDS ***************************************************** +\newdimen\tempdim % For temporary storage. +\newdimen\othick \othick=.4pt % To set the outer rule thickness. +\newdimen\ithick \ithick=.4pt % To set the inner rule thickness. +\newdimen\spacing \spacing=9pt % To set the interline spacing. +\newdimen\abovehr \abovehr=6pt % Space above horizontal rules. +\newdimen\belowhr \belowhr=8pt % Space below horizontal rules. +\newdimen\nexttovr \nexttovr=8pt % Space next to vertical rules. + +\def\r{\hfil&\omit\vrsp\vrule width\othick\cr&} % To start a new line. +\def\rr{\hfil\down{\abovehr}&\omit\vrsp\vrule width\othick\cr + \noalign{\hrule height\ithick}\up{\belowhr}&}% To draw an \hrule. +\def\up#1{\tempdim=#1\advance\tempdim by1ex + \vrule height\tempdim width0pt depth0pt}% For space above a line. +\def\down#1{\vrule height0pt depth#1 width0pt}% For space below a line. +\def\large#1#2{\setbox0=\vtop{\hsize#1 \lineskiplimit=0pt \lineskip=1pt + \baselineskip\spacing \advance\baselineskip by 3pt \noindent + #2}\tempdim=\dp0\advance\tempdim by\abovehr\box0\down{\tempdim}} +% `\large' allows you to make multi-line table entries. +\def\dig{{\hphantom0}} % To leave a space, the width of a digit. +\def\hgap#1{\hskip-\nexttovr\hskip#1\hskip-\nexttovr\relax} % For a gap. +\def\vrsp{\hskip\nexttovr\relax} +\def\toprule#1{\def\startrule{\hrule height#1\relax}} % Set a top rule. +\toprule{\othick} % Picking the `\toprule' default. +\def\nstrut{\vrule height\spacing depth3.5pt width0pt} +\def\exclaim{\char`\!} % To print an exclamation mark. +\def\preamble#1{\def\startup{#1}} % For `customized' preambles. +\preamble{&##} % Choosing the default preamble. +{\catcode`\!=\active + \gdef!{\hfil\vrule width0pt\vrsp\vrule width\ithick\relax\vrsp&}} +% Setting up `!' as the entry separator. + +\def\table #1{\vbox\bgroup \setbox0=\hbox{#1} + \vbox\bgroup\offinterlineskip \catcode`\!=\active + \halign\bgroup##\vrule width\othick\vrsp&\span\startup\nstrut\cr + \noalign{\medskip} + \noalign{\startrule}\up{\belowhr}&} + +\def\caption #1{\down{\abovehr}&\omit\vrsp\vrule width\othick\cr + \noalign{\hrule height\othick}\egroup\egroup \setbox1=\lastbox + \tempdim=\wd1 \hbox to\tempdim{\hfil \box0 \hfil} \box1 \smallskip + \hbox to\tempdim{\advance\tempdim by-20pt\hfil\vbox{\hsize\tempdim + \noindent #1}\hfil}\egroup} + +%********** VERBATIM REPRODUCTION ********************************************** +\let\cc=\catcode +{\cc`\^^M=\active % +\gdef\losenolines{\cc`\^^M=\active \def^^M{\leavevmode\endgraf}}} +\def\literal {\begingroup \cc`\\=12 \cc`\{=12 \cc`\}=12 \cc`\$=12 \cc`\&=12 + \cc`\#=12 \cc`\%=12 \cc`\~=12 \cc`\_=12 \cc`\^=12 \cc`\*=12 \cc`\@=0 + \cc`\`=\active \losenolines \obeyspaces \tt}% +{\obeyspaces\gdef {\hglue.5em\relax}} + +{\cc`\`=\active \gdef`{\relax\lq}} + +\def\vquotingon{\cc`\"=\active} +\def\vquotingoff{\cc`\"=12} +\vquotingon +\def"{\literal\leavevmode\hbox\bgroup\com} +%`\leavevmode' starts a new paragraph, if needed. + +\def\beginliteral{\medskip \literal \cc`\"=12% + \parskip0pt \baselineskip11pt \thatisit} + +{\cc`\@=0 \cc`\\=12 @cc`@^^M=@active % + @gdef@com#1"{#1@egroup@endgroup} % + @gdef@thatisit^^M#1\endliteral{#1@endgroup@smallskip}} +\vquotingoff + +%********** GENERAL ************************************************************ +\def\pattern #1#2{\count0=0 + \loop #1\advance\count0 by 1 \ifnum\count0<#2 \repeat} + +\def\raggedleft{\leftskip=0pt plus2em \parfillskip0pt + \spaceskip=.3333em \xspaceskip=.5em\relax} + +%******************************************************************************* +\endinput diff --git a/macros/plain/contrib/tbe/tbesamples.tex b/macros/plain/contrib/tbe/tbesamples.tex new file mode 100644 index 0000000000..862acd8a2c --- /dev/null +++ b/macros/plain/contrib/tbe/tbesamples.tex @@ -0,0 +1,548 @@ +%`TEX' THIS FILE, AND PRINT IT. + +% TBESAMPLES, Version 1.0, July 10, 1991 + +%This file contains examples of the uses of some new commands defined in +%`TeX by Example' by Arvind Borde (copyright (c) 1992, Academic Press). The +%commands are also stored in the file `TBEMACROS.TEX'. + +%The commands in `TBEMACROS.TEX' and the examples of their uses shown in this +%file are provided `as is'. The author provides no warranty whatsoever, +%either express or implied, regarding this work, or with respect to its +%fitness for any particular purpose. + +%------------------------------------------------------------------------------- +\input tbemacros +\vquotingon %Allows the use of `"' when quoting commands verbatim. + +%------------------------------------------------------------------------------- +%LAYOUT + +\hsize 7.25 true in \hoffset -.5 true in +\vsize 9.75 true in \voffset -.5 true in +\output={\shipout\vbox{\fitframe{.4}{9}{\vbox{\pagebody}}\kern-12pt + \makefootline} + \advancepageno} +\def\ctbe{Commands from `\TeX\ by Example'; version 1.0} +\footline={\ifodd\pageno {\sevenrm\ctbe\hfil Page \folio\kern-18pt}% +\else {\sevenrm Page \folio\hfil\ctbe\kern-18pt}\fi} + +%------------------------------------------------------------------------------- +%RESETTING SOME SPACING PARAMETERS + +\parskip 1pt plus 1pt +\parindent 11pt +\abovedisplayskip=2pt plus2pt minus2pt %These are spaces around math displays +\belowdisplayskip=\abovedisplayskip +\belowdisplayshortskip=\belowdisplayskip +\abovedisplayshortskip=0pt plus1pt + +%------------------------------------------------------------------------------- +%FONTS + +\font\title=cmbx10 scaled\magstep3 % For the title. +\font\bbf=cmbx10 scaled\magstep1 % For section headings + +%------------------------------------------------------------------------------- +%UTILITY COMMANDS + +\def\beginex{\noindent{\it Illustration\/}: \medskip \noindent} +\def\endex{\medskip \noindent {\it The input for this was\/}:} + +\newcount\topicno \topicno=1 +\def\newtopic#1{\noindent {\bbf\the\topicno. #1} + \global\advance\topicno by1 + \smallskip\noindent\ignorespaces}% + +\def\newpage{\beginart \dividerule \coljump=.25 true in/ {2}} +\def\endpage{\endart\vfil\eject} + +%------------------------------------------------------------------------------- + +\setbox0=\vbox{\title E}% Makes a box whose height is used to fix other heights. + +\def\llines{\vbox to \ht0{\hsize 1in \parindent0pt \raggedleft +\offinterlineskip +\vrule height 1pt depth 0pt width .8in +\vfil +\vrule height 1pt depth 0pt width .5in +\vfil +\vrule height 1pt depth 0pt width 1in}} + +\def\rlines{\vbox to \ht0{\hsize 1in \parindent0pt \raggedright +\offinterlineskip +\vrule height 1pt depth 0pt width .8in +\vfil +\vrule height 1pt depth 0pt width .5in +\vfil +\vrule height 1pt depth 0pt width 1in}} + +\vglue.5pt +\centerline{\title\llines\ \ Commands from `\TeX\ by Example'\ \ \rlines} +\bigskip +\medskip +\centerline{\vbox{\hsize4.5in \raggedright \raggedleft +\pretolerance=10000 \hbadness=10000 +\noindent\hfil The commands illustrated below are taken from the book\hfil\break +{\it \TeX\ by Example}, by Arvind Borde ({\sl Academic Press}, 1992). Their +definitions are printed in that book and are also available in a file called +{\sl tbemacros.tex}\thinspace. To use the commands you must copy the +definitions from the book, or type `{\tt\string\input\ tbemacros}' in your +file.}} +\bigskip\medskip +\hrule +\bigskip +\newpage +\newtopic{Letters} +\beginex +\letterhead +\date{\today} +\address{Name\cr Street\cr City\cr +Postal code\cr Country.\cr} +\smallskip +\sal{Dear Reader,} + +This shows you how to make a simple letter. + +\endletter{Sincerely,}{The Author.} +\endex +\beginliteral +\letterhead +\date{\today} +\address{Name\cr Street\cr City\cr +Postal code\cr Country.\cr} +\smallskip +\sal{Dear Reader,} + +This shows you how to make a simple letter. + +\endletter{Sincerely,}{The Author.} +\endliteral + +\noindent For this to be useful, you must edit the definition of +"\letterhead" in the {\sl tbemacros\/} file, replacing ``Your name'' +by your name, etc. + +\bigskip +\newtopic{Framing text} +\beginex +\centerline{\frame{.5}{6}{2.25in}{\noindent +This text is 2.25 inches wide, with 6 points +of white space all around. The rules that +make the frame around the text are each .5 +point thick.}} +\endex +\beginliteral +\centerline{\frame{.5}{6}{2.25in}{\noindent +This text is 2.25 inches wide, with 6 points +of white space all around. The rules that +make the frame around the text are each .5 +point thick.}} +\endliteral +\medskip +\beginex +\centerline{\fitframe{.3}{.5}{This frame hugs +its contents.}} +\endex +\beginliteral +\centerline{\fitframe{.3}{.5}{This frame hugs +its contents.}} +\endliteral +\medskip +\beginex +\centerline{\shframe{3}{10}{110pt}{% +\centerline{\s{S}\s{H}\s{A}\s{D}\s{O}\s{W}}}} +\endex +\beginliteral +\centerline{\shframe{3}{10}{110pt}{% +\centerline{\s{S}\s{H}\s{A}\s{D}\s{O}\s{W}}}} +\endliteral + +\bigskip +\newtopic{Memoranda} +\beginex +\memo +TO: The reader. +FROM: The author. +SUBJECT: Writing memoranda. +DATE: Today. + +This shows you one way to do a memorandum. +\bigskip +\centerline{\pattern{$\star$}{25}} +\endex +\beginliteral +\memo +TO: The reader. +FROM: The author. +SUBJECT: Writing memoranda. +DATE: Today. + +This shows you one way to do a memorandum. +\bigskip +\centerline{\pattern{$\star$}{25}} +\endliteral +\noindent The "\memo" command is somewhat rigid in that it requires +you to type `"TO:"', `"FROM:"', `"SUBJECT:"' and `"DATE:"' {\sl exactly\/} +as shown, and in that order. +\endpage + +\newpage +\newtopic{Ignoring text} +The command shown below allows you to make multi-line +comments without using a "%" sign at the start of each line. It is +useful when you want \TeX\ to temporarily ignore parts of a document +and to process only a portion of it. +\ignore +All input lines will be ignored from now on +unless they start with an `!'. +`\ignore' is switched off by typing `!E' at +the START of a line, as here: +!E +\beginliteral +\ignore +All input lines will be ignored from now on +unless they start with an `!'. +`\ignore' is switched off by typing `!E' at +the START of a line, as here: +!E +\endliteral + +\bigskip +\newtopic{Ruled tables} +It is tedious work to make tables with `rules' (i.e., drawn lines) +from scratch, each time they are needed. The "\table" command in this +package, along with its associates, gives you one easy way to make +ruled tables. +\medskip +\beginex +$$\table{\bf Table A} +One ! Two ! Three \rr +101 ! 102 ! 103 \r +104 ! 105 ! 10691 +\caption{}$$ +\endex +\beginliteral +$$\table{\bf Table A} +One ! Two ! Three \rr +101 ! 102 ! 103 \r +104 ! 105 ! 10691 +\caption{}$$ +\endliteral +\noindent The "$$" signs center the table and leave space above and below. They +can be omitted, if you don't want this. The table entries are typed between +"\table{}" and "\caption{}". Entries that are to go on the same line are +separated by "!". You signal the end of a line by typing `"\rr"' if you want a +horizontal rule just below, or `"\r"' if you don't---for all but the last line. +\medskip +\beginex +\medskip\hfil % This combination serves +%to center the table. +\table{\bf B} +\hfill\bf 1\hfill!\hfill\bf 2\hfill\rr +\hfill A! $\alpha$ \r +\it Italics. ! \rr +\multispan{2}Like it? \hfil +\caption{Your caption can be many lines +long\exclaim} +\endex +\beginliteral +\medskip\hfil % This combination serves +%to center the table. +\table{\bf B} +\hfill\bf 1\hfill!\hfill\bf 2\hfill\rr +\hfill A! $\alpha$ \r +\it Italics. ! \rr +\multispan{2}Like it? \hfil +\caption{Your caption can be many lines +long\exclaim} +\medskip +\endliteral +\noindent Thus, you can use "\multispan" to span table entries, as normal, and +you can center entries, set them flush right, or change typeface, as shown. The +"\exclaim" at the end of the caption gives `!': a special command is needed +because the character is reserved in this application for special duty as +a column separator. The `special duty' that `!' performs does not work correctly +from within commands like "\centerline". To center, you must use "$$" on +either side, or the method employed above. The next example shows how to specify +your own table `preambles'. +\medskip +\beginex +$$\preamble{\hfill\it ##\hfill\strut&##&\hfill +\sl ##&##} +\table{\bf C} +\bf Col. 1 &!\bf Col. 2\hfill\rr +One &! 44987.01\r +Two &! 513.1\dig\rr +%\dig will make the decimal points align. +Three && 316.9\dig\rr +Four &!\large{1.6in}{This shows you +how you can make entries that are many lines +long.} +\caption{} $$ +\endex +\beginliteral +$$\preamble{\hfill\it ##\hfill\strut&##&\hfill +\sl ##&##} +\table{\bf C} +\bf Col. 1 &!\bf Col. 2\hfill\rr +One &! 44987.01\r +Two &! 513.1\dig\rr +%\dig will make the decimal points align. +Three && 316.9\dig\rr +Four &!\large{1.6in}{This shows you +how you can make entries that are many lines +long.} +\caption{} $$ +\endliteral +\noindent Specifying a customized preamble can get a little tricky, so you +may wish +not to indulge. The preamble has to have extra slots for the vertical rules, +for one thing, and you have to make sure you enclose everything in a group +(either explicitly within braces, or between "$$" signs) to prevent the +new preamble specification from interfering with the default preamble that +goes with these commands. Easier to use from the table above, are "\dig", +which merely leaves a horizontal space of size equal to the width of a digit, +and "\large{}{}", which can be used to place large-size material in the table. +"\dig" can be used to align columns of digits along decimal points. To use +"\large" you have to specify a width ("1.6in" above). +\endpage + +\newpage +\indent +You can adjust other attributes to suit your own tastes. Rule thicknesses +are governed by "\toprule" (thickness of the top rule), "\othick" (thickness of +the outer rules; default value .4pt) and "\ithick" (thickness of the inner +rules; default value .4pt). A minimum height is assigned to every line by +"\spacing" (default 9pt); the space above and below horizontal rules is set by +the values of "\abovehr" (default 6pt) and "\belowhr" (default 8pt); the space +next to vertical rules by "\nexttovr" (default 8pt). All these parameters can +be altered, as they have been below. +\medskip +\beginex +\line{{\othick=2pt +\table{} 1!2\rr +3!4\caption{\centerline{\bf D}} } +\hfil +{\ithick=.8pt \othick=0pt \spacing=12pt +\abovehr=18pt \belowhr=20pt \nexttovr=30pt +\table{\bf E} 1!2\rr 3!4\caption{} } +\hfil +{\toprule{2pt} +\table{} 1!\hgap{1pt}! 2\rr 3!\hgap{1pt}! 4 +\caption{\centerline{\bf F}} }} +\endex\removelastskip +\beginliteral +\line{{\othick=2pt +\table{} 1!2\rr +3!4\caption{\centerline{\bf D}} } +\hfil +{\ithick=.8pt \othick=0pt \spacing=12pt +\abovehr=18pt \belowhr=20pt \nexttovr=30pt +\table{\bf E} 1!2\rr 3!4\caption{} } +\hfil +{\toprule{2pt} +\table{} 1!\hgap{1pt}! 2\rr 3!\hgap{1pt}! 4 +\caption{\centerline{\bf F}} }} +\endliteral +\noindent The command "\hgap", used for the third table, makes a narrow column +of specified size, so it may be used to effectively get double vertical lines. +\medskip +\beginex +\centerline{{\othick=0pt \nexttovr=.1in +\abovehr=.1in \belowhr=0in +\table{} +\large{2.25in}{You can make displays like +this, by playing tricks with rule thickness.} +\global\othick=3pt +\caption{}} +\othick=.4pt % MUST reset \othick. +\qquad\qquad +{\othick=1pt \ithick=1pt +\table{} +1\global\othick=0pt\rr 2\global\othick=1pt +\caption{} }} +\othick=.4pt % Reset \othick again. +\endex +\beginliteral +\centerline{{\othick=0pt \nexttovr=.1in +\abovehr=.1in \belowhr=0in +\table{} +\large{2.25in}{You can make displays like +this, by playing tricks with rule thickness.} +\global\othick=3pt +\caption{}} +\othick=.4pt % MUST reset \othick. +\qquad\qquad +{\othick=1pt \ithick=1pt +\table{} +1\global\othick=0pt\rr 2\global\othick=1pt +\caption{} }} +\othick=.4pt % Reset \othick again. +\endliteral +\noindent It was all right to use "\centerline" here, because "!" was not used +anywhere. + +\bigskip +\newtopic{Stacking symbols} +Plain \TeX, a mathematician's creation, lacks two symbols essential to the +emotional well-being of physicists, $\gapproxeq$ and $\lapproxeq$. This +package provides them. +\medskip +\beginex +$$a\lapproxeq b \qquad\qquad +\alpha\gapproxeq\beta $$ +\endex +\beginliteral +$$a\lapproxeq b \qquad\qquad +\alpha\gapproxeq\beta $$ +\endliteral +\noindent These are special cases of a more general command that creates +composite symbols like $\stacksymbols{g}{\tilde{}}{8}{1}$, i.e., +it allows you to take any two symbols and place one above the other. This +particular composite symbol was created by +\beginliteral +$\stacksymbols{g}{\tilde{}}{8}{1}$ +\endliteral +\noindent The first number controls the overall vertical position, the second +the spacing within the new symbol. This allows you to fine tune spacing to your +satisfaction. Even after `fine tuning', you may have to make further +adjustments: e.g., the new symbol shown above has too large a `depth', as you +can see from the gap between the line in which it appears and the line below. +The required adjustments can be made with standard commands like "\smash" +and "\vphantom". + +\bigskip +\newtopic{Verbatim reproduction} +Input lines are reproduced like this (for example): +\beginliteral +\beginliteral +$$a\lapproxeq b \qquad\qquad +\alpha\gapproxeq\beta $$ +\@-endliteral +\endliteral +% `@-' is a trick, to get the program to ignore the first `\endliteral' +\noindent If you type `"\vquotingon"' in your +\vquotingoff +file, you can then use `{\tt"}' to quote commands verbatim +within text. For example, the first input line for this paragraph was +\vquotingon +\beginliteral +\noindent If you type `"\vquotingon"' in your +\endliteral +\noindent Typing `"\vquotingoff"' switches the feature off. + +\bigskip +\newtopic{Multi-column output} +The two column stuff on these pages is produced by +\beginliteral +\beginart \dividerule \coljump=.25in / {2} +@bgroup@it stuff @egroup +\endart +\endliteral +\noindent +The specifications before the "/" are optional ("\dividerule" places a +vertical rule between columns and "\coljump" resets the gap between +columns---the default is no rule, with a .2 inch gap); the +specification after the "/" gives the number of columns. This multi-column +command has limited uses: it is suitable only for output that will fit on a +single page. +\endpage + +\newpage +\newtopic{Character tables} +\beginex +\chartable{cmsy10} +\endex +\beginliteral +\chartable{cmsy10} +\endliteral +\noindent To use the command, you must know the `external name' of the +font (i.e., the name under which information about the font +is filed). The one used above, "cmsy10", is the standard Computer Modern +mathematics symbols font. + +\bigskip +\newtopic{Scripts} +\beginex +\vskip-\smallskipamount +\beginscript +Now, at last, you can easily typeset +conversations you eavesdrop on in +restaurants and on planes. + +Really? That's just what I've been waiting +for! How do I do it? + +Exactly the way this script was done. + +Is it easy? + +Extremely. +\endscript +\endex +\beginliteral +\beginscript +Now, at last, you can easily typeset +conversations you eavesdrop on in +restaurants and on planes. + +Really? That's just what I've been waiting +for! How do I do it? + +Exactly the way this script was done. + +Is it easy? + +Extremely. +\endscript +\endliteral + +\bigskip +\newtopic{Dating} +\beginex +Gosh darn it, it's \monthname\ already! +Even worse, it is \now\ on \today. +\endex +\beginliteral +Gosh darn it, it's \monthname\ already! +Even worse, it is \now\ on \today. +\endliteral + +\bigskip +\newtopic{Fun with numbers} +\beginex +\fermat{15}{16}{3} +\smallskip\noindent +\fermat{3}{4}{2} +\endex +\beginliteral +\fermat{15}{16}{3} +\smallskip\noindent +\fermat{3}{4}{2} +\endliteral + +\bigskip +\newtopic{Trapezoids galore} +\beginex +\trap{0}{20}{50}{10}{10}{60}\quad +\trap{10}{40}{30}{-10}{30}{100}\quad +\rect{20}{48}{5}{120}\quad +\trap{1}{1}{30}{50}{5}{60} +\endex +\beginliteral +\trap{0}{20}{50}{10}{10}{60}\quad +\trap{10}{40}{30}{-10}{30}{100}\quad +\rect{20}{48}{5}{120}\quad +\trap{1}{1}{30}{50}{5}{60} +\endliteral +\noindent The parameters in "\trap" are, respectively, the top width, +the bottom width, the height and the bottom displacement (all in points); +the rule thickness and the gap between rules (in 1/64th of a point). For +"\rect" the numbers are the top width, the bottom width, the rule thickness +and the gap. (If you use small numbers for the rule specifications, you +are likely to cause \TeX\ to `overflow'.) +\endpage + +\end + |