diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/genmisc')
47 files changed, 6062 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/genmisc/anti.tex b/Master/texmf-dist/tex/generic/genmisc/anti.tex new file mode 100644 index 00000000000..52bf0035494 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/anti.tex @@ -0,0 +1,19 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%% CUT HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \anti -- Definition. +% Produce a superscripted antiparticle: #1 with an overbar and a super- +% script #2. Looks better than \overline{{#1}^{#2}} (bar does not extend over +% superscript) or {\overline {#1}}^{#2} (superscript does not stick up above +% bar; in fact, superscript is at same height as for the charge conjugate, +% {#1}^{#2}). If you want subscripts too, you'll have to modify +% this definition to take a third argument. Math mode is assumed. +% Macro by Rich Holmes (rich@suhep.bitnet), 1/88 +% +\def\anti#1#2{\vbox{\ialign{##\crcr + \hrulefill$\smash{\phantom{\scriptstyle#2}}$\crcr % the right length bar + \noalign{\kern-1pt\nointerlineskip\vskip 0.25ex} % the right spacing + $\hfil{#1}^{#2}\hfil$\crcr}}} % the right text +%%%%%%%%%%%%%%%%%%%%%%%% CUT HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\Kzerobar{\anti{K}{0}} +\def\Dstarbar{\anti{D}{*}} % et cetera +%%%%%%%%%%%%%%%%%%%%%%%% CUT HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/generic/genmisc/apldef.tex b/Master/texmf-dist/tex/generic/genmisc/apldef.tex new file mode 100644 index 00000000000..66451a7dbce --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/apldef.tex @@ -0,0 +1,106 @@ +% apldef.tex +% +% Aarno Hohti/Okko Kanerva +% University of Helsinki +% Department of Mathematics +% Hallituskatu 15 +% SF--00100 Helsinki +% Finland +% +% Bitnet: HOHTI@FINFUN +% +%=============================================================== +% This file contains the definitions of the 2-letter control +% sequences for using cmapl10. +% cmapl10 was described in TUGboat 8 #3, November 1987. +%=============================================================== +% +\def\RO{{\apl\char'014}} % rho +\def\IO{{\apl\char'015}} % iota +\def\BX{\lower.1ex\hbox{\apl\char'001}} % quad box (window etc.) +\def\CE{{\apl\char'035}} % ceiling +\def\FL{{\apl\char'034}} % floor +\def\DE{{\apl\char'031}} % decode +\def\EN{{\apl\char'030}} % encode +\def\DL{{\apl\char'002}} % del +\def\LD{{\apl\char'003}} % delta +\def\NT{{\apl\char'026}} % not +\def\LO{{\apl\char'017}} % circle +\def\GO{{\apl\char'036}} % arrow right +\def\OR{{\apl\char'010}} % logical or +\def\DM{{\apl\char'011}} % diamond +\def\LE{{\apl\char'012}} % less than or equal +\def\GE{{\apl\char'013}} % greater than or equal +\def\AB{{\apl\char'174}} % stile +\def\LB{{\apl\char'173}} % left brace +\def\RB{{\apl\char'175}} % right brace +\def\DA{{\apl\char'037}} % arrow down +\def\UA{{\apl\char'136}} % arrow up +\def\EP{{\apl\char'006}} % epsilon +\def\NE{{\apl\char'027}} % not equal +\def\BL{{\apl\char'134}} % backslash +\def\RU{{\apl\char'022}} % right U +\def\LU{{\apl\char'023}} % left U +\def\DU{{\apl\char'021}} % down U +\def\UU{{\apl\char'020}} % up U +\def\LK{{\apl\char'033}} % left tack +\def\RK{{\apl\char'032}} % right tack +\def\US{{\apl\char'024}} % underscore +\def\NG{{\apl\char'025}} % high minus +\def\DD{{\apl\char'007}} % dieresis +\def\AM{{\apl\char'004}} % alpha +\def\OM{{\apl\char'005}} % omega +\def\SO{\raise.3ex\hbox{{\apl\char'016}}} % small circle +% +% This macro is used for overstriking two characters +\newskip\charwidth +\def\overstrike#1#2{\setbox1=\hbox{#1}\charwidth=\wd1 + #1\hskip-\charwidth#2} +% +\def\TR{\overstrike{\LO}{\BL}} % transpose +\def\RV{\overstrike{\LO}{\AB}} % reverse +\def\CR{\overstrike{\LO}{-}} % column reverse +\def\GD{\overstrike{\DL}{\AB}} % grade down +\def\GU{\overstrike{\LD}{\AB}} % grade up +\def\FM{\overstrike{\raise.1ex\hbox{{\apl\char'016}}}{\EN}} % format +\def\XQ{\overstrike{\raise.1ex\hbox{{\apl\char'016}}}{\DE}} % execute +\def\SS{\overstrike{\RU}{\US}} % subset +\def\CO{\overstrike{\LU}{\US}} % contains +\def\CB{\overstrike{\BL}{-}} % column backslash +\def\CS{\overstrike{/}{-}} % column slash +\def\IB{\overstrike{\EN}{\DE}} % I-beam +\def\DQ{\overstrike{{\apl\char'045}}{\BX}} % divide quad +\def\QQ{\overstrike{{\apl '}}{\BX}} % quote quad +\def\PD{\overstrike{\DL}{\NT}} % protected del +\def\NR{\overstrike{\OR}{\NT}} % nor +\def\NN{\overstrike{{\apl\char'046}}{\NT}} % nand +\def\LG{\overstrike{{\apl *}}{\LO}} % logarithm +% underscored letters +\def\ZA{\overstrike{{\apl A}}{\US}} +\def\ZB{\overstrike{{\apl B}}{\US}} +\def\ZC{\overstrike{{\apl C}}{\US}} +\def\ZD{\overstrike{{\apl D}}{\US}} +\def\ZE{\overstrike{{\apl E}}{\US}} +\def\ZF{\overstrike{{\apl F}}{\US}} +\def\ZG{\overstrike{{\apl G}}{\US}} +\def\ZH{\overstrike{{\apl H}}{\US}} +\def\ZI{\overstrike{{\apl I}}{\US}} +\def\ZJ{\overstrike{{\apl J}}{\US}} +\def\ZK{\overstrike{{\apl K}}{\US}} +\def\ZL{\overstrike{{\apl L}}{\US}} +\def\ZM{\overstrike{{\apl M}}{\US}} +\def\ZN{\overstrike{{\apl N}}{\US}} +\def\ZO{\overstrike{{\apl O}}{\US}} +\def\ZP{\overstrike{{\apl P}}{\US}} +\def\ZQ{\overstrike{{\apl Q}}{\US}} +\def\ZR{\overstrike{{\apl R}}{\US}} +\def\ZS{\overstrike{{\apl S}}{\US}} +\def\ZT{\overstrike{{\apl T}}{\US}} +\def\ZU{\overstrike{{\apl U}}{\US}} +\def\ZV{\overstrike{{\apl V}}{\US}} +\def\ZX{\overstrike{{\apl X}}{\US}} +\def\ZY{\overstrike{{\apl Y}}{\US}} +\def\ZW{\overstrike{{\apl W}}{\US}} +\def\ZZ{\overstrike{{\apl Z}}{\US}} + +\endinput diff --git a/Master/texmf-dist/tex/generic/genmisc/arabic.tex b/Master/texmf-dist/tex/generic/genmisc/arabic.tex new file mode 100644 index 00000000000..acba65e59f0 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/arabic.tex @@ -0,0 +1,55 @@ +%-------------------------------------------- +% Ole Michael Selberg, October 5, 1995 +% TeX macros to make a Roman number Arabic +% +% Syntax: \arabicnumeral <Roman number > +%-------------------------------------------- +\catcode`@=11 +\newcount\r@mancount \newcount\current \newcount\previous +\def\@valueofcurrent{% + \ifx\next i\global\current=1 \else + \ifx\next v\global\current=5 \else + \ifx\next x\global\current=10 \else + \ifx\next l\global\current=50 \else + \ifx\next c\global\current=100 \else + \ifx\next d\global\current=500 \else + \ifx\next m\global\current=1000 \else + \global\r@mancount=-100000 + \immediate\write16{Line \the\inputlineno: non-Roman digit!} + \fi\fi\fi\fi\fi\fi\fi} +\def\stop{\stop} +\def\arabicnumeral #1 {\r@mancount=0 \current=0 \previous=10000 + \fr@mroman#1\stop} +\def\fr@mroman {\afterassignment\@testchar\let\next} +\def\@testchar{% + \ifx\next\stop + \ifnum\r@mancount<0 (Wrong Roman numeral: ???) + \else + \the\r@mancount + \fi + \let\next\relax + \else \@valueofcurrent + \advance\r@mancount by\current + \ifnum\previous<\current + \multiply\previous by2 + \advance\r@mancount by -\previous + \fi + \let\next\fr@mroman + \fi + \previous=\current + \next} +\catcode`@=12 +\endinput + + +--------------------------------------------------------------------------- +Ole Michael Selberg, +Institutt for oesteuropeiske og orientalske studier +Universitetet i Oslo +Pb. 1030 Blindern +N-0315 Oslo + +Phone: (47) 22 85 67 94 +Fax: (47) 22 85 41 40 + + diff --git a/Master/texmf-dist/tex/generic/genmisc/backgrnd.tex b/Master/texmf-dist/tex/generic/genmisc/backgrnd.tex new file mode 100644 index 00000000000..165ee690947 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/backgrnd.tex @@ -0,0 +1,319 @@ +%%% backgrnd.sty = background.sty +%%% Experimental version 24 march 1996 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% +%%% This macro file aims at implementing marking of text, +%%% either by a grey background or by a changeebar +%%% using TeX's own resources only, +%%% (i.e., without resorting to any pstricks). +%%% Grey background uses a shade font defined using MetaFont +%%% The macros seem to work satisfactory under plain TeX, +%%% however, I have also tried (rudimentarily) to integrate them with +%%% LaTeX, too. It seems to work with (simple) LaTeX 2.09, at least. +%%% +%%% commands : +%%% \RuleOn and \RuleOff : changebar +%%% \RuleON : backs up to mark current line, too +%%% \RuleStyle { ( dimension ) % width of rule +%%% % rule offset on pages +%%% [ # dimension | % with even pagenumbers +%%% # dimension ] } % with odd pagenumbers +%%% % # is either < : left margin +%%% % or > : right margin +%%% e.g.: default values are set by +%%% \RuleStyle { (2pt)[<18pt|>18pt] } +%%% +%%% +%%% \ShadeON ( backs up to mark current line, too ) and +%%% \ShadeOn and \ShadeOff : grey background, requires shade.sty +%%% therefore, by default, + \let\ifUseGrey\iffalse % grey background will not be installed +%%% - and will be replaced by rules +%%% if grey background is required then +%%% remove comment signs %%% from next line : +%%% \let\ifUseGrey\iftrue +%%% +%%% (At present) it is not possible to use both commands +%%% in the same document ! +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Peter Schmitt %%% +%%% Institut f\"ur Mathematik, Universit\"at Wien %%% +%%% Strudlhofgasse 4, A-1090 Wien, Austria %%% +%%% email: schmitt@awirap.bitnet %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\catcode`\: 11 % make internal macros private +\countdef\int: 255 % scratch registers +\dimendef\dim: 0 +\skipdef\skip: 0 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% commands and options %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def \RuleOn {\bg:ini \bg:rule + \RuleStyle { (2pt)[<18pt|>18pt] } + \bg:commands \RuleOn \RuleON \RuleOff + \RuleOn + } +\def \RuleStyle #1{\set:hsize #1(\bg:hsize)\\% + \set:offsets #1[*|*]\iftrue]\iffalse\\% + } + +\def \bg:rule {\leaders\vrule width\bg:hsize\vskip} +\def \bg:empty {\vskip} +\let \bg:offset \relax + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% interface tools %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\bg:commands #1#2#3{\def #1{\bg:option {\vbox{}\pos:on}} + \def #2{\bg:option {\nobreak\vskip-\baselineskip + \vbox{}\pos:on + \nobreak\vskip\baselineskip } + } + \def #3{\bg:option {\vbox{}\pos:off}} + } +\def \bg:ini {\output{\bg:output} % should be followed by desired \bg:style + \zero:pos + \global\let \bg:skip \bg:empty + \let \bg:style + } +\def\bg:option #1{\ifvmode #1\else \vadjust{#1}\fi } + +\def \set:hsize #1(#2)#3\\{\edef\bg:hsize{#2}} +\def \set:offsets #1[#2#3|#4#5]#6]#7#8\\{#7 + \def\bg:shift{} + \set:offset #2#3 + \set:offset #4#5 + \expandafter \set:shifts \bg:shift + \fi } +\def\set:offset #1#2 {\setbox0\hbox{\dim: #2\bg:offset\xdef\bg:offset{\the\dim:}} + \dim:\bg:offset + \expandafter\expandafter\expandafter + \set:shift \csname bg:#1\endcsname + } +\def\set:shift #1#2{\dim: \bg:offset \advance\dim: #2% + \edef\bg:shift {\bg:shift {#1\the\dim:}} + } +\expandafter\def \csname bg:<\endcsname {\moveleft \bg:hsize} +\expandafter\def \csname bg:>\endcsname {\moveright \hsize} +\def \set:shifts #1#2{\def\bg:shift{\ifodd\pageno #2\else #1\fi}} + +%%% not used : +\def\bg:err #1{\errmessage {% + Warning ! Background mode \noexpand#1 already active ! } + } +%%% saving position without eject yields not always correct result +%%% \def\bg:on {\switch:to \bg:style } \def\bg:off {\switch:to \bg:empty } + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% grey background %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifUseGrey + +\def\ShadeOn {\bg:ini \bg:grey + \let\bg:shift\relax + \let\bg:hsize\hsize + \setbox\grey:line + \vbox{\shade{\line:{\vphantom{\grey:\char0}\hfil}}} + \bg:commands \ShadeOn \ShadeON \ShadeOff + \ShadeOn + } +\csname newbox\endcsname\grey:line % allow \newbox in conditional text +\def\bg:grey {\leaders\copy\grey:line\vskip} +\let\line:\line +\input shade + +\else + \def\ShadeOn{\RuleOn} \def\ShadeOff{\RuleOff} \def\ShadeON{\RuleON} + \fi +%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% output routine %%% +%%%%%%%%%%%%%%%%%%%%%%%%%% + + \newbox \bg:page + \newdimen \v:size + \newskip \v:pos + \newcount \true:penalty + \chardef \the:page 255 + +\def\option: #1{\advance\int: -1 + \edef#1{\penalty\the\int: } + \expandafter\def\csname\the\int:\endcsname + } \int: -12345 +\def\bg:output{\expandafter\ifx\csname\the\outputpenalty\endcsname\relax + \global\true:penalty\outputpenalty + \expandafter\bg:pagecontents + \else \expandafter\expandafter + \csname\the\outputpenalty\endcsname + \fi } +\option: \pos:on {\bg:switch \bg:style } +\option: \pos:off {\bg:switch \bg:empty } +\option: \bg:top {\save:pos \add:bg\bg:empty\v:skip{} + \repeat:page \unvbox\the:page } +\option: \bg:bot {\save:pos \repeat:page \unvbox\the:page } +\option: \fg:end {\save:pos \add:bg\bg:empty{}\v:skip \bg:makepage } + +\def \bg:switch #1{\setbox\the:page + \vbox{\unvbox\the:page \setbox0\lastbox } + \ifdim \pagetotal=\topskip + \global\let \bg:skip #1 + \unvbox\the:page + \else \switch:to #1 + \repeat:page\repeat:inserts \unvbox\the:page + \fi + } +\def\switch:to #1{\save:pos + \add:bg \bg:skip{}\v:skip + \global\let \bg:skip #1} +\def\bg:pagecontents {\switch:to \bg:skip + \setbox\the:page \vbox + {\vbox{}\bg:top \unvbox\the:page \bg:bot } + \zero:pos \repeat:page + \pagecontents \fg:end + } +\def\bg:makepage {\global\v:size\vsize \advance\v:size \dp\the:page + \def\pagecontents{% + \bg:shift + \vbox to0pt{\vbox to\v:size{\unvbox\bg:page}\vss} + \unvbox\the:page } + \outputpenalty\true:penalty + \plainoutput + \zero:pos \reset:inserts + } + +%%%%%%%%%%%%%%%%% +%%% tools %%% +%%%%%%%%%%%%%%%%% + +\def\repeat:page {\vbox{}\nobreak\kern-\topskip } +\def\add:bg #1#2#3{\let\bg:vskip #1 + \global\setbox\bg:page \vbox{#2\unvbox\bg:page#3} + } + +\newdimen \v:fil +\newdimen \v:fill +\newdimen \v:filll +\def\zero:pos {\global \v:pos 0pt + \global \v:fil 0pt + \global \v:fill 0pt + \global \v:filll 0pt + } +\def\save:pos {\skip: -\v:pos % save -last:pos + \global \v:pos \pagetotal + \global\advance \v:pos \pagedepth + \ifnum \pagedepth=0 \advance\v:pos \dp\the:page \fi + \global\advance \v:pos 0ptplus\pagestretch minus\pageshrink + \save:skip + } +\def\save:pos {\skip: -\v:pos % save -last:pos + \global \v:pos \pagetotal + \global\advance \v:pos \pagedepth + \ifnum \pagedepth=0 \advance\v:pos \dp\the:page \fi + \global\advance \v:pos 0ptplus\pagestretch minus\pageshrink + \save:skip + \global\skip\ins:size \vsize + \global\advance\skip\ins:size -\pagegoal + \global\advance\skip\ins:size -\ins:skip + } +\def\save:skip {\advance\skip:\v:pos % v:pos - last:pos + \let\bg:vskip\relax + \edef\v:skip{\bg:vskip\the\skip:} + \fil:skip l \fil:skip ll \fil:skip lll + } +\def\fil:skip #1 {\set:fil {\csname v:fi#1\endcsname} + {\csname pagefi#1stretch\endcsname} + \edef\v:skip{\v:skip \bg:vskip0ptplus\the:pt \dim: fi#1 } + } +\def\set:fil #1#2{\dim: -#1 + \advance \dim: #2 + \global #1 #2 + } +\def\the:pt {\expandafter\PT:\the} + { \catcode`p 12 \catcode`t 12 +\gdef\PT: #1pt{#1} }% \catcode`p 11 \catcode`t 11 + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% insert handling %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcount\ins: +\newinsert\ins:size +\newdimen\ins:skip + +\let\do:insert \insert +\def\inserts:{} +\def\insert {\afterassignment\adjust:pos\ins:} +\def\adjust:pos {\csname ins:\the\ins:\endcsname\csname iftrue\endcsname + \add:plus \ins: \add:minus \ins: + \advance\ins:skip\skip\ins: + \let\temp:\relax + \edef\inserts:{\inserts: \temp:{\the\ins:}} + \fi + \global\expandafter\let\csname ins:\the\ins:\endcsname \iffalse + \do:insert\ins: } +\def\repeat:inserts{\def\temp:##1{\do:insert##1{}}\inserts: } +\def\reset:inserts{% + \def\temp: ##1{\global\expandafter\let\csname ins:##1\endcsname \relax } + \inserts: \gdef\inserts:{}\global\ins:skip 0pt } + +%%% tools for insert handling %%% + + \catcode `L12 \catcode `N12 \catcode `S12 \catcode `U12 \lowercase{ +\def\plus: #1LUS #2 #3\\{#2} +\def\Plus: #1{\expandafter\plus:\the#1 LUS 0.0pt \\} +\def\minus: #1NUS #2 #3\\{#2} +\def\Minus: #1{\expandafter\minus:\the#1 NUS 0.0pt \\} + } \catcode `L11 \catcode `N11 \catcode `S11 \catcode `U11 + +\def\set:int {\afterassignment\set:frac\int: } +\def\set:frac #1{\afterassignment\csname\count0 } +\def\adv:pos #1{\global\advance#1\the\int:.\the\count0 pt } +\def \pt:p {\adv:pos {\v:pos 0ptplus}} +\def \pt:m {\adv:pos {\v:pos 0ptminus}} +\def \fil:p {\adv:pos \v:fil } +\def \fill:p {\adv:pos \v:fill } +\def\filll:p {\adv:pos \v:filll } + +\def\add:plus #1{{\expandafter\set:int \Plus: {\skip#1}:p\endcsname }} +\def\add:minus #1{{\expandafter\set:int \Minus:{\skip#1}:m\endcsname }} + +%%%%%%%%%%%%%%%%%%%%%%%% +%%% LaTeX extras %%% +%%%%%%%%%%%%%%%%%%%%%%%% + +\catcode`@ 11 +\ifx \@outputbox\undefined \endinput \catcode`@12 \catcode`: 12 \fi + +\newtoks\latex:output \latex:output \output +\newdimen\v:ht % possibly \textheight could be used + +\def\bg:@makecol {\switch:to \bg:skip + \setbox\the:page \vbox + {\vbox{}\bg:top \unvbox\the:page \bg:bot } + \@makecol + \global\v:ht\ht\@outputbox \global\v:size\v:ht + \global\advance\v:size\dp\@outputbox + \zero:pos \outputpenalty\true:penalty + \repeat:page \unvbox\@outputbox \fg:end + } +\def\bg:@makepage {\setbox\@outputbox \vbox to \v:ht {% + \bg:shift + \vbox to0pt{\vbox to\v:size{\unvbox\bg:page}\vss} + \unvbox\the:page } + \outputpenalty\true:penalty + \let\@makecol\relax \the\latex:output + \zero:pos \reset:inserts + } +\let \bg:makepage \bg:@makepage +\let \bg:pagecontents \bg:@makecol +\def \line: {\hbox to\textwidth} +\let \pageno \c@page + +\catcode`@ 12 \catcode`: 12 + +\endinput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% end : background.sty [ 0.3 ] %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/generic/genmisc/balancedquotes.sty b/Master/texmf-dist/tex/generic/genmisc/balancedquotes.sty new file mode 100644 index 00000000000..f280fbeba8c --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/balancedquotes.sty @@ -0,0 +1,418 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% file name: balancedquotes.sty (for plain TeX and LaTeX) +%% Ole Michael Selberg, 25.8.1994 +%% E-mail: O.M.Selberg@easteur-orient.uio.no +%%------------------------------------------------------------------- +%% Description: +%% This file contains macros that simplify the management of quotes. +%% The input: +%% "...*....*..." +%% will be typeset as: +%% <<...<...>...>> (default) +%% +%% (or as: +%% ,,...,...'...'' +%% etc., depending on your choices.). +%% +%% TeX keeps track of whether full quotes (written as ") and half +%% quotes (written as *) are balanced, When a quote has been omitted, +%% as in: +%% --- text "text in quotes more text "text in quotes" --- +%% an error message is written to the screen, and a mark is put in +%% the margin to the left of the line in which a final full or half +%% quote followed by a letter was discovered. +%% +%% The macros can be used both with plain TeX and LaTeX. You can test +%% them and learn how to use the commands by running the test file +%% which is included in this file, after \endinput. +%% Just copy all the stuff after \endinput to a new file, +%% which you should name balancedquotestest.tex, and then delete it +%% from this file. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\catcode`\@=11 \catcode`\_=11 \newif\ifapostrophe \newlinechar=`^^J +% +\def\definequotes #1#2#3#4{% + \def\bquote_char{#1}\def\equote_char{#2}% + \def\bhquote_char{#3}\def\ehquote_char{#4}} +% +\def\setquotes{\futurelet\test_token\CheckForOptArg} +\def\CheckForOptArg{\ifx\test_token[ + \let\next\OptArgPresent + \else \let\next\OptArgAbsent \fi \next} +\def\OptArgPresent[#1]#2{\csname #2#1q\endcsname} +\def\OptArgAbsent #1{\csname #1q\endcsname} + %--------------------------------------- + % Norwegian: + % +\def\Nq{% Output: <<...<...>...>> + \def\bquote_char {\char"13 }\def\equote_char {\char"14 }% + \def\bhquote_char {\char"0E}\def\ehquote_char {\char"0F}% + } +\def\NCq{% Output: ,,...,...'...'' + \def\bquote_char {\char"12 \apostrophe_check}% + \def\equote_char {\char"11 }% + \def\bhquote_char {\char"0D}\def\ehquote_char {\char"27}% + \apostrophetrue} +\let\NGq=\Nq \let\norwegianquotes=\Nq \let\norwegianguillemetsq=\Nq +\let\norwegiancommasq=\NCq + %----------------------------------------- + % German: + % +\def\DGq{% Output: >>...>...<...<< + \def\bquote_char {\char"14 }\def\equote_char {\char"13 }% + \def\bhquote_char {\char"0F}\def\ehquote_char {\char"0E}% + } +\def\DCq{% Output: ,,...,...`...`` + \def\bquote_char{\char"12 \apostrophe_check}% + \def\equote_char {\char"10 }% + \def\bhquote_char {\char"0D}\def\ehquote_char {\char"60}% + \apostrophetrue} +\let\Dq=\DCq \let\germanquotes=\DCq \let\germanguillemetsq=\DGq +\let\germancommasq=\DCq + %------------------------------------------ + % French: + % +\def\Fq{% Output: <<...<<...>>...>> + \def\bquote_char {\char"13\ }% + \def\equote_char {\thinspace\char"14 }% + \def\bhquote_char {\char"13\thinspace }% + \def\ehquote_char { \char"14 }% + } +\def\FCq{\message{French doesn't use comma quotes! + I shall choose guillemets instead.}} +\let\frenchquotes=\Fq \let\FGq=\Fq \let\frenchguillemetsq=\Fq +\let\frenchcommasq=\FCq + %------------------------------------------ + % English: + % +\def\GBq{% Output: `...``...''...' + \def\bquote_char {\char"60 }\def\equote_char {\char"27 }% + \def\bhquote_char {\char"10 }\def\ehquote_char {\char"11 }% + } +\def\USq{% Output: ``...`...'...'' + \def\bquote_char {\char"10 }\def\equote_char {\char"11 }% + \def\bhquote_char {\char"60 }\def\ehquote_char {\char"27 }% + } +\def\EQM{\message{English doesn't use guillmets! + I shall choose normal English quotes instead.}} +\let\USquotes=\USq \let\GBquotes=\GBq \let\USCq=\USq \let\GBCq=\GBq +\def\GBguillemetsq{\EQM\GBq} \def\USguillemetsq{\EQM\USq} +\let\englishquotes=\USq \let\englishcommasq=\USq \let\Eq=\USq \let\ECq=\USq +\let\englishguillemetsq=\USguillemetsq +%------------------------------------------- +\def\bquote{\global\advance\quotecount by1 \bquote_char}% +\def\equote{\penalty 10000 {\equote_char }\global\advance\quotecount by1 }% +\def\bhquote{\bhquote_char \global\advance\hquotecount by1 }% +\def\ehquote{\penalty 10000 \ehquote_char \global\advance\hquotecount by1 }% + +\newcount\quoteflag \newcount\quotecount +\newcount\hquoteflag \newcount\hquotecount +\def\hex{"} \let\star=* +\catcode`\"=\active \catcode`\*=\active +\def"{\begingroup\ifnum\quoteflag=0 + \aftergroup\bquote\global\quoteflag=1 + \else \equote\global\quoteflag=0 + \aftergroup\equote_check \fi \endgroup} +\def*{\begingroup\ifmmode \else\ifnum\hquoteflag=0 \bhquote\global\hquoteflag=1 + \else \ehquote\global\hquoteflag=0 + \aftergroup\ehquote_check \fi \fi \endgroup} +\def\equote_check{\futurelet\next\equote_test} +\def\ehquote_check{\futurelet\next\ehquote_test} +\def\equote_test{\ifcat\noexpand\next a% + \immediate\write16{^^J--->> Final full quote followed by a + letter!!}\equote_warning\fi} +\def\ehquote_test{\ifcat\noexpand\next a% + \immediate\write16{^^J---> Final half quote followed by a + letter!!}\ehquote_warning\fi} +\def\quotesnumbertest{\ifodd\quotecount\immediate\write16{!! Odd number + of full quotes.}\fi + \ifodd\hquotecount\immediate\write16{!! Odd number + of half quotes.}\fi} +\def\apostrophe_check{\futurelet\next\apostrophe_test} +\def\apostrophe_test{\if\next j\thinspace\fi} + +\def\l_note{\strut\vadjust{\kern-\dp\strutbox + \vtop to 0pt{% + \vss\llap{{\box0}\ + \quad}} + \dimen0=-\prevdepth\advance\dimen0by\dp\strutbox + \penalty0\kern\dimen0 +}} +\def\equote_warning{{\setbox0=\hbox{\equote_char\thinspace !\quad}\l_note}} +\def\ehquote_warning{{\setbox0=\hbox{\ehquote_char\thinspace !\quad}\l_note}} +% +%\catcode`\@=12 \catcode`\_=8 +\Nq +\endinput + +% Copy this to a new file: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% file name: balancedquotestest.tex +%% Ole Michael Selberg, 25.8.1994 +%% E-mail: O.M.Selberg@easteur-orient.uio.no +%%------------------------------------------------------------------- +%% Description: +%% This file inputs the file balancedquotes.sty and tests +%% the quote macros defined there. +%% It works with both plain TeX and LaTeX. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifLaTeX + % Is this LaTeX? +\ifx\protect\undefined \else \LaTeXtrue \fi + % We presuppose Cork-encoding: +\def\"{\accent4}\def\\{$\backslash$}\def\<{$\lbrace$} +\def\>{$\rbrace$} +\overfullrule=0pt + + +\ifLaTeX + \documentstyle [balancedquotes] {article} + \begin{document} +\else \input balancedquotes.sty +\fi + +\message{^^JType the name of a font with Cork encoding, + ^^Je.g. dcr10:} +\read16 to \dvifontname +\font\dvifont=\dvifontname at 10pt +\message{^^J} +\dvifont + +\hsize=10cm +\hoffset=2cm +\parindent=0pt + +\hyphenation{Af-ten-pos-ten} +\centerline{Test of {\tt balancedquotes.sty}\hfill + Date:\enspace \the\month/\the\day/\the\year} + +\vglue 1cm +%\Nq +\definequotes{\char19}{\char20}{\char14}{\char15} + +\moveleft 10pt\vbox{\bf The command {\tt \\Nq} (\dvifont Norwegian: "...*...*..."):} +\smallskip +"Det er sant," sa han, "jeg har nettopp avbestilt *Aftenposten*!" + +"Har du det?" svarte hun forbauset. "Hvorfor spurte du ikke meg f{\o}rst?" + +\medskip +{\leftskip20pt +Equivalent commands: +\smallskip +\tt +\\norwegianquotes ({\dvifont This is the default for Norwegian.}) + +\\NGq + +\\setquotes \<norwegian\> + +\\setquotes \<N\> + +\\setquotes [guillemets]\<norwegian\> + +\\setquotes [G]\<N\> + +\\norwegianguillemetsq + +\\definequotes \<\\char19\>\<\\char20\>\<\\char14\>\<\\char15\> + +} + +\bigskip + +\setquotes [commas]{norwegian} + + +\moveleft 10pt\vbox{\bf The command {\tt \\NCq} \dvifont (Norwegian: "...*...*..."):} +\smallskip +"Det er sant," sa han, "jeg har nettopp avbestilt *Aftenposten*!" + +"Har du det?" svarte hun forbauset. "Hvorfor spurte du ikke meg f{\o}rst?" +\medskip + +{\leftskip20pt +Equivalent commands: +\tt +\smallskip + +\\setquotes [commas]\<norwegian\> + +\\setquotes [C]\<N\> + +\\norwegiancommasq + +\\definequotes \<\\char18\>\<\\char17\>\<\\char13\>\<\\char39\> + +} +\bigskip +\Dq + +\moveleft 10pt\vbox{\bf The command {\tt \\Dq} \dvifont (German: "...*...*..."):} +\smallskip +Goethe schrieb: "Wielands *Oberon* wird als ein Meisterst\"uck angesehen." + +\medskip +{\leftskip20pt +Equivalent commands: +\smallskip +\tt + +\\germanquotes ({\dvifont This is the default for German}) + +\\DCq + +\\setquotes [commas]\<german\> + +\\setquotes [C]\<D\> + +\\germancommasq + +\\definequotes \<\\char18\>\<\\char17\>\<\\char13\>\<\\char39\> + +} + +\bigskip +\DGq + +\moveleft 10pt\vbox{\bf The command {\tt \\DGq} \dvifont (German: "...*...*..."):} +\smallskip +Goethe schrieb: "Wielands *Oberon* wird als ein Meisterst\"uck angesehen." + +\medskip +{\leftskip20pt +Equivalent commands: +\smallskip +\tt + +\\setquotes [guillemets]\<german\> + +\\setquotes [G]\<D\> + +\\germanguillmetsq + +\\definequotes \<\\char20\>\<\\char19\>\<\\char15\>\<\\char14\> + +} + +\ifLaTeX \else\filbreak\fi + +\USq + +\moveleft 10pt\vbox{\bf The command {\tt \\USq} \dvifont (US English: "...*...*..."):} +\smallskip +Goethe wrote: "Wieland's *Oberon* is considered a masterpiece." + +\medskip +{\leftskip20pt +Equivalent commands: +\smallskip +\tt + +\\setquotes \<US\> + +\\setquotes [commas]\<US\> + +\\setquotes [C]\<US\> + +\\UScommasq + +\\definequotes \<\\char16\>\<\\char17\>\<\\char96\>\<\\char39\> + +\\setquotes [guillmets]\<US\> {\dvifont etc.\ will generate an error message +and call} \\USq + +} + +\bigskip +\GBq + +\moveleft 10pt\vbox{\bf The command {\tt \\GBq} \dvifont (GB English: "...*...*..."):} +\smallskip +Goethe wrote: "Wieland's *Oberon* is considered a masterpiece." + +\medskip +{\leftskip20pt +Equivalent commands: +\smallskip +\tt + +\\setquotes \<GB\> + +\\setquotes [commas]\<GB\> + +\\setquotes [C]\<GB\> + +\\GBcommasq + +\\definequotes \<\\char96\>\<\\char39\>\<\\char16\>\<\\char17\> + +\\setquotes [guillmets]\<GB\> {\dvifont etc.\ will generate an error message +and call} \\GBq + +} + + +\bigskip +\Fq + +\moveleft 10pt\vbox{\bf The command {\tt \\Fq} \dvifont (French: "...*...*..."):} +\smallskip +On dit couramment {\it nic nie wiem\/} "je ne sais rien". + +\medskip +{\leftskip20pt +Equivalent commands: +\smallskip +\tt + +\\frenchquotes {\dvifont This is the default.} +\\setquotes \<GB\> + +\\setquotes [guillemets]\<F\> + +\\setquotes [G]\<F\> + +\\frenchguillemetsq + +\\definequotes \<\\char19\ \>\<\\ \\char20\>\<\\char19\ \>\<\\ \\char20\> + +\\setquotes [commas]\<french\> {\dvifont etc.\ will generate an error message +and call} \\Fq + +} + +\bigskip + +\NCq + +\moveleft 10pt\vbox{\bf Test of error detection when quotes are unbalanced:} +\smallskip +"Det er sant," sa han, "jeg har nettopp avbestilt *Aftenposten*!" + +"Har du det? svarte hun forbauset. "Hvorfor spurte du ikke meg f{\o}rst?" + + +\bigskip + + +\moveleft 10pt\vbox{\bf Test of {\tt \\hex} og {\tt \\star}} +\smallskip +The command {\tt \\hex} is used instead of {\tt +\\char\hex22} whenever {\tt \\char\hex22} does not denote +a quote sign. For instance, we can write: {\tt +\\char\hex41} in order to get an `A'. Here we +test that the macro {\tt \\hex} works as it should: `{\tt +\\char\\hex4F\\char\\hex4B}' +is output as `\char\hex4F\char\hex4B'. + +\smallskip +Instead of {\char \hex2A} we write {\tt \\star}. + +\def\slutt{\end{document}} +{\ifLaTeX + \aftergroup\slutt +\fi} + +\bye + diff --git a/Master/texmf-dist/tex/generic/genmisc/chessmin.tex b/Master/texmf-dist/tex/generic/genmisc/chessmin.tex new file mode 100644 index 00000000000..49b03d31b42 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/chessmin.tex @@ -0,0 +1,171 @@ +% These are two TeX macros which may be useful for writing about +% chess. \bore creates a chess diagram from Forsyth notation, with +% Z used as a terminator. For example, +% +% $$\bore r1bqkbnr pppp1ppp 2n5 1B2p3 4P3 5N2 PPPP1PPP RNBQK2R Z$$ +% +% shows the Ruy Lopez after white's third move. +% +% \VAR (number) (moves separated by spaces) Z may be used to write +% a variation. The macro inserts the move numbers, starting with +% (number). For example, +% +% Continuing from the diagram above, \VAR 3 \dots{} a6 Ba4 Nf6 O--O +% Be7 Re1 b5 Bb3 O-O c3 d5 Z is the Marshall gambit. +% +% Note the \dots{} to indicate that Black made the first move. +% +% The diagrams created by \bore have pieces made up of a small number +% of rectangles. Much nicer diagrams and more powerful macros were +% created by Piet Tutelaers, available by anonymous ftp +% at sol.cs.ruu.nl (131.211.80.5). However, the ones offered here +% do not require additional fonts, and may be easier to use. +% +% I authorize circulation of these macros by ftp sites and similar +% nonprofit media. Improvements are welcome. An earlier version of +% the macros (with letters for pieces) was done several years ago, +% with substantial modifications by Steve Cochran. +% +% Charles Blair (ceblair@ux1.cso.uiuc.edu) +% macros start below--- you may cut here -------------------------- +% +% \fun is the fundamental length unit for the diagrams. If you +% replace 1.2pt by something else, the scale is changed. +% The box rf is not used, except to provide something with which to +% refer to \fun. +% +\newdimen\fun \dimen\fun=1.2pt +\newbox\rf \setbox\rf=\vbox to \dimen\fun{ +\hrule height \dimen\fun width \dimen\fun} +% +\def\oil{\offinterlineskip} % I needed to use this in all my vboxes +% +% Black pieces are made from solid boxes of specified height and +% width (the \filbox macro). For White pieces, \filbox is replaced by a +% macro (\blbox) which draws the lines around the border of such a box. +% (the white knight is an exception to this) +% The macro \tbo is defined as \blbox or \filbox as needed. +% +\def\filbox#1#2{\vbox{\oil \hrule height #1\ht\rf width #2\ht\rf}} +% +\newdimen\adjust +\def\blbox#1#2{\dimen\adjust=#1\ht\rf \advance\dimen\adjust by-0.4\ht\rf +\vbox{\oil \hrule height 0.2\ht\rf width #2\wd\rf +\hbox to #2\wd\rf{\vrule height \dimen\adjust width 0.2\wd\rf\hfil +\vrule height \dimen\adjust width 0.2\wd\rf} +\hrule height 0.2\ht\rf width #2\wd\rf}} +% +% Each piece is 12 units wide. \scen produces an hbox with this width +% and either a \blbox or a \filbox in the center. +% +\def\scen#1#2{\hbox to 12\wd\rf{\hfil\tbo{#1}{#2}\hfil}} +% +% Definitions (color independent) of each piece +% +\def\pawn{\vbox{\oil \scen{2.5}{4}\scen{3}{8}\scen{4.5}{4}\scen{3}{10}}} +% +\def\bishop{\vbox{\oil \scen{2}{2.5}\scen{3}{8}\scen{4}{10}% +\scen{3}{6}\scen{1.5}{12}}} +% +\def\rook{\vbox{\oil +\hbox to 12\wd\rf{\tbo2{2.5}\hfil\tbo2{2.5}\hfil\tbo2{2.5}} +\scen{3}{12}\scen{5.5}{7}\scen{3}{12}}} +% +\def\queen{\vbox{\oil \hbox to 12\wd\rf{\tbo{6}{2}\hfil\tbo{8}{2}% +\hfil\tbo{8}{2}\hfil\tbo{6}{2}}\scen{4}{10}}} +% +\def\king{\vbox{\oil% Next 4 lines are the cross part (improvement wanted) +\hbox to 12\wd\rf{\rlap% +{\hbox to 12\wd\rf{\hfil\vrule height 3\ht\rf width 0.2\wd\rf\hfil}}% +\hfil\raise 1.5\ht\rf% +\hbox{\vrule width 3\ht\rf height 0.2\ht\rf}\hfil} +\hbox to 12\wd\rf{\tbo{6}{4.5}\hfil\tbo{6}{4.5}} +\scen{4}{10}}} +% +\def\knight{\vbox{\oil \hbox{\hskip 7\wd\rf\tbo{1}{1}} +\hbox{\hskip2\wd\rf\tbo{2.5}{7}}\hbox{\hskip 2\wd\rf +\vbox to 3\ht\rf{\tbo{1}{1.5}\vfil}\hskip3\wd\rf\tbo{3}{2.5}} +\hbox{\hskip 3.4\wd\rf\tbo{4}{5.6}} +\tbo{2.5}{12}}} +% +% Creation of the boxes for the pieces +% +\newbox\WP \def\tbo#1#2{\blbox{#1}{#2}} \setbox\WP=\pawn +\newbox\BP \def\tbo#1#2{\filbox{#1}{#2}} \setbox\BP=\pawn +\newbox\WB \def\tbo#1#2{\blbox{#1}{#2}} \setbox\WB=\bishop +\newbox\BB \def\tbo#1#2{\filbox{#1}{#2}} \setbox\BB=\bishop +\newbox\WR \def\tbo#1#2{\blbox{#1}{#2}} \setbox\WR=\rook +\newbox\BR \def\tbo#1#2{\filbox{#1}{#2}} \setbox\BR=\rook +\newbox\WQ \def\tbo#1#2{\blbox{#1}{#2}} \setbox\WQ=\queen +\newbox\BQ \def\tbo#1#2{\filbox{#1}{#2}} \setbox\BQ=\queen +\newbox\WK \def\tbo#1#2{\blbox{#1}{#2}} \setbox\WK=\king +\newbox\BK \def\tbo#1#2{\filbox{#1}{#2}} \setbox\BK=\king +\newbox\BN \def\tbo#1#2{\filbox{#1}{#2}} \setbox\BN=\knight +% +% The exceptional white knight (a lot of work to avoid a line at neck!) +% +\newbox\WN \def\tbo#1#2{\blbox{#1}{#2}} \setbox\WN= +\vbox{\oil \hbox{\hskip 7\wd\rf\tbo{1}{1}} +\hbox{\hskip2\wd\rf\vrule height 2.5\ht\rf width 0.2\ht\rf +\vbox to 2.5\ht\rf{\hrule height 0.2\ht\rf width 6.6\wd\rf\vfil +\hrule height 0.2\ht\rf width 4.5\wd\rf}% +\vrule height 2.5\ht\rf width 0.2\wd\rf} +\hbox{\hskip 2\wd\rf +\vbox to 3\ht\rf{\tbo{1}{1.5}\vfil}\hskip3\wd\rf +\hbox to 2.5\wd\rf{\vrule height 3\ht\rf width 0.2\wd\rf\hfil +\vrule height 3\ht\rf width 0.2\wd\rf}} +\hbox{\hskip 3.4\wd\rf\tbo{4}{5.6}} +\tbo{2.5}{12}} +% +% \ver is the line used for square boundaries on the board +% \nver is thinner line used to shade dark squares (if no piece on them) +% \hor draws horizontal lines for each rank +% +\def\ver{\vrule height 15\ht\rf width 0.4\wd\rf} +\def\nver{\vrule height 15\ht\rf width 0.1\wd\rf} +\def\hor{\hrule height 0.4\wd\rf width 120\wd\rf} +% + \newcount\color \newcount\blanks +\def\blanksquare{\ifodd\color \hbox to 15\wd\rf{\hfil\nver% +\hfil\nver\hfil\ver}\else\hbox to 15\wd\rf{\hfil\ver}\fi +\advance\color by 1} +% +% Each piece is centered inside a 15-unit square +% +\def\cen#1{\hbox to 15\wd\rf{\hfil\vbox to 15\ht\rf{\vfil\copy#1\vfil}% +\hfil\ver}} +% +% This processes the characters specifying a row of the diagram. It +% is patterned after the \length example at the end of chapter 20 +% of The TeXbook +\def\nextchar#1{\let\nex=\nextchar% +\ifcat7#1% +\blanks=#1\loop\ifnum\blanks>0 \blanksquare% +\advance\blanks by -1\repeat\else +\advance\color by 1% +\ifx#1P\cen{\WP}\else\ifx#1p\cen{\BP}\else% +\ifx#1N\cen{\WN}\else\ifx#1n\cen{\BN}\else% +\ifx#1B\cen{\WB}\else\ifx#1b\cen{\BB}\else% +\ifx#1Q\cen{\WQ}\else\ifx#1q\cen{\BQ}\else% +\ifx#1R\cen{\WR}\else\ifx#1r\cen{\BR}% +\else\ifx#1K\cen{\WK}\else\ifx#1k\cen{\BK}\else\let\nex=\relax% +\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\nex} +% +% \bore carries out preliminary steps for making the diagram. +% \rgc reads in a string of non-blank characters, checks that the +% first character is not the terminator Z, gives the string to \nextchar, +% and then processes the next string. (again patterned after \length) +% +\def\bore#1Z{\color=1\vbox{\oil \hor\rgc#1 Z }} +\def\rgc#1#2 {\advance\color by 1\let\nx=\rgc\ifx#1Z\let\nx=\relax +\else\hbox{\ver\nextchar#1#2Z}\hor\fi\nx} +% +% This macro prints a variation. It is supposed to use the ideas of +% \length and seems to work, but there is something I don't understand: +% if the {} following the \else is deleted, something goes wrong. Why? +% +\newcount\move \newcount\iswhite +\def\VAR#1 #2Z{\move=#1\iswhite=1\listem #2 Z } +\def\listem#1#2 {\ifx#1Z\let\nx=\relax\else{}% +\ifodd\iswhite{} \number\move~#1#2\else% +~#1#2\advance\move by 1\fi\advance\iswhite by 1\let\nx=\listem\fi\nx} diff --git a/Master/texmf-dist/tex/generic/genmisc/compare.tex b/Master/texmf-dist/tex/generic/genmisc/compare.tex new file mode 100644 index 00000000000..05976cbe865 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/compare.tex @@ -0,0 +1,12 @@ +% compare.tex - macro to compare two strings +% By \'Eamonn McManus. This file is not copyrighted. + +\def\compare#1#2{\compcont#1\ \\#2\ \\} +\def\compcont#1#2\\#3#4\\{% + \csname comp% + \if #1#3\if #1\ same\else cont\fi + \else \ifnum `#1<`#3less\else greater\fi \fi + \endcsname #2\\#4\\} +\def\compsame#1\\#2\\{0} +\def\compless#1\\#2\\{-1} +\def\compgreater#1\\#2\\{1} diff --git a/Master/texmf-dist/tex/generic/genmisc/cropmark.sty b/Master/texmf-dist/tex/generic/genmisc/cropmark.sty new file mode 100644 index 00000000000..f6bdada0fb6 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/cropmark.sty @@ -0,0 +1,94 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Cropmark.tex +% version 1.0 +% +% This will put crop marks on everythings that's \shipout'ed. +% It will work with any format, since it relies on redefinition +% of \shipout. Exception: if you declare \output{} you will +% not get crop marks. +% +% Cut along the center of the rules to get exactly the shipped +% out box. To get padding around this box, use the parameters below. +% +% User adjustable parameters: +% \croplength length of the crop rules +% \cropwidth width of the crop rules +% \cropsep separation between rule and page box +% \croppadtop padding in case page box looks bigger than it is +% \croppadbot (for instance with plain TeX head/footline) +% \croppadlr +% +% Date: 17 March 1992 +% +% Author: +% Victor Eijkhout +% Department of Computer Science +% University Tennessee at Knoxville +% 104 Ayres Hall +% Knoxville, TN 37996 +% USA +% +% eijkhout@cs.utk.edu +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% save the old \shipout command +\let\xshipout\shipout + +% define a new one: investigate what's being shipped +\def\shipout{\futurelet\SomeBox\yshipout} + +% if its a box register, do postprocessing with \afterassignment, +% otherwise do \afterassignment which will do \aftergroup +\def\yshipout + {\ifx\SomeBox\box \let\next\shipAfterRegister + \else \ifx\SomeBox\copy \let\next\shipAfterRegister + \else \let\next\shipAfterBox \fi\fi + \afterassignment\next\setbox0= + } +\def\shipAfterBox{\aftergroup\shipAfterRegister} + +% now we have whatever is being shipped in box0, +% so we can insert crop marks +\newdimen\croplength \croplength=20pt +\newdimen\cropsep \cropsep=10pt +\newdimen\cropwidth \cropwidth=2pt + +\newdimen\croppadtop \croppadtop=0pt +\newdimen\croppadbot \croppadbot=0pt +\newdimen\croppadlr \croppadlr=0pt + +\def\crophrule{\vrule height\cropwidth depth0pt width\croplength} +\def\cropvrule{\vrule width\cropwidth depth0pt height\croplength} + +\def\shipAfterRegister + {\setbox0\vbox + {\offinterlineskip + \dimen0\cropsep\advance\dimen0\croplength + \setbox2\hbox to \wd0 + {\kern-\croppadlr\kern-.5\cropwidth + \cropvrule\hfil\cropvrule + \kern-.5\cropwidth\kern-\croppadlr} + \setbox4\hbox to \wd0{\llap{\crophrule\kern\cropsep\kern\croppadlr} + \hfil + \rlap{\kern\croppadlr\kern\cropsep\crophrule}} + % go a bit up, put vertical rules, put horizontal rules + \kern-\dimen0 + \copy2 + \kern\cropsep\kern-.5\cropwidth + \copy4 + \kern-.5\cropwidth + % padding + \kern\croppadtop + % the box to be shipped + \box0 + % padding + \kern\croppadbot + % and now the top in reverse + \kern-.5\cropwidth + \box4 + \kern-.5\cropwidth\kern\cropsep + \box2 + } + \xshipout\box0\relax} +\endinput diff --git a/Master/texmf-dist/tex/generic/genmisc/cropmark.tex b/Master/texmf-dist/tex/generic/genmisc/cropmark.tex new file mode 100644 index 00000000000..3f04674e820 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/cropmark.tex @@ -0,0 +1,154 @@ +%% Save file as: CROPMARK.TEX Source: FILESERV@SHSU.BITNET +% Author: Peter Ungar <LAXA@ACFcluster.NYU.EDU> +% +% CROPMARK MACROS FOR PLAIN TEX. Feb. 10, 1992 01:31 Peter Ungar 914 723 7187 +% Cropmarks are markings on pages intended to be phototypeset. They mark the +% corners of the intended book page. +% THE DIMENSION SPECIFICATIONS (\paperheight,\paperwidth, \topmargin, +% \outsidemargin, \hsize, \vsize) SHOULD COME BEFORE THE MACROS. OTHERWISE +% THE CROPMARKS GO INTO ODD LOCATIONS. THESE QUANTITIES ARE ASSIGNED VALUES +% IN THIS FILE TO MAKE THE EXAMPLE WORK. REPLACE THE GIVEN VALUES BY THE +% ONES YOU NEED BEFORE INSTALLING THE MACROS. HSIZE IS THE LENGTH OF THE LINES +% AND VSIZE IS THE HEIGHT OF THE PRINTED PAGE NOT COUNTING HEADER OR FOOTER. +% \lefttopcropmark should be inserted at the beginning of the +% headline. It is a \llap and should not take space away from any other item +% in the headline. \righttopcropmark should be at the end of the headline. +% If there is no \hfil in the headline, use one to put the cropmark to +% the end of the headline. It is a \rlap and in theory it should not take +% space away +% from other items. Do not to put a space in front of \righttopcropmark be- +% cause the space will be typeset unless it is preceded by a control sequence. +% The bottom cropmarks should be inserted in the beginning and end of the +% \footline. Be sure to fill space in the middle with \hfil. +% Remember that the \footline definition has to come BEFORE the end of the +% first page. +% The values of \voffset and \hoffset can be adjusted to try to push the +% entire page including the cutmarks into the area your printer can print. +% The quantities you have to input are +% \paperheight, \paperwidth, \topmargin (measured from the top of the headline +% which is assumed to be 10-point size, and \outsidemargin which will be the +% right margin of odd-numbered pages and the left margin of even numbered +% pages. The other quantities which are needed are computed by the macros. +% The computations two empirical corrections. +% If the dimensions on your printout are slightly off, try over or under- +% stating the true dimensions of the above quantities. +% The macros ought to work for all values of \hsize and \vsize but if these +% are too large the cropmarks may not fit the area most printers can print. +% \nocropmarks replaces the cropmark macros by \relax (blanks). The cropmarks +% are needed only for phototypesetting and we may not want to see them on +% printout prepared for other purposes. +% TEX WILL NOT LET YOU KNOW IF YOU DID NOT ASSIGN A VALUE TO A DIMENSION. +% THAT MAY BE THE REASON IF YOU GET BIZARRE RESULTS. THE VALUES MUST COME +% BEFORE THE MACROS. + +%\magnification 1042 %% Needed to get exact dimensions on the MacPlus screen. + +\voffset=20mm\hoffset=15mm % Needed to bring cropmarks within printable area. +\overfullrule=0mm % To prevent overfullrules being added to cropmarks +\newdimen\paperheight +\newdimen\paperwidth +\newdimen\topmargin +\newdimen\outsidemargin +\newdimen\insidemargin +\newdimen\leftmargin +\newdimen\rightmargin +\newdimen\topliftadjustment +\newdimen\bottomliftadjustment +\newdimen\topcropmarklift +\newdimen\bottomcropmarklift +\newdimen\leftsideskip +\newdimen\rightsideskip +\newdimen\bclifta +\newdimen\bcliftb + +\vsize=182mm +\hsize=112mm +\paperheight=227.4mm % These six quantities specify the margins. +\paperwidth=152.3mm % The ones introduced below are either +\topmargin=14mm % computed from these by the macros or they +\outsidemargin=25mm % are auxiliary. + +\topliftadjustment=2.6mm +\bottomliftadjustment=15.5mm +\insidemargin=\paperwidth +\advance\insidemargin by -\outsidemargin +\advance\insidemargin by -\hsize + +\def\leftorright{\ifodd\pageno +\leftmargin=\insidemargin\rightmargin=\outsidemargin\else +\leftmargin=\outsidemargin\rightmargin=\insidemargin\fi +\leftsideskip=\leftmargin +\advance\leftsideskip by -4.05mm +\rightsideskip=\rightmargin +\advance\rightsideskip by -4.05mm} + +\def\lefttopcropmark{{\parindent=0mm\llap{\vtop{ +\hsize=\leftmargin +\vskip-\topliftadjustment +\vskip-\topmargin +\vrule height 0.05mm depth 4mm width 0.05mm +\vrule height 0.05mm depth0mm width 4mm +\hfill}}}} +\def\righttopcropmark{{\parindent=0mm\rlap{\vtop{\hsize=\rightmargin +\vskip-\topliftadjustment +\vskip-\topmargin +\hfill +\vrule height 0.05mm depth0mm width 4mm +\vrule height 0.05mm depth 4mm width 0.05mm +}}}} + +\bottomcropmarklift=-\paperheight +\advance\bottomcropmarklift by\topmargin +\advance\bottomcropmarklift by\vsize +\advance\bottomcropmarklift by\bottomliftadjustment + +\bclifta=\bottomcropmarklift +\advance\bclifta by 4mm +\bcliftb=\bottomcropmarklift +\advance\bcliftb by -0.05mm + +\def\leftbottomcropmark{{\parindent=0mm\llap{ +\hbox{\vrule height\bclifta depth -\bottomcropmarklift width 0.05mm +\vrule height \bottomcropmarklift depth -\bcliftb width 4mm +\hskip\leftsideskip}}}} + +\def\rightbottomcropmark{{\parindent=0mm\rlap{\hbox{\hskip\rightsideskip +\vrule height \bottomcropmarklift depth -\bcliftb width 4mm +\vrule height\bclifta depth -\bottomcropmarklift width 0.05mm}}}} + + +\def\nocropmarks{\def\lefttopcropmark{\relax} % THIS TURNS OFF CROPMARKS +\def\righttopcropmark{\relax} +\def\leftbottomcropmark{\relax} +\def\rightbottomcropmark{\relax}} +\endinput + +% END OF THE MACROS. AN EXAMPLE FOLLOWS. COMMENT OUT \endinput TO +% TYPESET IT. + +\headline={\leftorright\lefttopcropmark\ifodd\pageno +\hfil HEADLINE\hfil\folio\else +\folio\hfil HEADLINE\hfil \fi +\righttopcropmark} +\footline={\leftorright\leftbottomcropmark +\hfil +\rightbottomcropmark} + +\noindent Topliftadjustment=2.6mm bottomliftadjustment=15.5mm +\hfill H + +\noindent paperheight=227.4mm paperwidth=152.3mm + +\noindent topmargin=14mm outsidemargin=25mm + +\noindent vsize=182mm hsize=112mm + +NOTE THAT THE DIMENSION SPECIFICATIONS MUST COME BEFORE THE MACROS. +\vfill +\noindent\line{Here is the bottom left corner. \hfil Bottom right is H} +\eject +\noindent\line{Here is the top left corner.\hfil Top right is H} +\vfill +\noindent\line{Here is the bottom left corner. \hfil Bottom right is H} +\eject +\end diff --git a/Master/texmf-dist/tex/generic/genmisc/croptest.tex b/Master/texmf-dist/tex/generic/genmisc/croptest.tex new file mode 100644 index 00000000000..06058b6861d --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/croptest.tex @@ -0,0 +1,44 @@ +% An illustration of cropmark.sty by Victor Eijkhout. +% This file belongs to cropmark.sty version 1.0 or later, +% it is both plain TeX and LaTeX compatible. + +\def\plainname{plain} +\ifx\fmtname\plainname + \input cropmark.sty +\else + \documentstyle[cropmark]{article} + \begin{document} +\fi + +\parindent=0pt +\def\page +{Left\hfill toP +\vfill +Bottom\hfill righT +\eject} + +% First illustrate the default settings + +\page + +% Now stretch a bit (this is necessary for LaTeX) + +\ifx\plainname\fmtname + \advance\croppadtop by 5pt + \advance\croppadbot by 5pt + \advance\croppadlr by 2pt +\else + \addtolength{\croppadtop}{-10pt} + \addtolength{\croppadbot}{15pt} + \addtolength{\croppadlr}{15pt} +\fi + +\page + +\edef\byebye{ +\if\fmtname\plainname + \noexpand\csname bye\noexpand\endcsname +\else + \noexpand\end{document} +\fi} +\byebye
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/genmisc/dayofweek.tex b/Master/texmf-dist/tex/generic/genmisc/dayofweek.tex new file mode 100644 index 00000000000..4ce46ac2434 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/dayofweek.tex @@ -0,0 +1,149 @@ +% +% \DayOfWeek expands to the day of the week ("Sunday", etc.) +% \PhaseOfMoon expands to the phase of the moon +% +% Written by Martin Minow of DEC (minow%bolt.dec@decwrl.dec.com). +% +\def\DayOfWeek{% +% +% Calculate day of the week, return "Sunday", etc. +% + \newcount\dow % Gets day of the week + \newcount\leap % Leap year fingaler + \newcount\x % Temp register + \newcount\y % Another temp register +% leap = year + (month - 14)/12; + \leap=\month \advance\leap by -14 \divide\leap by 12 + \advance\leap by \year +% dow = (13 * (month + 10 - (month + 10)/13*12) - 1)/5 + \dow=\month \advance\dow by 10 + \y=\dow \divide\y by 13 \multiply\y by 12 + \advance\dow by -\y \multiply\dow by 13 \advance\dow by -1 \divide\dow by 5 +% dow += day + 77 + 5 * (leap % 100)/4 + \advance\dow by \day \advance\dow by 77 + \x=\leap \y=\x \divide\y by 100 \multiply\y by 100 \advance\x by -\y + \multiply\x by 5 \divide\x by 4 \advance\dow by \x +% dow += leap / 400 + \x=\leap \divide\x by 400 \advance\dow by \x +% dow -= leap / 100 * 2; +% dow = (dow % 7) + \x=\leap \divide\x by 100 \multiply\x by 2 \advance\dow by -\x + \x=\dow \divide\x by 7 \multiply\x by 7 \advance\dow by -\x + \ifcase\dow Sunday\or Monday\or Tuesday\or Wednesday\or + Thursday\or Friday\or Saturday\fi +} +%% +%% +%% +\def\PhaseOfMoon{% Calculate the phase of the (civil) moon. +% +% The routine calculates the year's epact (the age of the moon on Jan 1.), +% adds this to the number of days in the year, and calculates the phase +% of the moon for this date. It returns the phase as a string, e.g., +% "new", "full", etc. +% +% In the algorithm: +% +% diy Is the day of the year - 1 (i.e., Jan 1 is day 0). +% +% golden Is the number of the year in the Mentonic cycle, used to +% determine the position of the calender moon. +% +% epact Is the age of the calender moon (in days) at the beginning +% of the year. To calculate epact, two century-based +% corrections are applied: +% Gregorian: (3 * cent)/4 - 12 +% is the number of years such as 1700, 1800 when +% leap year was not held. +% Clavian: (((8 * cent) + 5) / 25) - 5 +% is a correction to the Mentonic cycle of about +% 8 days every 2500 years. Note that this will +% overflow 16 bits in the year 409600. Beware. +% +% The algorithm is accurate for the Gregorian calender only. +% +% The magic numbers used in the phase calculation are as follows: +% 29.5 The moon's period in days. +% 177 29.5 scaled by 6 +% 22 (29.5 / 8) scaled by 6 (this gets the phase) +% 11 ((29.5 / 8) / 2) scaled by 6 +% +% Theoretically, this should yield a number in the range 0 .. 7. However, +% two days per year, things don't work out too well. +% +% Epact is calculated by the algorithm given in Knuth vol. 1 (calculation +% of Easter). See also the article on Calenders in the Encyclopaedia +% Britannica and Knuth's algorithm in CACM April 1962, page 209. +% + \newcount\cent % Century number (1979 == 20) + \newcount\epact % Age of the moon on Jan. 1 + \newcount\diy % Day in the year + \newcount\golden % Moon's golden number + \newcount\x % Temp + \newcount\m % Temp for modulus + \diy=\day \advance\diy by \ifcase\month % Jan 1 == 0 + -1\or -1\or 30\or 58\or 89\or 119\or 150\or % Jan .. Jun + 180\or 211\or 241\or 272\or 303\or 333\fi % Jul .. Dec +% if ((month > 2) && ((year % 4 == 0) && +% ((year % 400 == 0) || (year % 100 != 0)))) +% diy++; /* Leapyear fixup */ + \ifnum \month>2 + \x=\year \m=\x \divide\m by 4 \multiply\m by 4 \advance\x by -\m + \ifnum \x=0 % month > 2 and maybe leapyear + \x=\year \m=\x \divide\m by 400 \multiply\m by 400 \advance\x by -\m + \ifnum \x=0 % 2000 is a leap year + \advance\diy by 1 % so it's one day later + \else % not 2000, check other '00's + \x=\year \m=\x \divide\m by 100 \multiply\m by 100 \advance\x by -\m + \ifnum \x>0 % not some other '00' year + \advance\diy by 1 % it's still one day later + \fi % not odd century + \fi % not 2000-type century + \fi % not leapish year + \fi % not march or later +% cent = (year / 100) + 1; /* Century number */ +% golden = (year % 19) + 1; /* Golden number */ + \cent=\year \divide\cent by 100 \advance\cent by 1 + \golden=\year + \m=\year \divide\m by 19 \multiply\m by 19 \advance\golden by -\m + \advance\golden by 1 +% epact = ((11 * golden) + 20 /* Golden number */ +% + (((8 * cent) + 5) / 25) - 5 /* 400 year cycle */ +% - (((3 * cent) / 4) - 12)) % 30;/* Leap year correction */ + \epact=11 \multiply\epact by \golden + \advance\epact by 20 + \x=8 \multiply\x by \cent \advance\x by 5 + \divide\x by 25 \advance\x by -5 + \advance\epact by \x + \x=3 \multiply\x by \cent \divide\x by 4 \advance\x by -12 + \advance\epact by -\x + \m=\epact \divide\m by 30 \multiply\m by 30 \advance\epact by -\m +% if (epact <= 0) +% epact += 30; /* Age range is 1 .. 30 */ +% if ((epact == 25 && golden > 11) || epact == 24) +% epact++; + \ifnum \epact<0 + \advance\epact by 30 + \fi + \ifnum \epact=25 + \ifnum \golden>11 + \advance \epact by 1 + \fi + \else + \ifnum \epact=24 + \advance \epact by 1 + \fi + \fi +% +% Calculate the phase, using the magic numbers defined above. +% Note that phase may be equal to 8 (== 0) on two days of the year +% due to the way the algorithm was implemented. +% phase = (((((diy + epact) * 6) + 11) % 177) / 22) & 7; +% + \x=\diy \advance\x by \epact \multiply\x by 6 \advance\x by 11 + \m=\x \divide\m by 177 \multiply\m by 177 \advance\x by -\m + \divide\x by 22 + \ifcase\x new\or waxing crescent\or in its first quarter\or + waxing gibbous\or full\or waning gibbous\or + in its last quarter\or waning crescent\or new\fi +} diff --git a/Master/texmf-dist/tex/generic/genmisc/daytime.sty b/Master/texmf-dist/tex/generic/genmisc/daytime.sty new file mode 100644 index 00000000000..cfeeafb205b --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/daytime.sty @@ -0,0 +1,30 @@ +%% Save file as: DAYTIME.STY Source: FILESERV@SHSU.BITNET +%% Source: INFO-TeX@SHSU.edu (Wed, 2 Oct 1991 10:01:43 EDT) +%% Author: Mauro Orlandini <ORLANDINI@HEAVAX.GSFC.NASA.GOV> +%% Modified: George D. Greenwade <bed_gdg@SHSU.edu> -- added \Daytime +%% to not have the leading 0 on 1:00 --- 9:00 +\begingroup + \count0=\time + \count1=\count0 + \divide\count0 by 60 + \count2=\count0 + \multiply\count0 by 60 + \advance\count1 by -\count0 + \ifnum\count2>11 + \ifnum\count2>12 \advance\count2 by -12\fi + \def\ampm{pm}% + \else + \ifnum\count2=0 \advance\count2 by 12\fi + \def\ampm{am}% + \fi + \xdef\daytime{% + \ifnum\count2<10 0\fi \the\count2:% + \ifnum\count1<10 0\fi \the\count1 + \ampm + }% + \xdef\Daytime{% %GDG + \the\count2:% %GDG + \ifnum\count1<10 0\fi \the\count1 %GDG + \ampm %GDG + }% %GDG +\endgroup diff --git a/Master/texmf-dist/tex/generic/genmisc/default.sty b/Master/texmf-dist/tex/generic/genmisc/default.sty new file mode 100644 index 00000000000..b2a0f0c0232 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/default.sty @@ -0,0 +1,311 @@ +% DEFAULT.STY, version 1.3 July 1998, provides +% 1. macro parameter-defaulting mechanism. +% 2. user stack and dynamic array +% Particularly useful if you have macros with many parameters, and you +% don't want to remember all of them all the time. +% +% Author: Zhuhan Jiang, University of New England, Australia +% Email: zhuhan@neumann.une.edu.au +% +% NOTES: +% 1. This style file can be loaded in as many times as you want, +% without overrunning the resources for such as counter +% registers and etc. So different packages may all use it to +% default their macro parameters, without causing any conflict. +% 2. Macro parameters that can be defaulted through this style file +% are those included in square brackets. E.g. #1, #2, #3 in +% \foo[#1][#2][#3]#4#5 are defaultable while #4 and #5 here are +% not. +% 3. If \foo is a macro to be defaulted, the original macro \foo +% will be renamed as ``\foo@ raw'' (yes, there is a space) and +% the new macro \foo will be defined through the use of the +% original ``\foo@ raw''. +% +% MAIN MACRO: +% \setdefalut{cmdname}{n}{default1}{..}{default_n} +% - gives defaults to \cmdname[p_1][p_2]..[p_n] +% (the macro to be defaulted must be already defined +% when \setdefault is executed) +% EXAMPLES: +% 1. Suppose \foo is defined for \foo[#1][#2][#3]{#4}, we may default +% all (or some of) the parameters in the SQUARE BRACKETS to for +% instance 'one', 'two' and 'three' via +% \setdefault{foo}{3}{one}{two}{three} +% This way, command \foo{stuff} or \foo[]{stuff} or \foo[][]{stuff} +% or \foo[][][]{stuff} will all be translated as +% \foo[one][two][three]{stuff}. Command \foo[][2]{stuff} will be +% translated as \foo[one][2][three]{stuff}. +% 2. See how \placebox is defined and redefined via \setdefault +% in this file. +% +% TIP: +% The best strategy to define (e.g.) \foo[#1][#2]{#3} so that +% it has defaults for #1 and #2 +% 1. define \foo@[#1][#2]#3 as normal (what you wish) +% 2. define \foo[#1][#2]#{\foo@[#1][#2]} to make {#3} mandatory +% 3. use \setdefault{foo}{2}{one}{two} to default #1=one and #2 to two +% +% MINOR MACROS: +% \placebox[#1][#2][#3][#4][#5][#6]{#7} +% - place stuff #7 in a box at the position specified +% by parameters #1, ..., #6. (move mini page around) +% #1: box position (default 0) +% 1--6--2 <-- top of the box +% | | +% | | +% | | +% 9 5 7 0 is -5 <-- middle height of the box +% | | +% 10 11 12 <-height up <-- baseline +% | | depth down +% 4--8--3 <-- bottom of the box +% #1<=0: box has no width, no height +% #2: x shift (default 0pt) +% #3: y shift (default 0pt) +% #4,#5: extra x,y shift in multiple of box width/10, height/10 +% #6: box type: v=vbox, otherwise=hbox +% #7: content to be boxed +% \push{ ... } - push stuff to stack; anything can be saved to +% \pop - pop stack +% \popnil - delete stack top element (pop to nil) +% \fetch{#1} - fetch #1-th entry from the stack +% (illegal number #1 will produce \relax) +% if #1>0, fetch #1-th entry from bottom of stack +% if #1>=0, fetch (-#1)-th element from top of stack +% e.g. +% fetch{0} - fetch the element of the top of stack +% fetch{-1} - the element just below the top of stack +% fetch{2} - 2nd element from the bottom of stack +% +\ifx\EntryDefault\undefined + \message{1.3 13/7/98}% + {\catcode`\@=11\relax \def\temp@macro{\space\space\space\space}% + \wlog{\temp@macro DEFAULT.STY version 1.3 July 1998 By Z Jiang}% + \wlog{\temp@macro University of New England, Australia}% + \wlog{\temp@macro Email: zhuhan@neumann.une.edu.au}}% +\fi +\xdef\EntryDefault{\the\catcode`\@}\catcode`\@=11\relax % SAVE @'s STATUS +% +% +% NEW MEASURES etc (parameter defaulting mechanism given by macros below) +\def\new@measures{% + \def\temp@@macro##1##2##3{\expandafter\ifx\csname ##3temp##2##1\endcsname + \relax\edef\next{\noexpand\csname new##1\noexpand\endcsname + \csname ##3temp##2##1\endcsname}% + \else\let\next\relax\fi\next}% + \def\temp@macro##1{% + \temp@@macro{##1}{@}{}\temp@@macro{##1}{@@}{}\temp@@macro{##1}{@@@}{}}% + \temp@macro{count}\temp@macro{toks}\temp@macro{box}\temp@macro{read}% + \temp@@macro{if}{@}{if}\temp@@macro{if}{@@}{if}\temp@@macro{if}{@@@}{if}% + \def\temp@@macro##1{\expandafter\ifx\csname temp##1dim\endcsname + \relax\edef\next{\noexpand\csname newdimen\noexpand\endcsname + \csname temp##1dim\endcsname}% + \else\let\next\relax\fi\next}% + \temp@@macro{@}\temp@@macro{@@}\temp@@macro{@@@}% +}% +\let\temp@@@macro=\wlog\def\wlog#1{}\new@measures +% +%%% GENERAL STACK +\def\make@STKcount{\csname newcount\endcsname + \STKcount\global\STKcount=0\relax}% +\ifx\STKcount\undefined@ + \def\next{\make@STKcount}\else\def\next{}\fi +\next % ensures stack pointer not flushed if this piece of code + % is loaded again +% +\long\def\push#1{\global\advance\STKcount1\relax +\expandafter\gdef\csname STK\the\STKcount\string~\endcsname{#1}}% +% +\def\popnil{\expandafter\let\expandafter\temp@macro + \csname STK\the\STKcount\string~\endcsname + \ifnum\STKcount>0\global\expandafter\let + \csname STK\the\STKcount\string~\endcsname=\undefined@ + \global\advance\STKcount-1% + \else + \def\temp@macro{}\global\STKcount=0% + \fi\relax % \temp@macro for pop +}% +% +\def\pop{\popnil\temp@macro}% +% +\def\fetch@#1{\ifnum#1>0 \relax \temp@count=#1 \else + \temp@count=\STKcount \advance\temp@count by #1 \fi + \csname STK\the\temp@count\string~\endcsname +}% +\def\fetch#{\fetch@}% +% +%% GET PARAMETERS +\long\def\get@nepara[#1][#2]{{\def\next@{#2}% +\ifx\next@\empty\push{#1}\else\push{#2}\fi}\ag@in}% +% +\long\def\get@para\left@#1\right@{% +\def\check@{% + \ifx[\next@ \def\full@####1{\get@nepara[#1]####1}% + \else \def\full@{\get@nepara[#1][#1]}\fi + \full@}% +\futurelet\next@\check@}% +% +\long\def\do@nepara\left@#1\right@#2\p@r@end{% +\gdef\p@r@data{#2}\global\advance\p@r@count1\get@para\left@#1\right@}% +% +\def\ag@in{\ifx\p@r@data\empty \def\next@{\relax +\getp@r@s\run@CMD}\else +\def\next@{\expandafter\do@nepara\p@r@data\p@r@end}\fi +\next@}% +% +\def\run@CMD{\csname STK\the\STKcount\string~\endcsname}% +% +\def\num@to@word#1{\ifcase #1 \or + \def\temp@macro{one}\or \def\temp@macro{two}\or + \def\temp@macro{three}\or \def\temp@macro{four}\or + \def\temp@macro{five}\or \def\temp@macro{six}\or + \def\temp@macro{seven}\or \def\temp@macro{eight}\or + \def\temp@macro{nine}\else \def\temp@macro{}\fi +\temp@toks=\expandafter{\temp@macro}}% +% +\temp@@count=1 % make nine newtoks, if they don't already exist +\loop \num@to@word{\temp@@count}% + \expandafter\ifx\csname p@r@\the\temp@toks\endcsname\relax + \temp@@toks={newtoks}\expandafter\csname\expandafter\the + \expandafter\temp@@toks\expandafter\endcsname + \csname p@r@\the\temp@toks\endcsname\fi + \advance\temp@@count by 1 \ifnum\temp@@count<10 \repeat +% +\ifx\p@r@count\undefined@ \csname newcount\endcsname\p@r@count\fi +\long\def\st@ckparas#1\p@r@end{% +\global\p@r@count=0\gdef\p@r@data{#1}\ag@in}% +% +% PARAMETER ASSIGNMENT % use \temp@count +\def\getp@r@s{\temp@count=\p@r@count +{\loop + \ifnum\temp@count>0 % + \expandafter\let\expandafter + \temp@macro\csname STK\the\STKcount\string~\endcsname + \ifcase\temp@count + \or \global\p@r@one=\expandafter{\temp@macro}% + \or \global\p@r@two=\expandafter{\temp@macro}% + \or \global\p@r@three=\expandafter{\temp@macro}% + \or \global\p@r@four=\expandafter{\temp@macro}% + \or \global\p@r@five=\expandafter{\temp@macro}% + \or \global\p@r@six=\expandafter{\temp@macro}% + \or \global\p@r@seven=\expandafter{\temp@macro}% + \or \global\p@r@eight=\expandafter{\temp@macro}% + \or \global\p@r@nine=\expandafter{\temp@macro}% + \else \errmessage{Parameter capacity exceeded.}% + % this should never happen: TeX's max para no. is 9 + \fi + \global\expandafter\let + \csname STK\the\STKcount\string~\endcsname=\undefined@% + \global\advance\STKcount-1% + \global\advance\temp@count-1\relax + \fi + \ifnum\temp@count>0 % +\repeat}}% +% +\def\clrp@r@s{%GLOBALLY clear +\global\p@r@one={}\global\p@r@two={}\global\p@r@three={}% +\global\p@r@four={}\global\p@r@five={}\global\p@r@six={}% +\global\p@r@seven={}\global\p@r@eight={}\global\p@r@nine={}}% +% +\def\read@paras#1{\temp@@@count=1 %use \temp@@@count and \temp@@count + \loop \num@to@word{\the\temp@@@count}\csname p@r@\the\temp@toks\endcsname={}% + \advance\temp@@@count by 1 \ifnum\temp@@@count<10 \repeat + \temp@@@count=1 \temp@@count=#1 % + \def\read@one@para##1{\num@to@word{\temp@@@count}% + \def\temp@macro{\left@ ##1\right@}% + \temp@@@toks=\expandafter{\temp@macro}% + \csname p@r@\the\temp@toks\endcsname\expandafter{\temp@macro}% + \advance\temp@@@count by 1 \read@continue}% + \def\read@continue{\num@to@word{\temp@@@count}% which uses \temp@macro + \ifnum\temp@@@count>\temp@@count \let\next@@\make@default + \edef\temp@@macro{\the\p@r@one\the\p@r@two\the\p@r@three\the\p@r@four + \the\p@r@five\the\p@r@six\the\p@r@seven\the\p@r@eight\the\p@r@nine}% + \else \let\next@@\read@one@para + \fi \next@@}\read@continue}% +% +\def\make@@default#1#2{\temp@count=#2\relax \temp@@count=1 %used \temp@@macro + \loop \num@to@word{\temp@@count}% + \ifnum\temp@@count>\temp@count \csname p@r@\the\temp@toks\endcsname={}% + \else \csname p@r@\the\temp@toks\endcsname + =\expandafter{\expandafter[\expandafter + \the\csname p@r@\the\temp@toks\endcsname]}\fi + \advance\temp@@count by 1 % + \ifnum\temp@@count<10 \repeat + \edef\temp@macro{\the\p@r@one\the\p@r@two\the\p@r@three\the\p@r@four + \the\p@r@five\the\p@r@six\the\p@r@seven\the\p@r@eight\the\p@r@nine}% + \temp@toks=\expandafter{\temp@macro}% + \temp@@toks=\expandafter{\temp@@macro}% + \expandafter\let\expandafter\temp@macro\csname #1\endcsname + \expandafter\ifx\csname #1@ raw\endcsname\relax + \expandafter\let\csname #1@ raw\endcsname\temp@macro\fi + \expandafter\edef\csname#1\endcsname{% + \noexpand\push{\noexpand\edef\noexpand\next@@{% + \noexpand\noexpand \noexpand \csname \noexpand#1@ raw\noexpand\endcsname + \the\temp@toks}% + \noexpand\popnil\noexpand\clrp@r@s\noexpand\next@@}\noexpand\st@ckparas + \the\temp@@toks \noexpand\p@r@end}}% +% +% \setdefalut{cmdname}{n}{default1}{..}{default_n} +% then \cmdname[#1][..][#n] can be defaulted. +\def\setdefault#1#2{\def\make@default{\make@@default{#1}{#2}}\read@paras{#2}} +% +% DEFAULT MECHANISM END: this piece of code can be included in any +% package and can be reloaded any times without overruning the resources. +% +% Now an example to use \setdefault: +% lower a box +\long\def\xylower#1#2#3{\bgroup\hskip#1\hbox{% #1=x #2=y #3=content + \ifmmode\let\SoftLower\undefined\else\def\SoftLower{}$\fi + \mathop{\vtop{\ialign{##\crcr \noalign{\kern#2}#3\crcr}}}% + \ifx\SoftLower\undefined\else $\fi}\egroup}% +% +% #1=box position(0) #2=x shift(0pt) #3=y shift(0pt) #6=v (vbox) +% #4,#5=extra x,y shift in multiple of box width/10, height/10 #7=content +\long\def\placebox[#1][#2][#3][#4][#5][#6]#7{\begingroup +\def\temp@macro{#6}\def\temp@@macro{v}\ifx\temp@macro\temp@@macro +\setbox\temp@box=\vbox{#7}\else \leavevmode % #1 (box position) +\setbox\temp@box=\hbox{#7}\fi\temp@dim=-\wd\temp@box % 1--6--2 +\temp@@dim=\ht\temp@box \temp@@@dim=\dp\temp@box % | | +\ifnum#1<0 \temp@count=-#1 \else\temp@count=#1 \fi % | | +\ifnum\temp@count=0 \temp@count=5 \fi % | | +\ifcase\temp@count % 9 5 7 0 is -5 + \or \temp@dim=0pt \temp@@dim=0pt % | | + \or \temp@@dim=0pt % 10 11 12 <-height up + \or \advance\temp@@dim by \temp@@@dim % | | depth down + \temp@@dim=-\temp@@dim % 4--8--3 + \or \temp@dim=0pt \advance\temp@@dim by % + \temp@@@dim \temp@@dim=-\temp@@dim % -#1: box has no width etc + \or \divide\temp@dim by 2 \advance\temp@@@dim by \temp@@dim + \divide\temp@@@dim by 2 \temp@@dim=-\temp@@@dim + \or \divide\temp@dim by 2 \temp@@dim=0pt + \or \advance\temp@@dim by \temp@@@dim + \temp@@dim=-\temp@@dim \divide\temp@@dim by 2 + \or \advance\temp@@dim by \temp@@@dim + \temp@@dim=-\temp@@dim \divide\temp@dim by 2 + \or \temp@dim=0pt \advance\temp@@dim by \temp@@@dim + \temp@@dim=-\temp@@dim \divide\temp@@dim by 2 + \or \temp@dim=0pt \advance\temp@@@dim by \temp@@dim \temp@@dim=-\temp@@dim + \or \divide\temp@dim by 2 + \advance\temp@@@dim by \temp@@dim \temp@@dim=-\temp@@dim + \or \advance\temp@@@dim by \temp@@dim \temp@@dim=-\temp@@dim + \or \errmessage{Invalid range of first parameter: #1}\fi + \advance\temp@dim by #2 \advance \temp@@dim by #3 + \temp@@@dim=\wd\temp@box \divide \temp@@@dim by 10 + \multiply\temp@@@dim by #4 \advance\temp@dim by \temp@@@dim + \temp@@@dim=\ht\temp@box \advance\temp@@@dim by \dp\temp@box + \divide \temp@@@dim by 10 \multiply\temp@@@dim by #5 + \advance\temp@@dim by \temp@@@dim + \setbox\temp@box=\hbox{\xylower{\temp@dim}{\temp@@dim}{\box\temp@box}}% + \ifnum#1>0 \else \wd\temp@box=0pt \ht\temp@box=0pt \dp\temp@box=0pt \fi + \box\temp@box\endgroup +}% +% +\ifx\setdefault\undefined\else\setdefault{placebox}{6}{0}{0pt}{0pt}{0}{0}{h}\fi +% example ends +% +\let\wlog\temp@@@macro\let\temp@@@macro\undefined@ +\catcode`\@=\EntryDefault\relax +\endinput +% +%ENDMACROS +% diff --git a/Master/texmf-dist/tex/generic/genmisc/dow.tex b/Master/texmf-dist/tex/generic/genmisc/dow.tex new file mode 100644 index 00000000000..ea504ba375b --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/dow.tex @@ -0,0 +1,44 @@ +%%%------------Start Cutting------------------------------------------ +% \dowcomp returns integer day of week in \dow with Sunday=0. +% \downame returns the name of the day of the week. +% E.g., if \year=1963 \month=11 \day=22, +% then \dowcomp ==> \dow=5 and \downame ==> Friday which happened +% to be the day President John F. Kennedy was assasinated. + +% Converted from the lisp function DOW by Jon L. White given in +% the file LIBDOC DOW JONL3 on MIT-MC (which follows). + +%(defun dow (year month day) +% (and (and (fixp year) (fixp month) (fixp day)) +% ((lambda (a) +% (declare (fixnum a)) +% (\ (+ (// (1- (* 13. (+ month 10. +% (* (// (+ month 10.) -13.) 12.)))) +% 5.) +% day +% 77. +% (// (* 5. (- a (* (// a 100.) 100.))) 4.) +% (// a -2000.) +% (// a 400.) +% (* (// a -100.) 2.)) +% 7.)) +% (+ year (// (+ month -14.) 12.))))) + +\newcount\dow +\def\dowcomp{{\count3 \month \advance\count3 -14 \divide\count3 12 + \advance\count3 \year \count4 \month \advance\count4 10 + \divide\count4 -13 \multiply\count4 12 \advance\count4 10 + \advance\count4 \month \multiply\count4 13 \advance\count4 -1 + \divide\count4 5 \advance\count4 \day \advance\count4 77 + \count2 \count3 \divide\count2 100 \multiply\count2 -100 + \advance\count2 \count3 \multiply\count2 5 \divide\count2 4 + \advance\count4 \count2 \count2 \count3 \divide\count2 -2000 + \advance\count4 \count2 \count2 \count3 \divide\count2 400 + \advance\count4 \count2 \count2 \count3 \divide\count2 -100 + \multiply\count2 2 \advance\count4 \count2 \count2 \count4 + \divide\count2 7 \multiply\count2 -7 \advance\count4 \count2 + \global\dow \count4}} + +\def\dayname{\dowcomp \ifcase\dow Sunday\or Monday\or Tuesday\or + Wednesday\or Thursday\or Friday\else Saturday\fi} +%%%--------------Stop cutting----------------------------------------- diff --git a/Master/texmf-dist/tex/generic/genmisc/emtrees.tex b/Master/texmf-dist/tex/generic/genmisc/emtrees.tex new file mode 100644 index 00000000000..3c9c5e1a3fb --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/emtrees.tex @@ -0,0 +1,87 @@ +%From: hwb@texnix.stgt.sub.org (Harald Boegeholz) +%Newsgroups: comp.text.tex +%Date: 14 Jan 91 13:44:29 GMT +% +%Hi! +% +%Some time ago I wrote some TeX-macros to typeset trees. Since +%two people asked recently, here they are (quite short, so I thought +%I might post). Be aware, though, of two possible problems: +% 1. The macros use the \specials defined by emTeX. If your DVI-driver +% doesn't support these, you won't see any lines. +% 2. The semantic nest size required is considerable (too many boxes +% inside of boxes inside of boxes...), so you'll possibly need +% a TeX which is "large" in this respect for typesetting complex trees. +% +%Hope this helps +%Harald +%------------------ cut here with a sharp knife ------------------------ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tree macros by Harald Boegeholz +% This file uses the \specials defined by emTeX to draw the lines! +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcount\pointnumber \pointnumber=0 +\newcount\father +\font\nodefont=cmr7 +\def\nextpoint{\global\advance\pointnumber by 1\relax} +\def\endsubtrees{\endsubtrees} +\def\tn#1{\vbox{% + \vskip.5mm + \hbox{\nodefont\hskip1ex\relax #1\hskip1ex} + \vskip.5mm + }% +} +\def\tree#1#2{% + \vtop{% + \nextpoint + \father=\pointnumber + \halign{\hfil##\hfil\cr + #1\cr + \special{em:point \number\father}\cr + \noalign{\vskip5mm} + \hbox{\subtrees#2\endsubtrees}\cr + }% + }% +}% +\def\subtrees#1{\ifx#1\endsubtrees\let\next\relax\else + \vbox{\halign{\hfil##\hfil\cr + \nextpoint + \special{em:point \number\pointnumber}% + \special{em:line \number\pointnumber h,\number\father h}\cr + #1\cr + }}% + \let\next\subtrees\fi + \next +} +\def\labeledtree#1#2{\vbox{\offinterlineskip\halign{\hfil##\hfil\cr + #1\cr + \noalign{\vskip3pt}% + $\scriptstyle#2$\cr +}}} + +\parindent0pt +\raggedbottom + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% macros end here ... sample follows: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput + +{\labeledtree{% + {\tree{\tn{1}}{% + {\tree{\tn{2}}{% + {\tn{3}}% + {\tn{4}}% + }}% + {\tree{\tn{5}}{% + {\tn{6}}% + }}% + }}% +}{[1,2,2,1,5]}}% + +\bye +------------------ cut here with a sharp knife ------------------------ +-- +Harald Boegeholz |Home: hwb@texnix.stgt.sub.org (read daily) + |University: boegehol@az3.informatik.uni-stuttgart.de + | ^ please use the latter for large (>100k) mails diff --git a/Master/texmf-dist/tex/generic/genmisc/endnote.tex b/Master/texmf-dist/tex/generic/genmisc/endnote.tex new file mode 100644 index 00000000000..6ca4cd8df93 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/endnote.tex @@ -0,0 +1,36 @@ +% Use \endnote{1}{text}. At the end of your document, type +% \producenotes to actually flush all end notes to be printed. +% +% macros for making endnotes instead of footnotes +% We make @ signs act like letters, temporarily, to avoid conflict +% between user names and internal control sequences of plain format. +\catcode`@=11 +\newbox\endnotebox +\def\setendnotefont#1{\gdef\endnotefont{#1}} +\setendnotefont{\rm} +\def\endnote#1{\let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi + #1\@sf\vendnote{{#1}}} +\def\vendnote#1{\global\setbox\endnotebox= + \vbox{\parindent=0pt\endnotefont\unvbox\endnotebox\bgroup + \indent\llap#1\ignorespaces\futurelet\next\aftergroup\no@te\relax}} +\def\no@te{\ifcat\bgroup\noexpand\next \let\next\n@@te + \else\let\next\n@t\fi \next} +\def\n@@te{\bgroup\aftergroup\@endnote\let\next} +\def\n@t#1{#1\@endnote} +\def\@endnote{\strut\egroup} +% +\newcount\enotecounter +\def\resetenotecount{\global\enotecounter=0 } \resetenotecount +\def\setenotecount#1{\global\enotecounter=#1 } +% +\def\setendnoteflagfont#1{\gdef\endnoteflagfont{#1}} +\setendnoteflagfont{\sevenrm} +\def\enote{\unskip + \global\advance \enotecounter by 1 % First bump the counter. + % Now convert the current value of the counter into a superscripted numeral + \endnote{{$^{\hbox{\endnoteflagfont\the\enotecounter}}$}}} +% +\def\producenotes{% +\ifvoid\endnotebox\else\medskip\unvbox\endnotebox\par\fi} +\catcode`@=12 % at signs are no longer letters diff --git a/Master/texmf-dist/tex/generic/genmisc/epigram.tex b/Master/texmf-dist/tex/generic/genmisc/epigram.tex new file mode 100644 index 00000000000..e797ceba8ab --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/epigram.tex @@ -0,0 +1,20 @@ +% From TeXMaG Volume 2, Number 6 +% Don Hosek <DHOSEK@HMCVAX.BITNET> +% +\long\def\epigram#1{% We use \long\def to allow the argument + % to span several paragraphs. + \bigskip % extra space above. + \setbox0=\hbox{#1} % put the text into a box + \ifdim\wd0>\critwidth %check the length + \centerline{\vtop{\hsize=\episize\noindent#1}} + % If the length is greater than + % the critical length, make a + % displayed paragraph + \else % otherwise, we just center the text. + \centerline{\box0} + \fi + \smallskip % extra space for the end. +} + +\newdimen\critwidth \critwidth=.75\hsize +\newdimen\episize \episize=.6\hsize diff --git a/Master/texmf-dist/tex/generic/genmisc/fakebold.tex b/Master/texmf-dist/tex/generic/genmisc/fakebold.tex new file mode 100644 index 00000000000..5699b405de0 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/fakebold.tex @@ -0,0 +1,5 @@ +\def\fakebold#1{\leavevmode\setbox0=\hbox{#1}% + \kern-.025em\copy0 \kern-\wd0 + \kern .05em\copy0 \kern-\wd0 + \kern-.025em\raise.0433em\box0 +} diff --git a/Master/texmf-dist/tex/generic/genmisc/hep.tex b/Master/texmf-dist/tex/generic/genmisc/hep.tex new file mode 100644 index 00000000000..5a740da239b --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/hep.tex @@ -0,0 +1,12 @@ +\def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox to\wd0{\hss\sl/\/\hss}} +\def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance + \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox + to\wd0{\hss\sl/\/\hss}} +% Four macros for Dirac's bracket notation of expectation values +\def\bra#1{\left< #1\right|} +\def\ket#1{\left| #1\right>} +\def\bracket#1#2{\left<#1\mid #2\right>} +\def\EV#1#2#3{\bra{#1}#2\ket{#3}} +% And finally a macro for printing so-called `normal ordered' products +% They are denoted by a colon on either side +\normalord#1{\mathopen{:}#1\mathclose{:}} diff --git a/Master/texmf-dist/tex/generic/genmisc/hexdump.sty b/Master/texmf-dist/tex/generic/genmisc/hexdump.sty new file mode 100644 index 00000000000..7246ef87f91 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/hexdump.sty @@ -0,0 +1,117 @@ +%%% File Hexdump.sty +%%% Reads an ASCII hexdump file and puts it formated into +%%% the document +%%% +%%% Author : Thomas Hillebrand (thillebrand@my-deja.com) +%%% Date : 04/17/2000 +%%% Version: 0.1 +%%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{hexdump}[2000/21/06 v0.1 format hexdumps] +% +% Test weather the package 'moreverb.sty' is loaded +% +\RequirePackage{moreverb} +% +% +% Dump title, defaults to 'Dump' +% The command \dumpname{} sets the title of the dump +% +\newcommand{\dump@head}{Dump} % Default title is 'Dump' +\newcommand{\dumpname}[1]{\renewcommand{\dump@head}{#1}} +% +% Set the fontsize, default is \scriptsize, +% use \dumpfontsize{<size>} to change it +% +\newcommand{\dump@font@size}{\scriptsize} +\newcommand{\dumpfontsize}[1]{\renewcommand{\dump@font@size}{#1}} +% +% Calculate the width +% +\newlength{\dumpwidth} % Variable for textwidth +\settowidth{\dumpwidth}% + {\dump@font@size\texttt{00000000\space\space{}FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFFFFFFFFFFFFFF}} +% The double \space puts two spaces between address and values +% +% Define new counter, arabic numbers +% reset counter, if chapter changes +% +\newcounter{dumpcount}[chapter] +\renewcommand{\thedumpcount}{\thechapter.\arabic{dumpcount}\space} +% +% Now to the page 'list of dumps' +% Set titleword with \dumptocname, this is used for the lod page. +% +\newcommand{\dump@word}{directory} +\newcommand{\dumptocname}[1]{\renewcommand{\dump@word}{#1}} +% +% Define own list of dumps, use \listofdumps +% First let's define the top line of the list of dumps +% then define an entry in the lod file +\newcommand{\listofdumps}{\chapter*{\dump@head\dump@word}\@starttoc{lod}} +\newcommand{\dcaption}[1]{\addcontentsline{lod}{table}% + {\protect\numberline{\thedumpcount}#1}#1} +% +% Now to the main thing: the dump itself. +% Define \inputdump{<file>}{<caption>} +% command to read hex-dump file and put it formatted into document +% Parameter #1 : Floatposition - this is optional +% Parameter #2 : Filename +% Parameter #3 : Caption +% +% A label is also defined: use \ref{dumpname:filename} (see example). +% +\newcommand{\inputdump}[3][htbp]{% + \begin{table}[#1] + \begin{center} + \begin{minipage}{\dumpwidth} + \refstepcounter{dumpcount} + \rule[0.1\baselineskip]{\dumpwidth}{.8pt} + \dump@head \space \thedumpcount{}:\space\dcaption{#3} + \label{\dump@head:#2} % Label contains title and filename + \newline + \rule[0.33\baselineskip]{\dumpwidth}{.8pt} + \ttfamily\dump@font@size + \verbatimtabinput{#2} + \rule[0.75\baselineskip]{\dumpwidth}{.8pt} + \end{minipage} + \end{center} + + \end{table} +} % end newcommand +% +% End of file hexdump.sty +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Here's a sample tex file +% +%\documentclass{book} +%\usepackage{hexdump} +% +%\dumpsize{\tiny} % will give _very_ small dumps, better use default setting +%\dumptocname{directoy} +%\dumpname{Dump} +% +%\begin{document} +%\listofdumps % the title will be 'Dumpdirectory', see above +% +%\capter{Bar} +% +%\inputdump{test.hex} % assumed that file test.hex contains the dump +% +%The dump is shown in dump \ref{Dump:test.hex}. +%\end{document} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Now to the legal stuff: +% +% Copyright (c) Thomas Hillebrand 2000 +% +% Usage of this file is unlimited, but I guarantee for nothing - except +% that it uses space on your harddisk. As usual, use this file at your +% own risk. +% +% You are encouraged to modify this file, but please be so kind to e-mail +% me your modifications. Maybe they are included in the next release... +% diff --git a/Master/texmf-dist/tex/generic/genmisc/inscrutable.tex b/Master/texmf-dist/tex/generic/genmisc/inscrutable.tex new file mode 100644 index 00000000000..1d45298cc6a --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/inscrutable.tex @@ -0,0 +1,11 @@ +% Date: Thu, 7 Feb 91 12:20:50 -0500 +%From: amgreene@ATHENA.MIT.EDU +%Subject: A response to perl hackers +\let~\catcode~`?`\ +\let?\the~`#?~`~~`]?~`~\let]\let~`\.?~`~~`,?~`~~`\%?~`~~`=?~`~]=\def +],\expandafter~`[?~`~][{=%{\message[}~`\$?~`~=${\uccode`'.\uppercase +{,=,%,{%'}}}~`*?~`~=*{\advance.by}]#\number~`/?~`~=/{*-1}\newcount. +=\-{*-}~`-?~`~]-\-~`^?~`~=^{*1}~`\ ?~`~= {.`\ $}~`@?~`~=@{,.,"#`@^$} +.`#*`'$.?~`~0-?~`~$//$^$ .``^$*?~`~$^$.?~`~0-?~`~/$-?~`~^$@*?~`~$ * +?~`~*?~`~*?~`~*?~`~$@-?~`~$ .?~`~0-?~`~-?~`~$.``^$^^$.`<-?~`~*`<$@* +?~`~$*?~`~-`(-`+$%}\batchmode diff --git a/Master/texmf-dist/tex/generic/genmisc/ipamacs.tex b/Master/texmf-dist/tex/generic/genmisc/ipamacs.tex new file mode 100644 index 00000000000..843c42b124d --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/ipamacs.tex @@ -0,0 +1,235 @@ +%% The following macro is necessary to place an accent over the +%% character definitions below. For example, you should say: +%% \diatop[\^|\openo] +%% + +\def\diatop[#1|#2]{{\setbox1=\hbox{{#1{}}}\setbox2=\hbox{{#2{}}}% + \dimen0=\ifdim\wd1>\wd2\wd1\else\wd2\fi% + \dimen1=\ht2\advance\dimen1by-1ex% + \setbox1=\hbox to1\dimen0{\hss#1\hss}% + \rlap{\raise1\dimen1\box1}% + \hbox to1\dimen0{\hss#2\hss}}}% + +%% As an alternative, you could uncomment the following two lines: +%% +%% \catcode`"=\active +%% \def"#1#2{\diatop[#1|#2]} +%% +%% And then you could place an accent over the ipa character by +%% calling the macro " which itself calls \diatop. For example, you +%% would say: +%% +%% "\^\openo + +%% THE FOLLOWING macros access the IPA chars from the WSU IPA font + +\font\ipatwelverm=wsuipa12 +\def\ipa{\ipatwelverm} + +%% A-type shapes: +\def\inva{\edef\next{\the\font}\ipa\char'000\next}% +\def\scripta{\edef\next{\the\font}\ipa\char'001\next}% +\def\nialpha{\edef\next{\the\font}\ipa\char'002\next}% +\def\invscripta{\edef\next{\the\font}\ipa\char'003\next}% +\def\invv{\edef\next{\the\font}\ipa\char'004\next}% + +%% B-type shapes: +\def\crossb{\edef\next{\the\font}\ipa\char'005\next}% +\def\barb{\edef\next{\the\font}\ipa\char'006\next}% +\def\slashb{\edef\next{\the\font}\ipa\char'007\next}% +\def\hookb{\edef\next{\the\font}\ipa\char'010\next}% +\def\nibeta{\edef\next{\the\font}\ipa\char'011\next}% + +%% C-type shapes: +\def\slashc{\edef\next{\the\font}\ipa\char'012\next}% +\def\curlyc{\edef\next{\the\font}\ipa\char'013\next}% +\def\clickc{\edef\next{\the\font}\ipa\char'014\next}% + +%% D-type shapes: +\def\crossd{\edef\next{\the\font}\ipa\char'015\next}% +\def\bard{\edef\next{\the\font}\ipa\char'016\next}% +\def\slashd{\edef\next{\the\font}\ipa\char'017\next}% +\def\hookd{\edef\next{\the\font}\ipa\char'020\next}% +\def\taild{\edef\next{\the\font}\ipa\char'021\next}% +\def\dz{\edef\next{\the\font}\ipa\char'022\next}% +\def\eth{\edef\next{\the\font}\ipa\char'023\next}% +\def\scd{\edef\next{\the\font}\ipa\char'024\next}% + +%% E-type shapes: +\def\schwa{\edef\next{\the\font}\ipa\char'025\next}% +\def\er{\edef\next{\the\font}\ipa\char'026\next}% +\def\reve{\edef\next{\the\font}\ipa\char'027\next}% +\def\niepsilon{\edef\next{\the\font}\ipa\char'030\next}% +\def\revepsilon{\edef\next{\the\font}\ipa\char'031\next}% +\def\hookrevepsilon{\edef\next{\the\font}\ipa\char'032\next}% +\def\closedrevepsilon{\edef\next{\the\font}\ipa\char'033\next}% + +%% G-type shapes: +\def\scriptg{\edef\next{\the\font}\ipa\char'034\next}% +\def\hookg{\edef\next{\the\font}\ipa\char'035\next}% +\def\scg{\edef\next{\the\font}\ipa\char'036\next}% +\def\nigamma{\edef\next{\the\font}\ipa\char'037\next} +\def\ipagamma{\edef\next{\the\font}\ipa\char'040\next}% +\def\babygamma{\edef\next{\the\font}\ipa\char'041\next}% + +%% H-type shapes: +\def\hv{\edef\next{\the\font}\ipa\char'042\next}% +\def\crossh{\edef\next{\the\font}\ipa\char'043\next}% +\def\hookh{\edef\next{\the\font}\ipa\char'044\next}% +\def\hookheng{\edef\next{\the\font}\ipa\char'045\next}% +\def\invh{\edef\next{\the\font}\ipa\char'046\next}% + +%% I-type shapes: +\def\bari{\edef\next{\the\font}\ipa\char'047\next}% +\def\dlbari{\edef\next{\the\font}\ipa\char'050\next}% ``dotless bar i'' +\def\niiota{\edef\next{\the\font}\ipa\char'051\next}% +\def\sci{\edef\next{\the\font}\ipa\char'052\next}% +\def\barsci{\edef\next{\the\font}\ipa\char'053\next}% ``barred small cap i'' + +%% J-type shape: +\def\invf{\edef\next{\the\font}\ipa\char'054\next}% + +%% L-type shapes: +\def\tildel{\edef\next{\the\font}\ipa\char'055\next}% +\def\barl{\edef\next{\the\font}\ipa\char'056\next}% +\def\latfric{\edef\next{\the\font}\ipa\char'057\next}% +\def\taill{\edef\next{\the\font}\ipa\char'060\next}% +\def\lz{\edef\next{\the\font}\ipa\char'061\next}% +\def\nilambda{\edef\next{\the\font}\ipa\char'062\next}% +\def\crossnilambda{\edef\next{\the\font}\ipa\char'063\next}% + +%% M-type shapes: +\def\labdentalnas{\edef\next{\the\font}\ipa\char'064\next}% +\def\invm{\edef\next{\the\font}\ipa\char'065\next}% +\def\legm{\edef\next{\the\font}\ipa\char'066\next}% + +%% N-type shapes: +\def\nj{\edef\next{\the\font}\ipa\char'067\next}% +\def\eng{\edef\next{\the\font}\ipa\char'070\next}% +\def\tailn{\edef\next{\the\font}\ipa\char'071\next}% +\def\scn{\edef\next{\the\font}\ipa\char'072\next}% + +%% O-type shapes: +\def\clickb{\edef\next{\the\font}\ipa\char'073\next}% +\def\baro{\edef\next{\the\font}\ipa\char'074\next}% +\def\openo{\edef\next{\the\font}\ipa\char'075\next}% +\def\niomega{\edef\next{\the\font}\ipa\char'076\next}% +\def\closedniomega{\edef\next{\the\font}\ipa\char'077\next}% +\def\oo{\edef\next{\the\font}\ipa\char'100\next}% + +%% P-type shapes: +\def\barp{\edef\next{\the\font}\ipa\char'101\next}% +\def\thorn{\edef\next{\the\font}\ipa\char'102\next}% +\def\niphi{\edef\next{\the\font}\ipa\char'103\next}% + +%% R-type shapes: +\def\flapr{\edef\next{\the\font}\ipa\char'104\next}% +\def\legr{\edef\next{\the\font}\ipa\char'105\next}% +\def\tailr{\edef\next{\the\font}\ipa\char'106\next}% +\def\invr{\edef\next{\the\font}\ipa\char'107\next}% +\def\tailinvr{\edef\next{\the\font}\ipa\char'110\next}% +\def\invlegr{\edef\next{\the\font}\ipa\char'111\next}% +\def\scr{\edef\next{\the\font}\ipa\char'112\next}% +\def\invscr{\edef\next{\the\font}\ipa\char'113\next}% + +%% S-type shapes: +\def\tails{\edef\next{\the\font}\ipa\char'114\next}% +\def\esh{\edef\next{\the\font}\ipa\char'115\next}% +\def\curlyesh{\edef\next{\the\font}\ipa\char'116\next}% +\def\nisigma{\edef\next{\the\font}\ipa\char'117\next}% + +%% T-type shapes: +\def\tailt{\edef\next{\the\font}\ipa\char'120\next}% +\def\tesh{\edef\next{\the\font}\ipa\char'121\next}% +\def\clickt{\edef\next{\the\font}\ipa\char'122\next}% +\def\nitheta{\edef\next{\the\font}\ipa\char'123\next}% + +%% U-type shapes: +\def\baru{\edef\next{\the\font}\ipa\char'124\next}% +\def\slashu{\edef\next{\the\font}\ipa\char'125\next}% +\def\niupsilon{\edef\next{\the\font}\ipa\char'126\next}% +\def\scu{\edef\next{\the\font}\ipa\char'127\next}% +\def\barscu{\edef\next{\the\font}\ipa\char'130\next}% + +%% V-type shape: +\def\scriptv{\edef\next{\the\font}\ipa\char'131\next}% + +%% W-type shape: +\def\invw{\edef\next{\the\font}\ipa\char'132\next}% + +%% X-type shape: +\def\nichi{\edef\next{\the\font}\ipa\char'133\next}% + +%% Y-type shapes: +\def\invy{\edef\next{\the\font}\ipa\char'134\next}% +\def\scy{\edef\next{\the\font}\ipa\char'135\next}% + +%% Z-type shapes: +\def\curlyz{\edef\next{\the\font}\ipa\char'136\next}% +\def\tailz{\edef\next{\the\font}\ipa\char'137\next}% +\def\yogh{\edef\next{\the\font}\ipa\char'140\next}% +\def\curlyyogh{\edef\next{\the\font}\ipa\char'141\next}% + +%% ?-type shapes: +\def\glotstop{\edef\next{\the\font}\ipa\char'142\next}% +\def\revglotstop{\edef\next{\the\font}\ipa\char'143\next}% +\def\invglotstop{\edef\next{\the\font}\ipa\char'144\next}% +\def\ejective{\edef\next{\the\font}\ipa\char'145\next}% +\def\reveject{\edef\next{\the\font}\ipa\char'146\next}% + +%% AND that should be it, as far as actual characters go. +%% +%% THE following is the set of diacritics. Please try to get +%% the 4 t-bars lined up above the 4 pointers, so you may +%% have to reshuffle things a bit. Not to worry too much. I +%% think the diacritics can be grouped more according to +%% shape, so comma-like things are together, etc. +%% + +\def\dental#1{\oalign{#1\crcr + \hidewidth{\ipa\char'147}\hidewidth}} + +\def\upt{\edef\next{\the\font}\ipa\char'154\next}% These are IPA pointers +\def\downt{\edef\next{\the\font}\ipa\char'155\next}% +\def\leftt{\edef\next{\the\font}\ipa\char'156\next}% +\def\rightt{\edef\next{\the\font}\ipa\char'157\next}% + + % These are American versions of t-bars +\def\upp{\edef\next{\the\font}\ipa\char'164\next} +\def\downp{\edef\next{\the\font}\ipa\char'165\next}% +\def\leftp{\edef\next{\the\font}\ipa\char'166\next}% +\def\rightp{\edef\next{\the\font}\ipa\char'167\next}% + +\def\stress{\edef\next{\the\font}\ipa\char'150\next}% primary stress +\def\secstress{\edef\next{\the\font}\ipa\char'151\next}% secondary stress + +\def\syllabic{\edef\next{\the\font}\ipa\char'152\next}% syllabic marker + +\def\corner{\edef\next{\the\font}\ipa\char'153\next}% + + % American equivalent: raised dot +\def\halflength{\edef\next{\the\font}\ipa\char'160\next} + % American equivalent: colon +\def\length{\edef\next{\the\font}\ipa\char'161\next} + +\def\underdots{\edef\next{\the\font}\ipa\char'162\next}% + + % ``reversed apostrophe'', p. 216 +\def\ain{\edef\next{\the\font}\ipa\char'163\next} + +\def\overring{\edef\next{\the\font}\ipa\char'170\next}% +\def\underring{\edef\next{\the\font}\ipa\char'171\next}% + +\def\open{\edef\next{\the\font}\ipa\char'172\next}% + +\def\midtilde{\edef\next{\the\font}\ipa\char'173\next}% +\def\undertilde{\edef\next{\the\font}\ipa\char'174\next}% + +\def\underwedge{\edef\next{\the\font}\ipa\char'175\next}% + +\def\polishhook{\edef\next{\the\font}\ipa\char'176\next}% + +\def\underarch#1{\oalign{#1\crcr + \hidewidth{\ipa\char'177}\hidewidth}} + +%% AND that's it for the diacritics. diff --git a/Master/texmf-dist/tex/generic/genmisc/laps.tex b/Master/texmf-dist/tex/generic/genmisc/laps.tex new file mode 100644 index 00000000000..b8b2d54b646 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/laps.tex @@ -0,0 +1,14 @@ +%%% File: Laps.TeX +\catcode`\@=11 % Let's pretend @ is a letter +% Vertical `laps'; cf. \llap and \rlap +\long\def\ulap#1{\vbox to \z@{\vss#1}} +\long\def\dlap#1{\vbox to \z@{#1\vss}} + +% And centered horizontal and vertical `laps' +\def\xlap#1{\hbox to \z@{\hss#1\hss}} +\long\def\ylap#1{\vbox to \z@{\vss#1\vss}} + +% And a `lap' centered on its midpoint +\long\def\zlap#1{\ylap{\xlap{#1}}} + +\catcode`\@=12 % That's enough pretending for one day. diff --git a/Master/texmf-dist/tex/generic/genmisc/letterspacing.tex b/Master/texmf-dist/tex/generic/genmisc/letterspacing.tex new file mode 100644 index 00000000000..488c46196b0 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/letterspacing.tex @@ -0,0 +1,319 @@ +% Self-documenting file + +\ifx \Comment \Undefined + \long \def \Comment #1\EndComment {} +\else + \ifx \EndComment \Undefined + \def \EndComment + {\message {Error: \noexpand \EndComment encountered + without preceding \noexpand \Comment}} + \else %%% both defined; let's hope they're the right definitions! + \fi +\fi + +\Comment +This file, "letterspacing.tex", created by Philip Taylor of +Royal Holloway, University of London (P.Taylor@Rhul.Ac.Uk) for +Kaveh Bazargan of Focal Image (Kaveh@Focal.Demon.Co.Uk) may be +freely distributed provided that the following licence conditions +are honoured : +\EndComment + +\Comment % The Licence + Unlimited copying and redistribution of this file + is permitted so long as the file is not modified + in any way. + + Modifications may be made for private purposes (though + this is discouraged, as it could result in documents + typesetting differently on different systems) but if + such modifications are re-distributed, the modified + file must not be capable of being confused with the + original. In particular, this means + +(a) the filename (the portion before the extension, if any) + must not match any of : + + LETTERSPACE LETTER-SPACE + LETTERSPACING LETTER-SPACING + + regardless of case, and + +(b) the file must contain conditions identical to these, + except that the modifier/distributor may, if he or she + wishes, augment the list of proscribed filenames. +\EndComment + +\Comment +As far as is possible, `inaccessible' control sequences (i.e.~control sequences +containing one or more commercial-at$\,$s) are used to minimise the risk of +accidental collision with user-defined macros; however, the control sequences +used to access the natural dimensions of the text are required to be user +accessible, and therefore must contain only letters. +\EndComment + +%%% Open control sequences + +\newdimen \naturalwidth +\newdimen \naturaldepth +\newdimen \naturalheight + +\Comment +All control sequences defined hereafter are inaccessible to the casual user, +including the control sequence used to store the category code of commercial-at; +this catcode must be saved in order to be able to re-instate it at end of +module, as we have no idea in what context the module will be |\input|. Having +saved the catcode of commercial-at, we then change it to |11| (i.e.~that of a +letter) in order to allow it to be used in the cs-names which follow. +\EndComment + +%%% Concealed control sequences + +\expandafter \chardef + \csname \string @code\endcsname = + \the \catcode `\@ +\catcode `\@ = 11 + +\Comment +We will need a a box register in order to measure the natural dimensions of +the text, and a token-list register in which to save the tokens to be +letter-spaced. +\EndComment + +\newbox \l@tterspacebox +\newtoks \l@tterspacetoks + +\Comment +We will need to test whether a particular macro expands to a space, so we will +need another macro which does so expand with which to compare it; we will +also need a `more infinite' variant of |\hss|. +\EndComment + +\def \sp@ce { } +\def \hsss + {\hskip 0 pt plus 1 fill minus 1 fill\relax} + +\Comment +Many of the macros will used delimited parameter structures, typically +terminated by the reserved control sequence |\@nd|; we make this a synonym +for the empty macro (which expands to nothing), so that should it accidentally +get expanded there will be no side effects. We also define a brief synonym +for |\expandafter|, just to keep the individual lines of code reasonably short. +\EndComment + +\let \@nd = \empty +\let \@x = \expandafter + +\Comment +We will also need to compare a token which has been peeked at by |\futurelet| +with a space token; because of the difficulty of accessing such a space +token (which would usually be absorbed by a preceding control word), we +establish |\sp@cetoken| as a synonym. The code to achieve this is messy, +because of the very difficulty just outlined, and so we `waste' a control +sequence |\t@mp|; we then return this to the pool of undefined tokens. +\EndComment + +\let \sp@cetoken = \relax +\edef \t@mp {\let \sp@cetoken = \sp@ce} +\t@mp \let \t@mp = \undefined + +\Comment +The user-level macro |\letterspace| has exactly the same syntax as that for +|\hbox| and |\vbox|, as explained in the introduction; the delimited parameter +structure for this macro ensures that everything up to the open brace which +delimits the beginning of the text to be letter-spaced is absorbed as parameter +to the macro, and the brace-delimited text which follows is then assigned to the +token-list register |\l@tterspacetoks|; |\afterassignment| is used to regain +control once the assignment is complete. +\EndComment + +%%% Primary (user-level) macro + +\def \letterspace #1#% + {\def \hb@xmodifier {#1}% + \afterassignment \l@tterspace + \l@tterspacetoks = + } + +\Comment +Control then passes to |\l@tterspace|, which starts by setting an |\hbox| +containing the text to be typeset; the dimensions of this box (and therefore +of the text) are then saved in the open control sequences previously declared, +and the |\hbox| becomes of no further interest. + +A new |\hbox| is now created, in which the same text, but this time +letter-spaced, will be set; the box starts and ends with |\hss| glue so that if +only a single character is to be letter-spaced, it will be centered in the box. +If two or more characters are to be letter-spaced, they will be separated by +|\hsss| glue, previously declared, which by virtue of its greater degree of +infinity will completely override the |\hss| glue at the beginning and end; +thus the first and last characters will be set flush with the edges of the box. + +The actual mechanism by which letter-spacing takes place is not yet apparent, +but it will be seen that it is crucially dependent on the definition of +|\l@tt@rspace|, which is expanded as the box is being set; the |\@x| +(|\expandafter|) causes the actual tokens stored in |\l@tterspacetoks| to be +made available as parameter to |\l@tt@rspace| rather than the token-list +register itself, as it is these tokens on which |\l@tt@rspace| will operate. +The |\@nd| terminates the parameter list, and the |{}| which immediately +precedes it ensures that that there is always a null element at the end of the +list: without this, the braces which are needed to protect an accent/character +pair would be lost if such a pair formed the final element of the list, at the +point where they are passed as the second (delimited) parameter to |\p@rtiti@n|; +by definition, <TeX> removes the outermost pair of braces from both simple and +delimited parameters during parameter substitution if such braces form the first +and last tokens of the parameter, and thus if a brace-delimited group ever +becomes the second element of a two-element list, the braces will be irrevocably +lost. The |{}| ensure that such a situation can never occur. +\EndComment + +%%% Secondary (implementation-level) macro + +\def \l@tterspace + {\setbox \l@tterspacebox = \hbox + {\the \l@tterspacetoks}% + \naturalwidth = \wd \l@tterspacebox + \naturaldepth = \dp \l@tterspacebox + \naturalheight = \ht \l@tterspacebox + \hbox \hb@xmodifier + \bgroup + \hss + \@x \l@tt@rspace + \the \l@tterspacetoks {}\@nd + \hss + \egroup + } + +\Comment +The next macro is |\l@tt@rspace|, which forms the crux of the entire operation. +The text to be letter-spaced is passed as parameter to this macro, and the +first step is to check whether there is, in fact, any such text; this is +necessary both to cope with pathological usage (e.g.~|\letterspace {}|), and to +provide an exit route, as the macro uses tail-recursion to apply itself +iteratively to the `tail' of the text to be letter-spaced; when no elements +remain, the macro must exit. + +Once the presence of text has been ensured, the token-list representing +this text is partitioned into a head (the first element), and the tail +(the remainder); at each iteration, only the head is considered, although +if the tail is empty (i.e.~the end of the list has been reached), special +action is taken. + +If the first element is a space, it is treated specially by surrounding it +with two globs of |\hsss| glue, to provide extra stretchability when compared +to the single glob of |\hsss| glue which will separate consecutive non-space +tokens; otherwise, the element itself is yielded, followed by a single glob +of |\hsss| glue. This glue is suppressed if the element is the last of the +list, to ensure that the last token aligns with the edge of the box. + +When the first element has been dealt with, the macro uses tail +recursion to apply itself to the remaining elements (i.e.~to the tail); +|\@x| (|\expandafter|) is again used to ensure that the tail is expanded +into its component tokens before being passed as parameter. +\EndComment + +%%% Tertiary (implementation-level) macro + +\def \l@tt@rspace #1\@nd + {\ifx \@nd #1\@nd + \let \n@xt = \relax + \else + \p@rtition #1\@nd + \ifx \h@ad \sp@ce \hsss \h@ad \hsss + \else + \h@ad + \ifx \t@il \@nd \else \hsss \fi + \fi + \@x \def \@x \n@xt \@x + {\@x \l@tt@rspace \t@il \@nd}% + \fi + \n@xt + } + +\Comment +The operation of token-list partitioning is conceptually simple: one passes the +token list as parameter text to a macro defined to take two parameters, the +first simple and the second delimited; the first element of the list will be +split off as parameter-1, and the remaining material passed as parameter-2. +Unfortunately this na\"\i ve approach fails when the first element is a bare +space, as the semantics of <TeX> prevent such a space from ever being passed as +a simple parameter (it could be passed as a delimited parameter, but as one +does not know what token follows the space, defining an appropriate delimiter +structure would be tricky if not impossible). The technique used here relies +upon the adjunct macro |\m@kespacexplicit|, which replaces a leading bare space +by a space protected by braces; such spaces may legitimately be passed as simple +parameters. Once that operation has been completed, the re-constructed token +list is passed to |\p@rtiti@n|, which actually performs the partitioning as +above; again |\@x| (|\expandafter|) is used to expand |\b@dy| (the +re-constructed token list) into its component elements before being passed as +parameter text. +\EndComment + +%%% Adjunct macros -- list partitioning + +\def \p@rtition #1\@nd + {\m@kespacexplicit #1\@nd + \@x \p@rtiti@n \b@dy \@nd + } + +\def \p@rtiti@n #1#2\@nd + {\def \h@ad {#1}% + \def \t@il {#2}% + } + +\Comment +The operation of making a space explicit relies on prescience: the code needs +to know what token starts the token list before it knows how to proceed. +Prescience in <TeX> is usually accomplished by |\futurelet|, and this code +is no exception: |\futurelet| here causes |\h@ad| to be |\let| equal to +the leading token, and control is then ceded to |\m@kesp@cexplicit|. + +The latter compares |\h@ad| with |\sp@cetoken| (remember the convolutions we +had to go through to get |\sp@cetoken| correctly defined in the first place), +and if they match (i.e.~if the leading token is a space), then |\b@dy| +(the control sequence through which the results of this operation will +be returned) is defined to expand to a protected space (a space surrounded by +braces), followed by the remainder of the elements; if they do not match +(i.e.~if the leading token is \stress {not} a space), then |\b@dy| is simply +defined to be the original token list, unmodified. If the leading token +\stress {was} a space, it must be replaced by a protected space: this is +accomplished by |\pr@tectspace|. + +The |\pr@tectspace| macro uses a delimited parameter structure, as do most +of the other macros in this suite, but the structure used here is unique, +in that the initial delimiter is a space. Thus, when a token-list starting +with a space is passed as parameter text, that space is regarded as matching +the space in the delimiter structure and removed; the expansion of the macro +is therefore the tokens remaining once the leading space has been removed, +preceded by a protected space |{ }|. +\EndComment + +%%% Adjunct macros -- <space>... -> {<space>}... + +\def \m@kespacexplicit #1\@nd + {\futurelet \h@ad \m@kesp@cexplicit #1\@nd} + +\def \m@kesp@cexplicit #1\@nd + {\ifx \h@ad \sp@cetoken + \@x \def \@x \b@dy + \@x {\pr@tectspace #1\@nd}% + \else + \def \b@dy {#1}% + \fi + }% + +\@x \def \@x \pr@tectspace \sp@ce #1\@nd {{ }#1} + +\Comment +The final step is to re-instate the category code of commercial-at. +\EndComment + +%%% re-instate category code of commercial-at + +\catcode `\@ = \the \@code + +\Comment +Thus letter-spacing is accomplished. The author hopes both that the code will +be found useful and that the explanation which accompanies it will be found +informative and interesting. +\EndComment diff --git a/Master/texmf-dist/tex/generic/genmisc/longdiv.tex b/Master/texmf-dist/tex/generic/genmisc/longdiv.tex new file mode 100644 index 00000000000..4c9a1d4fd16 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/longdiv.tex @@ -0,0 +1,53 @@ +% longdiv.tex v.1 (1994) Donald Arseneau +% +% Work out and print integer long division problems. Use: +% \longdiv{numerator}{denominator} +% The numerator and denominator (divisor and dividend) must be integers, and +% the quotient is an integer too. \longdiv leaves a remainder. +% Use this in any type of TeX. + +\newcount\gpten % (global) power-of-ten -- tells which digit we are doing +\countdef\rtot2 % running total -- remainder so far +\countdef\LDscratch4 % scratch + +\def\longdiv#1#2{% + \vtop{\normalbaselines \offinterlineskip + \setbox\strutbox\hbox{\vrule height 2.1ex depth .5ex width0ex}% + \def\showdig{$\underline{\the\LDscratch\strut}$\cr\the\rtot\strut\cr + \noalign{\kern-.2ex}}% + \global\rtot=#1\relax + \count0=\rtot\divide\count0by#2\edef\quotient{\the\count0}%\show\quotient + % make list macro out of digits in quotient: + \def\temp##1{\ifx##1\temp\else \noexpand\dodig ##1\expandafter\temp\fi}% + \edef\routine{\expandafter\temp\quotient\temp}% + % process list to give power-of-ten: + \def\dodig##1{\global\multiply\gpten by10 }\global\gpten=1 \routine + % to display effect of one digit in quotient (zero ignored): + \def\dodig##1{\global\divide\gpten by10 + \LDscratch =\gpten + \multiply\LDscratch by##1% + \multiply\LDscratch by#2% + \global\advance\rtot-\LDscratch \relax + \ifnum\LDscratch>0 \showdig \fi % must hide \cr in a macro to skip it + }% + \tabskip=0pt + \halign{\hfil##\cr % \halign for entire division problem + $\quotient$\strut\cr + #2$\,\overline{\vphantom{\big)}% + \hbox{\smash{\raise3.5\fontdimen8\textfont3\hbox{$\big)$}}}% + \mkern2mu \the\rtot}$\cr\noalign{\kern-.2ex} + \routine \cr % do each digit in quotient +}}} + +\endinput % Demonstration below: + +\noindent Here are some long division problems + +\indent +\longdiv{12345}{13} \quad +\longdiv{123}{1234} \quad +\longdiv{31415926}{2} \quad +\longdiv{81}{3} \quad +\longdiv{1132}{99} \quad +\longdiv{86491}{94} +\bye diff --git a/Master/texmf-dist/tex/generic/genmisc/mandel.tex b/Master/texmf-dist/tex/generic/genmisc/mandel.tex new file mode 100644 index 00000000000..e008dc98f2b --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/mandel.tex @@ -0,0 +1,139 @@ +% TeX Mandelbrot Program +% +% My entry for the contest ``The most useless TeX program ever written''. +% Can anyone top that? (Don't mention MusicTeX in this context. That's not +% meant to be a joke.) +% Also welcome: Improvements of this saving on TeX's resources. This takes +% more than five minutes on my NeXT 486/66.
+%
+% Seb, 6.7.94
+% +% (seb@balu.afp.ruhr-uni-bochum.de) +% +%
+% parameters that you can modify:
+%
+% \x, \y, \xmax, \ymax in units of 10000
+\newcount\x
+\x=-20000 % means -2.000 for real part of start value
+\newcount\y
+\y=-20000 % imaginary part
+\newcount\xmax
+\xmax=20000 % end value, real
+\newcount\ymax
+\ymax=20000 % end value, imaginary
+%
+% calculation depth
+\newcount\mandeldepth
+\mandeldepth=100
+%
+%
+% recursation depth = number of pixels.
+\newcount\xsize % (Don't go wild, tail recursion
+\xsize=100 % uses loads of TeX memory!)
+\newcount\ysize
+\ysize=100
+%
+% picture size
+\newdimen\height
+\newdimen\width
+\height=10cm
+\width=10cm
+%
+% that was all the parameters!
+%
+%
+% pixel size:
+\newdimen\xgrid
+\xgrid=\height
+\divide\xgrid by\xsize
+\newdimen\ygrid
+\ygrid=\width
+\divide\ygrid by\ysize
+%
+\nopagenumbers
+%
+\newcount\stepX % work out step sizes
+\stepX=\xmax
+\advance\stepX by -\x
+\divide\stepX by\xsize
+\newcount\stepY
+\stepY=\ymax
+\advance\stepY by -\y
+\divide\stepY by\ysize
+%
+\def\cout#1{\immediate\write16{#1}} % type out debug message
+%
+\def\yes{Y} % some stupid logical macros
+\def\no{N}
+\def\notyet{x}
+%
+\newcount\u % variables for calculation
+\newcount\v
+\newcount\newV
+\newcount\newU
+\newcount\d
+\newcount\h
+\def\runmandel{% % recursive Mandelbrot macro
+ \newU=\u%
+ \multiply\newU by \u% % newU := u^2
+ \h=\v%
+ \multiply\h by \v% % h := v^2
+ \advance\newU by -\h% % newU := u^2 - v^2
+ \h=\x%
+ \multiply\h by 10000% % h := x * 10000 (normalize)
+ \advance\newU by \h% % newU := newU + h
+ \divide\newU by 10000% % renormalize u
+ \newV=\u%
+ \multiply\newV by \v%
+ \multiply\newV by 2% % newV := 2 *u * v
+ \h=\y%
+ \multiply\h by 10000% % h := y * 10000
+ \advance\newV by \h% % newV := newV + h
+ \divide\newV by 10000% % renormalize v
+ \u=\newU% % newU = u^2 - v^2 + x
+ \v=\newV% % newV = 2 * u * v + y
+ \advance\d by 1%
+ % \cout{d: \the\d, u: \the\u, v: \the\v}%
+ \ifnum\d>\mandeldepth% % member ofthe Mandelbrot set
+ \def\result{\yes}%
+ \fi%
+ \ifnum\u<-20000%
+ \def\result{\no}% % real part exceeded -2
+ \fi%
+ \ifnum\u>20000%
+ \def\result{\no}% % real part exceeded 2
+ \fi%
+ \ifnum\v<-20000%
+ \def\result{\no}% % imaginary part exceeded -2
+ \fi%
+ \ifnum\v>20000%
+ \def\result{\no}% % real part exceeded 2
+ \fi%
+ \if\notyet\result\runmandel\fi% % play it again...
+}%
+\def\result{\yes}%
+\def\makeline{\advance\x by \stepX%
+ %\cout{testing \the\x = i * \the\y}%
+ \u=0%
+ \v=0%
+ \d=0%
+ \def\result{\notyet}%
+ \runmandel% result expands to either yes or no now
+ \if\result\yes%
+ \vrule height \xgrid depth 0pt width \ygrid%
+ \else%
+ \vrule height \xgrid depth 0pt width 0pt\hskip\xgrid%
+ \fi%
+ \ifnum\x<\xmax%
+ \makeline%
+ \else\fi}%
+\def\makepicture{\advance\y by \stepY%
+ \hbox{\makeline}%
+ %\cout{y in makepicture: \the\y}%
+ \ifnum\y<\ymax%
+ \makepicture%
+ \else\fi}%
+\vbox{\offinterlineskip\makepicture} % now, let's go tail
+\bye % recursive!
+
diff --git a/Master/texmf-dist/tex/generic/genmisc/mathdots.sty b/Master/texmf-dist/tex/generic/genmisc/mathdots.sty new file mode 100644 index 00000000000..4a31d5b9c28 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/mathdots.sty @@ -0,0 +1,209 @@ +%% mathdots.sty +%% Copyright 2001--2004 by Daniel H. Luecking +%% This file may be distributed and/or modified under the conditions +%% of the LaTeX Project Public License, either version 1.2 of this +%% license or (at your option) any later version. The latest version +%% of this license is in http://www.latex-project.org/lppl.txt and +%% version 1.2 or later is part of all distributions of LaTeX version +%% 1999/12/01 or later. +%% +%% This style file provides vertical dots and diagonal dots slanting +%% in either direction. Unlike the commands \vdots and \ddots provided +%% by LaTeX, these commands change size with LaTeX size changing +%% commands, as well as in {sub[sub]|super[super]}scripts. +%% +%% It also supplies a fix to the amsmath \dddot and \ddddot +%% commands which don't change size in scripts and suffer from a +%% vertical placement bug. +%% +%% Documentation after \endinput +%% +\def\mathdotsfiledate{2004/07/02}% +\def\mathdotsfileversion{0.6}% +\expandafter\ifx\csname MathDots\mathdotsfileversion\endcsname\relax +\else\immediate\write\sixt@@n{Mathdots already loaded.}\expandafter\endinput\fi + +\newif\ifMDlatex +% +% +\begingroup +\expandafter\ifx\csname ProvidesPackage\endcsname\relax + % not latex2e + \global\MDlatexfalse + \def\ProvidesPackage#1[#2]{% + \immediate\write16{Package #1, #2}}% +\else + \global\MDlatextrue +\fi +\expandafter +\endgroup +\ProvidesPackage{mathdots}[\mathdotsfiledate\space version \mathdotsfileversion.]% +% +\expandafter\edef\csname MathDots\mathdotsfileversion\endcsname{% + \catcode`\noexpand\@=\the\catcode`@}% +\catcode`\@=11 +% +\def\MD@us#1{\csname#1style\endcsname}% e.g., \MD@us{text} -> \textstyle +\def\MD@uf#1{\csname#1font\endcsname}% \MD@uf{text} -> \textfont +\def\MD@t{text}% \MD@uf{\MD@t} -> \textfont +\def\MD@s{script}% +\def\MD@ss{scriptscript}% +\newdimen\MD@unit +\MD@unit\p@ % old value, just in case. +\def\MD@changestyle#1{% +% 0.1em of family 0 in the current size replaces \p@ in the old +% definition: + \relax\MD@unit0.1\fontdimen6\MD@uf{#1}0 +% The current math dot replaces text font dot. We pass along the current +% style via \everymath: + \everymath\expandafter{\the\everymath\MD@us{#1}}% +}% +\def\MD@dot{$\m@th\ldotp$}% +% +% #1 is a command which we feed the current style name +% (not distinguishing display from text) +\def\MD@palette#1{\mathchoice{#1\MD@t}{#1\MD@t}{#1\MD@s}{#1\MD@ss}}% +% +% Save version at load time so user can use them. +\let\originalddots=\ddots +\let\originalvdots=\vdots +% +% Include current (2002/02/28) LaTeX/plainTeX definitions +% so user can opt for them. LaTeX/plainTeX don't have the other diagonal, +% so we provide a \fixediddots which is just \fixedddots with the boxes +% reversed. +\ifMDlatex + \DeclareRobustCommand + \fixedvdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@ + \kern6\p@\hbox{.}\hbox{.}\hbox{.}}} + \DeclareRobustCommand + \fixedddots{\mathinner{\mkern1mu\raise7\p@ + \vbox{\kern7\p@\hbox{.}}\mkern2mu + \raise4\p@\hbox{.}\mkern2mu\raise\p@\hbox{.}\mkern1mu}} + \DeclareRobustCommand + \fixediddots{\mathinner{\mkern1mu\raise\p@ + \hbox{.}\mkern2mu\raise4\p@\hbox{.}\mkern2mu + \raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}}% +\else + \def\fixedvdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@ + \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}% + \def\fixedddots{\mathinner{\mkern1mu\raise7\p@ + \vbox{\kern7\p@\hbox{.}}\mkern2mu + \raise4\p@\hbox{.}\mkern2mu\raise\p@\hbox{.}\mkern1mu}}% + \def\fixediddots{\mathinner{\mkern1mu\raise\p@ + \hbox{.}\mkern2mu\raise4\p@\hbox{.}\mkern2mu + \raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}}% +\fi +% +% #1 is the current style (supplied via \MD@palette). +% Except for the change in the unit used and the dot used, +% the definition is the same as plain \ddots: +\def\MD@ddots#1{{\MD@changestyle{#1}% + \mkern1mu\raise7\MD@unit\vbox{\kern7\MD@unit\hbox{\MD@dot}}% + \mkern2mu\raise4\MD@unit\hbox{\MD@dot}% + \mkern2mu\raise \MD@unit\hbox{\MD@dot}\mkern1mu}}% +% +% \iddots is same as \ddots but with the box order reversed: +\def\MD@iddots#1{{\MD@changestyle{#1}% + \mkern1mu\raise \MD@unit\hbox{\MD@dot}% + \mkern2mu\raise4\MD@unit\hbox{\MD@dot}% + \mkern2mu\raise7\MD@unit\vbox{\kern7\MD@unit\hbox{\MD@dot}}}}% +% +% +% We transform \vdots in the same fashion as \ddots and \iddots: +\def\MD@vdots#1{\vbox{\MD@changestyle{#1}% + \baselineskip4\MD@unit\lineskiplimit\z@ + \kern6\MD@unit\hbox{\MD@dot}\hbox{\MD@dot}\hbox{\MD@dot}}}% +% +% +\ifMDlatex + \DeclareRobustCommand\ddots{\mathinner{\MD@palette\MD@ddots}}% + \DeclareRobustCommand\iddots{\mathinner{\MD@palette\MD@iddots}}% + \DeclareRobustCommand\vdots{\mathinner{\MD@palette\MD@vdots}}% +\else + \def\ddots{\mathinner{\MD@palette\MD@ddots}}% + \def\iddots{\mathinner{\MD@palette\MD@iddots}}% + \def\vdots{\mathinner{\MD@palette\MD@vdots}}% +\fi +% +% Try to get AMS \dddot and \ddddot to behave: +\def\MD@dotsaccent#1#2{% + {\mathop{#2\kern\z@}\limits^{\text{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{#1}\vss}}}}} +\let\originaldddot \dddot +\let\originalddddot\ddddot +\ifMDlatex + \@ifpackageloaded{amsmath}{% + \PackageWarningNoLine{Mathdots}{Redefining amsmath commands + \string\dddot\space and \string\ddddot}% +% +% The \kern\z@ prevents TeX from vertically centering #1. The \text +% command invokes size changing (i.e., \normalfont changes meaning). +% Text dots match accent dots better than math dots do. + \DeclareRobustCommand\dddot {\MD@dotsaccent{\normalfont ...}}% + \DeclareRobustCommand\ddddot{\MD@dotsaccent{\normalfont....}}% + }{}% +\else +% +% Not LaTeX, but we'll redefine only if AMSTeX is used. + \def\amstexfmtname{AmS-TeX} + \ifx\amstexfmtname\fmtname + \immediate\write16{Mathdots: Redefining AmS-TeX commands + \string\dddot\space and \string\ddddot}% + \def\dddot {\MD@dotsaccent{\rm ...}}% + \def\ddddot{\MD@dotsaccent{\rm....}}% + \fi +\fi + +\csname MathDots\mathdotsfileversion\endcsname +\endinput +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} +\texttt{mathdots.sty} provides \verb"\ddots", \verb"\vdots", and +\verb"\iddots". If \LaTeX{} and \texttt{amsmath.sty} are detected (or +AMS-\TeX), the math accent commands \verb"\dddot" and \verb"\ddddot" are +modified. + +\verb"\ddots" (the same command as LaTeX provides) gives three dots on a +diagonal from upper left to lower right. It differs from LaTeX's command +in that it will change size within the scope of LaTeX size changing +commands. That is, {\verb"\Large$\ddots$"} will be larger and +{\verb"\small$\ddots$"} will be smaller than \verb"$\ddots$". + +LaTeX's definition would change the size of the dots, and the horizontal +dimensions, but not the vertical dimensions. The command from the +mathdots package also changes size in sub/superscripts. LaTeX's would +not change at all in those cases. Finally, LaTeX would take the dots +from the current text font, where the mathdots package takes them from +the current math symbol font, so they should match other dots in math +mode. This is only really a concern in 17pt sizes or larger where cmr17 +is scaled to get text dots, but cmsy12 is scaled to get math dots. + +\verb"\iddots" is similar, except it produces the other diagonal. + +\verb"\vdots" produces vertical dots (as in standard TeX or LaTeX), but +again, it will change size with size changing commands. + +The old behavior is stored in \verb"\fixedddots" and \verb"\fixedvdots". +If you wish \verb"\iddots" to behave similarly then use \fixediddots. + +On the off chance that some other package changes LaTeX's behavior +before this file is loaded, use \verb"\originalddots" and +\verb"\originalvdots" to obtain the versions in force when the mathdots +package is loaded. + +Note: The \fixed... versions try to maintain LaTeX's (awful) behavior, +which is to let the horizontal dimensions change size, as well as the +dots themselves, but hard code unchanging vertical dimensions. + +If the \LaTeX{} and the \textsf{amsmath} package are detected, the +commands \verb"\dddot" and \verb"\ddddot" are modified to get the same +size changing behavior in 'scripts. They also correct a positioning bug +in the \textsf{amsmath} code. The correction requires the command +\verb"\text", and so is only applied if \textsf{amsmath} has been loaded +\emph{before} \texttt{mathdots.sty}. The old amsmath commands are saved +in \verb"\originaldddot" and \verb"\originalddddot". + +In \LaTeX, all these commands have been made robust as of version 0.6. + +\end{document} diff --git a/Master/texmf-dist/tex/generic/genmisc/mathlig.tex b/Master/texmf-dist/tex/generic/genmisc/mathlig.tex new file mode 100644 index 00000000000..04194b84931 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/mathlig.tex @@ -0,0 +1,131 @@ +% +% mathlig.tex +% +% (c) 2001 Jules Bean <jules@jellybean.co.uk> +% Permission is granted to freely use, copy, and distribute +% without restriction. Permission is also granted to distribute +% modified versions and incorporate into your own macro packages +% if a brief acknowledgement is given. +% +% Version 1.0 11 May 2001 + +% Define 'mathmode' ligatures, as in +% +%\mathlig{->}{\rightarrow} +%\mathlig{<-}{\leftarrow} +%\mathlig{<->}{\leftrightarrow} +% +% Works even if they have common prefixes (takes the longest match, +% then backtracks). +% +% Can be used to create ligatures even if the second +% and subsequent characters have weird catcodes, but I don't recommend +% it. + +\count255\catcode`@ +\catcode`@=11 +\chardef\mathlig@atcode\count255 + +% Let or def an 'active' version of a token. Thanks to Donald +% Arseneau and groups.google.com +\def\actively#1#2{\begingroup\uccode`\~=`#2\relax\uppercase{\endgroup#1~}} +% Eat the next token, and then pass control to mathlig@next@cmd +\def\mathlig@gobble{\afterassignment\mathlig@next@cmd\let\mathlig@next= } +% Used to delimit delimited arguments, and ifx tests for emptyness. +\def\mathlig@delim{\mathlig@delim} +% Some macros to help dealing with 'computed names' (csnames). +% Just like def, but first parameter is evaluated as a csname +\def\mathlig@defcs#1{\expandafter\def\csname#1\endcsname} +% A version of \let <normal cs><computed cs> +\def\mathlig@let@cs#1#2{\expandafter\let\expandafter#1\csname#2\endcsname} +% Maintain a 'list' of tokens as a macro which expands to them +\def\mathlig@appendcs#1#2{\expandafter\edef\csname#1\endcsname{\csname#1\endcsname#2}} + +% The main externally visible macro. +% Defines '#1' as a 'ligature' to expand to #2 +% First uses \mathlig@checklig to make sure that all initial segments of +% #1 as set up as ligatures. +% Then sets the ligature #1 to expand to #2. +\def\mathlig#1#2{\mathlig@checklig#1\mathlig@end\mathlig@defcs{mathlig@back@#1}{#2}\ignorespaces} + +% All the @check macros should be idempotent: they set up the definitions +% only if it hasn't already been done. + +%Check #1#2 can be a ligature: +% Check #1 is math-active. +% If not, save the mathcode, set the macros #1 +%Now check the suffix tables with \checkrest +\def\mathlig@checklig#1#2\mathlig@end{% + \expandafter\ifx\csname mathlig@forw@#1\endcsname\relax + \expandafter\mathchardef\csname mathlig@back@#1\endcsname=\mathcode`#1% + \mathcode`#1"8000\actively\def#1{\csname mathlig@look@#1\endcsname}% + \mathlig@dolig#1\mathlig@delim +\fi +\mathlig@checksuffix#1#2\mathlig@end +} + +%Two-part macro. +%Check suffix tables. If #2 is empty, no suffix! +%Otherwise, we make sure #2 is a valid suffix for #1, +%then recurse for #3 on #1#2 +\def\mathlig@checksuffix#1#2\mathlig@end{% +\ifx\mathlig@delim#2\mathlig@delim\relax\else\mathlig@checksuffix@{#1}#2\mathlig@end\fi +} +\def\mathlig@checksuffix@#1#2#3\mathlig@end{% +\expandafter\ifx\csname mathlig@forw@#1#2\endcsname\relax\mathlig@dosuffix{#1}{#2}\fi +\mathlig@checksuffix{#1#2}#3\mathlig@end +} + +% The do macros should not be called more than once for a given ligature. + +% Add #2 to the list of valid suffixes for #1 +% Then make the ligature for #1#2 one which only backtracks, for now +\def\mathlig@dosuffix#1#2{% +\mathlig@appendcs{mathlig@toks@#1}{#2}% +\mathlig@dolig{#1}{#2}\mathlig@delim +} + +% Setup #1#2 so that ligatures beginning #1#2 work. +% Such ligatures will look at what's coming next (in case +% of a longer ligature) and, failing that, +% backtrack to just #1 + +\def\mathlig@dolig#1#2\mathlig@delim{% +%The look macro just \futurelets what's coming up and +%then passes control to forw + \mathlig@defcs{mathlig@look@#1#2}{% + \mathlig@let@cs\mathlig@next{mathlig@forw@#1#2}\futurelet\mathlig@next@tok\mathlig@next}% +%The forw macro uses chck to try all possible suffixes, passing control +%either to one of those, or to the back macro + \mathlig@defcs{mathlig@forw@#1#2}{% + \mathlig@let@cs\mathlig@next{mathlig@back@#1#2}% + \mathlig@let@cs\checker{mathlig@chck@#1#2}% + \mathlig@let@cs\mathligtoks{mathlig@toks@#1#2}% + \expandafter\ifx\expandafter\mathlig@delim\mathligtoks\mathlig@delim\relax\else + \expandafter\checker\mathligtoks\mathlig@delim\fi + \mathlig@next + }% +%The toks macro just stores the suffixes + \mathlig@defcs{mathlig@toks@#1#2}{}% +%The chk macro goes through the suffixes one by one +%tail recursing until it runs out, or finds one. + \mathlig@defcs{mathlig@chck@#1#2}##1##2\mathlig@delim{% + %\message{Lig so far '#1#2', checking for '##1'}% + \ifx\mathlig@next@tok##1% + \mathlig@let@cs\mathlig@next@cmd{mathlig@look@#1#2##1}\let\mathlig@next\mathlig@gobble + \fi + \ifx\mathlig@delim##2\mathlig@delim\relax\else + \csname mathlig@chck@#1#2\endcsname##2\mathlig@delim + \fi + }% +% +% The back macro, defined only if this is a ligature of at least +% two characters, is a default fallback: go back to the previous char. +% (If this is a ligature of only one character, the mathcode will have +% been saved and set as the fallback elsewhere) + \ifx\mathlig@delim#2\mathlig@delim\else + \mathlig@defcs{mathlig@back@#1#2}{\csname mathlig@back@#1\endcsname #2}% + \fi +}% + +\catcode`@\mathlig@atcode diff --git a/Master/texmf-dist/tex/generic/genmisc/nth.sty b/Master/texmf-dist/tex/generic/genmisc/nth.sty new file mode 100644 index 00000000000..8a96c73903d --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/nth.sty @@ -0,0 +1,56 @@ +% nth.sty version 2002/27/02 Donald Arseneau +% Ordinal numbering style, 1st 2nd 3rd 4th 5th... 12th... 101st 102nd... +% +% (Public domain: take, include, extract, whatever) +% +% In LaTeX: +% \usepackage[super,negative]{nth} +% where option [super] gives superscript `th' +% and option [negative] allows ``st, nd, rd'' suffixes on negative numbers. +% +% example: \renewcommand{\thesection}{\ordinal{section}} +% or \renewcommand{\thesection}{\@ordinal\c@section} +% or \renewcommand{\thesection}{\nth\c@section} +% +% In plain TeX: +% \input nth.sty +% use: \nth{<number>}. +% Change formatting by redefining \nthscript and \nthtest + +\def\nth#1{% First print number: + \expandafter\nthM \number #1\relax + \nthscript{% + \ifnum#1\nthtest0 th\else % negatives are all ``th'' (depending on \nthtest) + \expandafter \nthSuff \expandafter 0\number\ifnum #1<0-\fi#1\delimiter + \fi + }} + +% Minus sign using math mode: +\def\nthM#1{\if -#1\ifmmode-\else$-$\fi\else #1\fi} + +% Print suffix depending on last two digits: +\def\nthSuff#1#2#3{% + \ifx \delimiter#3% #1#2 are last two digits + \ifnum #1=1 th% teens are always ``th'' + \else % use appropriate suffix + \ifcase #2 th\or st\or nd\or rd\else th\fi + \fi + \else % continue scanning for last two digits + \expandafter \nthSuff \expandafter #2\expandafter #3% + \fi} + +% Formatting hook for ordinals (\let\nthscript\textsuperscript) +\def\nthscript#1{#1}% alternate: \def\nthscript#1{$\rm^{#1}$} + +% Formatting hook for all negative numbers giving ``th'' +\def\nthtest{<} % alternate: \def\nthtest{=} + +\ifx\Alph\undefined\else + \def\ordinal#1{\expandafter\@ordinal\csname c@#1\endcsname} + \let\@ordinal\nth + \ProvidesPackage{nth}[2002/02/27] + \DeclareOption{super}{\def\nthscript{\textsuperscript}} + \DeclareOption{negative}{\def\nthtest{=}} + \ProcessOptions +\fi + diff --git a/Master/texmf-dist/tex/generic/genmisc/outerhbox.sty b/Master/texmf-dist/tex/generic/genmisc/outerhbox.sty new file mode 100644 index 00000000000..75b618dc9ab --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/outerhbox.sty @@ -0,0 +1,86 @@ +% Copyright (c) 2005 Jonathan Fine <jfine@pytex.org> +% License: GPL version 2 or (at your option) any later version. +% $Source: /cvsroot/pytex/pytex/texmacros/outerhbox.sty,v $ + +% $Log: outerhbox.sty,v $ +% Revision 1.2 2005/10/06 07:00:19 jfine +% Added description, as provided to CTAN +% +% Revision 1.1 2005/10/06 06:32:18 jfine +% As posted to comp.text.tex, but \outerhbox instead of \outerbox + +% Collects horizontal mode material into an \hbox, suitable for later +% \unhbox'ing into a paragraph. For use with plain, LaTeX, ConTeXt, etc. + +% Provides \outerhbox, which is roughly similar to \hbox, except that +% material is set in outer horizontal mode. This prevents TeX from +% optimising away math penalties and the like, that are needed when the +% material is \unhbox'ed. + +% Based on code I posted to comp.text.tex + +% Message-ID: <43399D5A.50803@pytex.org> +% Date: Tue, 27 Sep 2005 20:28:26 +0100 +% Newsgroups: comp.text.tex +% Subject: Re: overlong lines in List of Figures +% <http://groups.google.com/group/comp.text.tex/msg/56ea490ad6d13dae> + +\ifx\undefined\outerhbox +\else\endinput\fi + +\ifx \documentstyle \undefined \else + \ifx \documentclass \undefined + \else \ProvidesPackage{outerhbox}[2005/09/29] \fi +\fi + + +\long\def\outerhbox #1% +% like \hbox, but sets material in outer horizontal mode +% #1 - horizontal material, to be set in outer horizontal mode +% Note: inappropriate commands in #1 can cause an \outerhboxerror +{% + \hbox{% + \setbox0 \vbox{% + \hsize\maxdimen + \pretolerance -1 + \rightskip 0pt + \parfillskip 0pt plus 1fil + \noindent #1\endgraf + \global\setbox1 \lastbox + }% + % check that size of \box 0 is 0.0+0.0x0.0 + \ifcase + % skip to \else if any dimension is non-zero + \ifcase\wd0 \else 1 \fi + \ifcase\ht0 \else 1 \fi + \ifcase\dp0 \else 1 \fi + 0 % satisfy the \ifcase + % + % place material into \hbox + \unhbox 1 + \unskip % remove \rightskip glue + \unskip % remove \parfillskip glue + \unpenalty % remove paragraph ending \penalty 10000 + \else + % there's something left in \box 0 + \outerhboxerror % default handler is to be \undefined + \fi + }% +} + +% \endinut % some test code follows + +\tracingall +\tracingonline = 1 +% \nonstopmode + +\setbox 0 \hbox{$2+2=2$} \showbox 0 +\setbox 0 \outerhbox{$2+2=2$} \showbox 0 +{ \leftskip 1in + \setbox 0 \outerhbox{$2+2=2$} \showbox 0 +} + +\setbox 0 \outerhbox{a\par b} \showbox 0 +\setbox 0 \outerhbox{} \showbox 0 +\setbox 0 \outerhbox{\ } \showbox 0 +\end diff --git a/Master/texmf-dist/tex/generic/genmisc/pagereference.tex b/Master/texmf-dist/tex/generic/genmisc/pagereference.tex new file mode 100644 index 00000000000..34ebc44c68c --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/pagereference.tex @@ -0,0 +1,67 @@ +%%%%%%%% PAGEREFERENCE MACROS +% May 2nd, 1994 +% Peter Ungar, 914 723 7187, laxa@acfcluster.nyu.edu +% 109 Lee Road, Scarsdale, N.Y. 10583-5229 +% +\long\def\COMMENT#1!E{} +% +% MACROS BEGIN HERE +\newwrite\inpr +\message{Is this the second pass? (y or n)} +\read16 to\answer +\if n\answer\immediate\openout\inpr=\jobname.pgn% +\def\wrx{\write\inpr}% +\def\plbl*#1*{\wrx{\noexpand\let\csname prec#1\endcsname=\folio}} +\def\pref*#1*{XX} +\fi +\if y\answer\closeout\inpr +\input \jobname.pgn +\def\plbl*#1*{} +\def\pref*#1*{\csname prec#1\endcsname} +\fi +% MACROS END HERE + +\COMMENT + + We use the macros as follow. Suppose you want to refer to a page +where you say something about Pythagoras. Put at the place to +which you want to refer +\plbl*pyth* Where you want to refer to this page, put +\pref*pyth* Here, in the place of pyth, one may use any sequence +of small and capital letters. Since the sequence will end up as +part of a TEX control sequence, digits are unfortunately not +allowed. (If that is very burdensome, we suggest encoding digits +as capitals, A for 1 etc.) In the second pass, the macros insert +a page number where there is a \pref. + + The macro \plbl (pagelabel), as defined when the answer to the +question, Is this the second pass, was n, writes the page number +into the file filename.pgn. To be precise, it creates a new +control sequence, consisting of \prec followed by the letters +identifying the label, which would result in \precpyth in the +example we gave, and sets it equal to the page number. In the +meanwhile, the \pref (page reference) macro is defined to print XX. + For the second pass, we input the file of labels and the page +numbers they signify which we wrote in the first pass. The +pagenumber recording macro +\plbl is redefined as vacuous, and the page reference macro \pref +is set to insert the page number. + +!E + + +This is a test of the page reference macro pair, +$\backslash$plbl (pagelabel) and $\backslash$pref (pagereference) +control sequences. There is a pagelabel command, with no effect on +the tpyeset output, just before the period at the end of this +sentence\plbl*aaa*. + +Reference to the page label on the next page: p.\pref*bb*; +reference to the pgae label on this page: p.\pref*aaa*. +\vfill +\eject Here is a second pagelabel, just before the +period\plbl*bb*. A reference to the first page label: +p.\pref*aaa*, and a reference to the second page page label: +p.\pref*bb*. + +\end diff --git a/Master/texmf-dist/tex/generic/genmisc/quotation.tex b/Master/texmf-dist/tex/generic/genmisc/quotation.tex new file mode 100644 index 00000000000..357a113816c --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/quotation.tex @@ -0,0 +1,5 @@ +\def\quotation#1#2{{% An extra group to keep changes to \tabskip local + \tabskip=0pt plus 1fill\let\\=\cr + \halign to\hsize{##\hfil\cr + #1\cr + \hfill#2\crcr}}} diff --git a/Master/texmf-dist/tex/generic/genmisc/ragged.sty b/Master/texmf-dist/tex/generic/genmisc/ragged.sty new file mode 100644 index 00000000000..909de8695ce --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/ragged.sty @@ -0,0 +1,781 @@ + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%% ragged.sty by Laurent Siebenmann, March 1996 -- + %% beta version of Mar 30, 1996. + %% Aim: Maintain hyphenation and raggedness control + %% while providing the following for all formats. + %% --- to make a paragraph ragged on left and justified + %% on right, use the syntax + %% \raggedL <paragraph> + %% --- to make a paragraph ragged on both left and right + %% (and symmetric), use the syntax + %% \raggedC <paragraph> + %% \raggedR is essentially equivalent \raggedright of Plain + %% or to \RaggedRight of raggedri.sty of G. Schr"oder. + %% All three \raggedX should give the same linebreaks; they + %% just provide different horizontal positioning of the lines. + %% Documentation of options etc. follows \endinput. + %% Run this file alone to see a demo. + + \ifx\undefined\raggedL\else\expandafter\endinput\fi + + \chardef\raggedcatAT=\catcode`\@ \catcode`\@=11 + + %%temporarily suppress Plain's logging of allocations + \let\R@Gtemp\wlog + \def\wlog#1{\relax} + + \newbox\R@Gvbox + \newbox\R@Ghbox + \newbox\R@Ghbox@ + + \newcount\R@Glinect + + \newskip\R@Gfillskip + + \newdimen\R@Gauxdim + \newdimen\R@Gindentdim + \newdimen\R@Ghsize + \newdimen\raggedStretch + + \raggedStretch=10\p@ %% default + + \newtoks\raggedEnv + \newtoks\raggedEnvOnce + + \let\wlog\R@Gtemp + + \R@Gfillskip=\z@ plus 1fil + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%% Core macros + + \def\R@Gprep{\ifhmode + \errmessage{ Do not use + \noexpand\raggedX commands in horizontal mode}% + \expandafter\par\fi} + + \def\R@Gcore{% + \setbox\R@Gvbox=\vbox\bgroup + \hsize=\maxdimen \leftskip=\z@ + \hskip\z@skip} + + \def\CalcR@GIndent@{% + %% first set \R@Gindentdim to excess of \R@Ghsize over remainder + \R@Gindentdim=\hsize + \advance\R@Gindentdim by -\rightskip + \advance\R@Gindentdim by -\wd\R@Ghbox@ + %% second convert to hang as l,c,r demand + \fixR@Ghang@ %% \R@Gindentdim=.5\R@Gindentdim for \raggedC + }% + + \def\endR@Gcore{\endgraf + \global\R@Glinect=\prevgraf + \global\setbox\R@Ghbox=\lastbox + \egroup % + \ifcase\R@Glinect\relax %% 0 + \or \endR@Gcore@ %% 1 + \else \errmessage{\noexpand\raggedX is failing. + Read about \string\RaggedX}\endR@Gcore@ %% >1 + \fi} + + \def\endR@Gcore@{% + \setbox\R@Gvbox=\vbox{% + \unhcopy\R@Ghbox\unpenalty\unskip\unskip + \endgraf\global\R@Glinect=\prevgraf %\showthe\prevgraf + \global\setbox\R@Ghbox@=\lastbox}% + \setbox\R@Ghbox@=\hbox{% + \unhbox\R@Ghbox@\unpenalty\unskip\unskip}% + \CalcR@GIndent@ %% + \ifdim\R@Gindentdim>\z@ + \hangindent=\R@Gindentdim %\showthe\R@Gindentdim + \else + \hangindent=\z@ + %% Rmk: neg hangindents are from right margin + \fi + \advance\R@Glinect by -1\relax + \hangafter\R@Glinect + \unhbox\R@Ghbox + \endgraf} + + \def\endR@@G{\endR@Gcore\let\par\R@Goldpar\endgroup} + + \def\raggedFrac#1{\def\R@GFrac{#1 }} + + \raggedFrac{1} %% default + + \def\R@GEnv@{% + %\parskip=4pt plus 1pt + %\baselineskip=12pt + %\parfillskip=0pt plus 1fil + %\emergencystretch=20pt + \finalhyphendemerits=20000 % 5000 is Plain default + \parindent=\z@ %% 0 + \pretolerance=\@M %% 10000 + %% end of options easily changeable + %% via \raggedEnv{...} and \raggedEnvOnce{...} + \let\R@Goldpar\par + \let\par\endR@@G + \R@Gauxdim=\hsize + \advance\R@Gauxdim by -\leftskip + \advance\R@Gauxdim by -\rightskip + \R@Ghsize=\R@GFrac\R@Gauxdim + \advance\R@Gauxdim by -\R@Ghsize + \R@GRedefs + \the\raggedEnv + \the\raggedEnvOnce\global\raggedEnvOnce{}% + }% + + \def\R@GRedefs{\let\break\R@Gbreak + \let\vadjust\R@Gvadjust@ + \everydisplay{\R@Geverydisplaymole@}} + + \def\R@Gnono{ is forbidden with \string\raggedX} + \def\R@Gbreak{\errmessage{\noexpand\break\R@Gnono}\penalty-\@M}% + \def\R@Gvadjust@#1{{\tt (USE OF vadjust)}% + \errmessage{\noexpand\vadjust\R@Gnono.\space See output}}% + \def\R@Geverydisplaymole@#1$${$${\tt (DISPLAY)}% + \errmessage{Display math\R@Gnono. See output}}% + + \def\raggedHrule{\unskip\penalty0 + \vrule height0.3\p@ depth-0\p@ width \R@Ghsize \penalty0}% + + %%% \R@GEnv@@ corrects \R@Ghsize if user has modified it + %% through \leftskip, \rightskip via \raggedEnv{...} + %% then does other last minute tasks tasks + \def\R@GEnv@@{% + \R@Ghsize=\hsize + \advance\R@Ghsize by -\leftskip + \advance\R@Ghsize by -\rightskip + \parfillskip=\R@Gfillskip + } + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%% User macros + + %%% \raggedC + \def\raggedC{\R@Gprep\begingroup + \leftskip=1\leftskip \rightskip=1\rightskip + \R@GEnv@ + \advance\leftskip by .5\R@Gauxdim plus .5\raggedStretch + \advance\rightskip by .5\R@Gauxdim plus .5\raggedStretch + \def\fixR@Ghang@{\R@Gindentdim=.5\R@Gindentdim}% + \R@GEnv@@ + \R@Gcore} + + %%% \RaggedC + \def\RaggedC{\R@Gprep\begingroup\let\R@Gcore\relax + \let\R@GRedefs\relax\raggedC + \parfillskip=\z@ + \def\par{\let\par\R@Goldpar\par\endgroup\endgroup}% + } + + % %%% \raggedR@ is strict analog of \raggedR@, \raggedC@ + % %% present for testing only + % \def\raggedR@{\R@Gprep\begingroup + % \R@GEnv@ %% not needed + % \advance\rightskip by \R@Gauxdim plus \raggedStretch + % \def\fixR@Ghang@{\R@Gindentdim=0\p@}% + % \R@GEnv@@ + % \R@Gcore + % } + + %%% \raggedR is more robust then \raggedL, \raggedC as it + %% it allows $$...$$ and \vadjust, \break etc. in paragraph. + \def\raggedR{\R@Gprep\begingroup + \let\R@GRedefs\relax + \R@GEnv@ %% initial part + \advance\rightskip by \R@Gauxdim plus \raggedStretch + \R@GEnv@@ + \def\par{\let\par\R@Goldpar\par\endgroup}% + } + + %%% \RaggedR + \def\RaggedR{\R@Gprep\raggedR + \parfillskip=\z@\relax} + + \def\raggedL{\R@Gprep\begingroup + \R@GEnv@ + \advance\leftskip by \R@Gauxdim plus \raggedStretch + \def\fixR@Ghang@{}% + \R@GEnv@@ + \R@Gcore} + + %%% \RaggedL + \def\RaggedL{\R@Gprep\begingroup\let\R@Gcore\relax + \let\R@GRedefs\relax\raggedL + \parfillskip=\z@ + \def\par{\let\par\R@Goldpar\par\endgroup\endgroup}% + } + + \def\gobble#1{} + + \catcode`\@=\raggedcatAT + + %%%% END INPUT IF THIS IS NOT A DEMO RUN ! + \edef\temp{\csname\jobname\endcsname}% + \edef\Temp{\csname ragged.sty\endcsname}% + \ifx\temp\Temp\else + \expandafter\endinput + \fi + + %%%% END OF MACROS + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%% BEGINNING OF DEMONSTRATION + %%% TESTS FOR \raggedX + + \ifx\documentstyle\undefined + \let\documentstyle\gobble \let\begin\gobble + \fi + \documentstyle{article} + \begin{document} + + \hsize=400pt + + \raggedStretch=1000pt + \RaggedC + THESE ARE TESTS FOR ragged.sty\break + EXPORT THE TESTS BEFORE PLAYING WITH THEM + \bigskip + + \widowpenalty=10000 + \leftskip=0\hsize %plus 10pt + \rightskip=0\hsize %plus 10pt + \raggedStretch=10pt %% 10pt dafault + \raggedFrac{.5} + \raggedEnv{\parskip=4pt plus 3pt + \emergencystretch=20pt + %\pretolerance=100 + } + \parskip=0pt plus 2pt + \parindent=0pt + +\def\TESTTEXT{It is the union of passionate interest in detailed +facts with equal devotion to abstract generalization which forms +the novelty in \hbox{our present society}. } + + \TESTTEXT + + %\raggedEnvOnce{\raggedStretch=0pt} + \raggedL\raggedHrule + % $$dfd$$ %\vadjust{\hrule}% \break + \TESTTEXT + + \raggedL + {\sl A.N. Whitehead} + + \raggedC\raggedHrule\TESTTEXT + + %\raggedEnvOnce{\parskip=0pt} + \raggedC{\sl A.N. Whitehead} + + + \raggedR\raggedHrule\TESTTEXT + + \raggedR +{\sl A.N. Whitehead} + + %\end + %{document} + + %%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%% TESTS FOR \RaggedX + + \raggedStretch=1000pt %% default 10pt %% play with this + \raggedEnv{% + %\linepenalty=0 %% default 50 %% play with this + \parskip=4pt plus 3pt + %\pretolerance=0 %% default 100 + %\hyphenpenalty=0 %% default 50 + } + + \bigskip \hrule \bigskip + + \TESTTEXT + + \RaggedL\raggedHrule\TESTTEXT + + \raggedL +{\sl A.N. Whitehead} + + + \RaggedC\raggedHrule\TESTTEXT + + %\raggedEnvOnce{\parskip=0pt} + \raggedC{\sl A.N. Whitehead} + + + \RaggedR\raggedHrule\TESTTEXT + + \raggedR +{\sl A.N. Whitehead} + +\end +{document} + + %%%% END OF TESTS + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + ***** USER DOCUMENTATION FOR ragged.sty ***** + + + + *** TYPICAL EXAMPLE + + \input ragged.sty + + \raggedFrac{.4} + \raggedEnv{\parskip=4pt plus 3pt} + \raggedL\raggedHrule +I was not a Child~Prodigy, because a Child~Prodigy is +a child who knows as much when it is a child as it +does when it~grows~up. + +\raggedL +{--- Will Rogers} + +The above will produce a quotation that is aligned to the right margin, +ragged on the left and having about .4 the width of a normal line. + + Just compose this file itself to see to see a more extensive +example instantly composed. + + + + *** INTENDED USES + +(i) For "ragged-left-and-flush-right" formatting of short prose +quotations tradionally placed at the end of book chapters. + +(ii) For captions on figures in an artistic page layout. + +(iii) For notes in a left hand margin ragged on the left and aligned +on the right. + + (iv) For "raggedleft" composition of left-hand pages of of narrow +brochures --- matching "raggedright" composition of right hand pages. + + Admittedly, hand specification of linebreaks is often the best +option, and that is how Don Knuth proceeds for use (i) in most of his +books. But in case reformatting for different page sizes or screen sizes +is anticipated, Knuth's alternative should be avoided like the plague; +this should apply to all documents distributed in ".tex" typescript +format. The last 3 applications seem to demand good control on +raggedness and hyphenation. + + + + *** NOVELTY + + It is too early to assert with confidence that ragged.sty offers +genuinely new capabilities in all formats. + + Hopefully \raggedL and \raggedC offer something new even for LaTeX +users. The standard "center" and "flushright" environments of LaTeX do +*roughly* the same thing by a different method. But the macros +\raggedL and \raggedC seem a necessery innovation in case one wants +control on raggedness and/or hyphenation. + + Outside LaTeX, even the offer even the more limited LaTeX features +are little known; thus, particularly sturdy macros \RaggedC and \RaggedL +are also offered by ragged.sty to provide just the LaTeX features in +other formats --- which means all features except raggedness control and +hyphenation. + + + + *** USER CONTROL SEQUENCE SUMMARY + +The \raggedX trio: +\raggedL <paragraph> %% sets paragraph ragged on left justified on right +\raggedC <paragraph> %% sets paragraph ragged on both left and right +\raggedR <paragraph> %% sets paragraph ragged on right justified on left +See also the companion trio \RaggedX below. + +With the default configuration, each of these leaves an arbitrarily +short last line while maintaining some tension on earlier lines +(\raggedStretch=10pt, total raggedness stretch). + +Only the following paragraph is affected by each. + + --- \raggedHrule provides a horizontal line of the ragged text width +if put *immediately after* \raggedX. + + --- \raggedFrac{<decimal fraction>} sets the length of the lines of +the ragged-set paragraphs as a fraction of current line length. +The current line length is + + (\hsize diminished by \leftskip and \rightskip) + + --- \raggedEnv{...} is to be placed before \raggedX; it allows the user +to redefine parameters for the line breaking environment of \raggedX. +Inspect the definition of the internal macro \R@GEnv@ for hints on +which parameters to change. Never change the code in ragged.sty; +your modifications belong in \raggedEnv{...} within your typescripts. + + \raggedEnv{...} and \raggedFrac{...} need not be repeated before +each use of \raggedX. If you want once-only temporary ragged +environment change, you can use grouping or \raggedEnvOnce{...} + + \raggedFrac, \hsize, \leftskip, \rightskip should not appear in the +argument of \raggedEnv; this is roughly because they relate to external +parameters. + + By default, paragraph indentation of the ragged paragraph is +zero. Hyphenation is by default switched off. However +\raggedEnv{\parindent=20pt \pretolerance=100} would change this back +to Plain defaults. + + You may want to adjust the new dimension \raggedStretch, which is +10pt by default. Incidentally, if the total stretch in lines falls +below about 20pt, you may have to add, say \emergencystretch=20pt +inside \raggedEnv{...}. + + In tuning stretch and hyphenation, consider also the following: +\fontdimen3\font=<dimension>, \spaceskip=<skip> and \xspaceskip=<skip>. +Cf. Plain's \raggedright. + + A companion trio \RaggedL, \RaggedC, \RaggedR are simpler, +robuster, and faster macros that perform two services already available +in LaTeX: + + (i) If used with default parameters, they force the last paragraph line +to have roughly the same length as all others. Results are good if +there are many lines. + + (ii) If used with parameter value \raggedStretch=1000pt, they behave +like the competing LaTeX environments with default parameters: lines are +relaxed and filled in natural order. + + + *** INSTALLATION + + For any format, \input ragged.sty will install the package. + + For LaTeX (version 2e), place \usepackage{ragged} in the article header +between \documentclass{...} and \begin{document}. + + + + *** OCCASIONAL PROBLEMS AND THEIR REMEDIES + + \raggedL and \raggedC (not \raggedR and \RaggedX) are only +moderately robust: they work correctly only when the paragraph contents +will form a single line if composed on an "infinitely" long line. +Therefore, they misbehave if they contain *for example* displayed math +or \break or material inserted by \vadjust; and also if the paragraph +exceeds about a page of typing; error warnings are given. + + The most annoying failing is the unavailability of \break; it can +be replaced by \hbox{...} and the tie ~ ; indeed without introducing the +inflexibility which \break does. + + Fortunately such limitations do not much interfere with the use +intended. (Indeed the unavailability of \break is a blessing in +disguise.) + + If difficulty is nevertheless encountered, use the *fast* and +*robust* \RaggedL and \RaggedC where necessary (search out "\Ragged" +instructions and tests!). + + On a given paragraph, all 3 \raggedX should always produce the +*same* linebreaks; any exception is a bug. Similarly for all three +\RaggedX. + + Please report undocumented bugs to lcs@topo.math.u-psud.fr. + + + + *** A TRIVIAL SOLUTION WHEN RAGGEDNESS IS NULL + + Donald Arseneau pointed out (Info-TeX, Sat Mar 9, 1996) that if +left and right margins are justified (i.e. \raggedStretch is zero) then +the last line of paragraphs can be center or right aligned by a simple +"trick" setting as follows: + + *** Center Alignment + + \leftskip=1\leftskip plus 1fil %% use \setlength in LaTeX + \rightskip=-\leftskip + \parfillskip=0pt plus 2fil + + *** Right Alignment + + \leftskip=1\leftskip plus 1fil %% use \setlength in LaTeX + \rightskip=-\leftskip + \parfillskip=0pt plus 1fil + +Donald considers this *well known*; he learned of it first from +Barbara Beeton. + + This device will also work in ragged environments IF AND WHEN +*extended* TeX allows skips to have *both* finite and infinite stretch +-- analogous to ordinals of the form integer + \omega. This is not +yet planned. + + As always in TeX, there may yet be another "deus ex machina"! Time +will tell. + + + + *** WHY USE ragged.sty WITH LATEX? + + LaTeX (in all versions) has the environments "flushleft", "center", +and "flushright" that perform very nearly the services of \RaggedL, +\RaggedC, and \RaggedR. LaTeX also has macros \raggedright and +\raggedleft roughly equivalent to "flushleft" and "flushright" minus +the grouping that goes along with an environment. + + These LaTeX environments/macros perform reliably, and like \RaggedX +do *not* suffer the fragility mentioned above for \raggedX. + + All these LaTeX features are programmed by a mare parameter setting +(cf. programmer documentation below): they simply use the infinite value +1fil for the stretch component of \leftskip and/or \rightskip, and this +permits quite excessive raggedness -- as testing shows. If one just +makes this stretch finite and modest, then the last line becomes +excessively stretched and/or all lines tend to become equal. This matter +seems to have been first recorded and remedied by Jan van der Steen and +Martin Schr\"oder who wrote raggedri.sty (1993) (see CTAN) producing a +macro \RaggedRight more or less equivalent to Plain's \raggedright -- +but no \RaggedCenter nor \RaggedLeft. + + Consequently LaTeX users have reason to use my macros \raggedL and +\raggedC when controlled raggedness is wanted. In addition, I suspect +the ragged.sty syntax will prove helpful in adjusting up width's and +margins. + + Since the competing LaTeX environments are deeply imbricated in +the complicated "list" environment apparatus, I have not attempted to +tinker directly with the LaTeX code to make the new ragged.sty features +a well integrated patch for LaTeX; that is a job for those working on +LaTeX3. + + + + *** HISTORY + + These macros were initially programmed to respond to a request of +Laszlo Battha <battha@apollo.ggki.hu>, Mon Mar 4, 1996 on the Info-TeX +list. + + Laurent Siebenmann + Math'ematique, Bat. 425, + Univ de Paris-Sud, + 91405-Orsay, + France + + + + + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + ***** PROGRAMMER DOCUMENTATION FOR ragged.sty ***** + + In essence, \RaggedX is a mere parameter setting; indeed, it sets +the stretch components of \leftskip and \rightskip to total +\raggedStretch. What is a miracle preordained by Knuth is that as +soon as \raggedStretch is huge (say 1000pt), while \linepenalty +remains substantial (say 50) all lines but the last are as full as +they can be without puting interword spaces under tension. +Hyphenation occurs only to prevent line length overrun. LaTeX +operates similarly but using infinite stretch. + + In contrast, \raggedL and \raggedC are hopefully original; they +are more devious than outright difficult; what will be more +difficult is to make them work in absolutely all circumstances where +Plain's \raggedright works. They already give perfect typography +or else complain. + + Permit me to set the scene with an overstatement. Analogs of all +three \raggedX exist in every competent wordprocessor since 1984 -- +beginning with MacWrite. However, in TeX (1982) there was an +unfortunate oversight; there should be not just one \parfillskip but +two: \leftparfillskip and \rightparfillskip=\parfillskip. These +should be "skip"s (elastic spaces) inserted at the left and right of +the last line of each paragraph. If these become available (say in +an e-TeX or Omega), one will be able to program \raggedL and +\raggedC by merely setting these parameters along with \leftskip, +\rightskip and a few others. + + This makes it clear that the moderately complicated programming +I have used is just a "workaround". Fortunately it is neither slow +nor bulky. + + Here is the logic of the present programming of \raggedL; it +will be followed by some promising alternatives. + + + + *** CURRENT METHOD (A) + + --- Sweep the paragraph text into \vbox of huge \hsize so that the +paragraph text fits on one line. The use of a \vbox instead of an +\hbox; here is the one recent "breakthrough" involved; it surfaced as a +result of investigations of Barbara Beeton, Michael Downes and Don +Knuth -- in this order! -- see TUGboat 11 (Nov 1991), pages 605--612. + + --- Extract the line as an \hbox and \unhbox it into a \vbox with +the "raggedleft" environment as desired, except for \parfillskip=0pt +plus 1fil where we would really want \leftparfillskip=0pt plus 1fil +and \rightparfillskip=0pt. Here we learn the number of lines in the +paragraph by use of \lastgraph. + + --- We find out the length of the the last line by using \lastbox to +pick off the last \hbox in the above \vbox, and then \unhbox'ing it +into another \hbox stripping off a penalty10000, \rightskip and +\parfillskip (going right to left). + + --- From this, we can calculate the indentation by which to push the +last box right to make it flush with the right margin. + + But we do *not* do that since it entails unpleasant technical +complications related to vertical placement. Instead we more +simply: + + --- unhbox onto the current page (essentially) the first \hbox +encountered above, using the last mentioned environment modified only by +a \hangindent equal to the measured indent, which is scheduled by +\hangafter to intervene on the last line of the paragraph. + + In a real sense the current page receives the final paragraph +just like a normal paragraph. Therefore (hopefully!) no vertical +mode complications will occur. + + Far *more* complex tricks of this sort, *the last one excepted*, are +exploited in Donald Arseneau's shapepar.sty on CTAN. Fortunately, +ragged.sty and shapepar.sty do not compete on the performance +front. + + + + *** ALTERNATIVE METHOD (B) + + This is the method I first attempted in a preliminary "hack" posted +on Info-teX Sat Mar 9, 1996. The raggedleft paragraph can contain +\vadjust and \break since the "one-long-line" requirement of (A) +disappears. + + --- first compose the paragraph \vbox with the ultimately desired +\hsize, \leftskip, \rightskip, but use \parfillskip=0pt plus 1fil. + + --- obtain the relaxed length of the last paragraph line much as +as above, using \lastbox etc. The last line is thus "deleted". + + --- reconstruct the last line as an \hbox to assure the correct +horizontal location. + + --- restore the last line into the \vbox. This requires careful +vertical placement, possibly involving \lastskip, \lastdepth, +\lastpenalty, + + --- \unvbox the corrected \vbox onto the current page. +This again requires careful vertical placement, eg. as regards +space both above and below, penalties etc. + + The last step requires that one be able to perfectly emulate, by +hand as it were, important parts of TeX's paragraph builder. It is by +far a more delicate task than the first method. Donald Arseneau called +it "painful" (Info-TeX, Sat Mar 9, 1996). + + Indentations above *displayed equations* have not been discussed +(but they are in alternative C below); that would redouble complexity. + + + + *** ALTERNATIVE METHOD (C) + + This last alternative is my proposed improvement of the first +method by use of an auxiliary file for storing widths between TeX +jobs and by possible use of two passes on each paragraph. + + This method seems to fully eliminate the failings of \raggedX, +ie. refusal of: displays, \break, \vadjust. Very desirable for a +narrow brochure with left-hand pages composed "raggedleft". But I +have done only fragmentary prototyping. + + Two passes on a paragraph are executed (when that is necessary) +by taking up the whole paragraph in a macro argument, storing it +temporarily in unexpanded token list form, and then rereading it so +that category assignments are those for normal progressive input. +This will be done by fast internal primitives in all versions of +e-TeX. But in Knuth's TeX it requires writing the unexpanded token +list out to a file, with help of the the \meaning primitive and +then rereading. + + An auxiliary file with indentation widths may indicate that a +preliminary pass is unnecessary; thus, on the average, composition +should be very fast. + + --- during a possible preliminary composition of a paragraph one +keeps \parfillskip equal 0pt plus 1fil, and merely records, in the +order of occurrence: + + (a) the widths of remainders on the last line before each display, +using \predisplaysize and a temporary addition to the token list +\everydisplay. + + (b) the width of the remainder on the paragraph's last line. This +is gotten using \lastbox much as in methods (A) or (B). + +Note that \lastbox operates in internal vertical mode, and not in +vertical mode. Hence all preliminary composition is to be done in a +\vbox. This \vbox is discarded once the necessary indentation +information has been extracted --- just as in method (A) but +contrary to method (B). + + --- during final raggedleft composition of a paragraph, the width +information is applied with help from \lastgraf, \hangindent, +\hangafter much as in method (A). + +In this final raggedleft composition of a paragraph, the width +information used may be either from the current job or from a +previous job. But it is always obtained from some preliminary +composition. + + In the case of a paragraph that is composed by \raggedL in a +single pass, it would be highly desirable to have a check that the +composed paragraph is OK; it would for example probably *not* be OK +if changes had intervened there since last composition. The +unavailability of \lastbox in ordinary vertical mode seems to make +a *sure* check difficult. Perhaps one must be content with checks +that are less than sure --- such as variation of the number of +typescript lines occupied by the paragraph as found via +\inputlineno. The user could also signal changes using a syntax like +\raggedL[changed 1647]. Also, \raggedTwoPass in the header could +force slow but sure two-pass treatment. + + + Incidentally, a simple way to make a brochure with left pages +raggedleft and right pages raggedright and *without* altering the +output routine is to compose the brochure twice, once raggedleft +and once raggedright; then one can mix the two at the .dvi (or +postscript) level. + + It is clear that, for such brochures, vertical spacing in and +among paragraphs should be perfectly normal, and identical for +raggedleft and raggedright composition. Method (C) seems to +promise this without pain. + + + + I recommend (C) as next method to program. But I could +be wrong. + + Laurent Siebenmann + Math'ematique, Bat. 425, + Univ de Paris-Sud, + 91405-Orsay, + France + + 30 March 1996 + + diff --git a/Master/texmf-dist/tex/generic/genmisc/random.tex b/Master/texmf-dist/tex/generic/genmisc/random.tex new file mode 100644 index 00000000000..d1a818558b2 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/random.tex @@ -0,0 +1,94 @@ +% RANDOM.TEX v.1 (Donald Arseneau) +% Generating "random" numbers in TeX. +% +% Random integers are generated in the range 1 to 2147483646 by the +% macro \nextrandom. The result is returned in the counter \randomi. +% Do not change \randomi except, perhaps, to initialize it at some +% random value. If you do not initialize it, it will be initialized +% using the time and date. (This is a sparse initialization, giving +% fewer than a million different starting values, but you should use +% other sources of numbers if they are available--just remember that +% most of the numbers available to TeX are not at all random.) +% +% The \nextrandom command is not very useful by itself, unless you +% have exactly 2147483646 things to choose from. Much more useful +% is the \setrannum command which sets a given counter to a random +% value within a specified range. There are three parameters: +% \setrannum {<counter>} {<minimum>} {<maximum>}. For example, to +% simulate a die-roll: \setrannum{\die}{1}{6} \ifcase\die... . +% +% If you need random numbers that are not integers, you will have to +% use dimen registers and \setrandimen. For example, to set a random +% page width: \setrandimen \hsize{3in}{6.5in}. The "\pointless" macro +% will remove the "pt" that TeX gives so you can use the dimensions +% as pure `real' numbers. In that case, specify the range in pt units. +% For example, +% \setrandimen\answer{2.71828pt}{3.14159pt} +% The answer is \pointless\answer. +% +% The random number generator is the one by Lewis, Goodman, and Miller +% (1969) and used as "ran0" in "Numerical Recipies" using Schrage's +% method for avoiding overflows. The multiplier is 16807 (7^5), the +% added constant is 0, and the modulus is 2147483647 (2^{31}-1). The +% range of integers generated is 1 - 2147483646. A smaller range would +% reduce the complexity of the macros a bit, but not much--most of the +% code deals with initialization and type-conversion. On the other hand, +% the large range may be wasted due to the sparse seed initialization. + +\newcount\randomi % the random number seed (while executing) +\global\randomi\catcode`\@ % scratch variable during definitions +\catcode`\@=11 + +\def\nextrandom{\begingroup + \ifnum\randomi<\@ne % then initialize with time + \global\randomi\time + \global\multiply\randomi388 \global\advance\randomi\year + \global\multiply\randomi31 \global\advance\randomi\day + \global\multiply\randomi97 \global\advance\randomi\month + \message{Randomizer initialized to \the\randomi.}% + \nextrandom \nextrandom \nextrandom + \fi + \count@ii\randomi + \divide\count@ii 127773 % modulus = multiplier * 127773 + 2836 + \count@\count@ii + \multiply\count@ii 127773 + \global\advance\randomi-\count@ii % random mod 127773 + \global\multiply\randomi 16807 + \multiply\count@ 2836 + \global\advance\randomi-\count@ + \ifnum\randomi<\z@ \global\advance\randomi 2147483647\relax\fi + \endgroup +} + +\countdef\count@ii=2 % use only in boxes! +\ifx\@tempcnta\undefined \csname newcount\endcsname \@tempcnta \fi +\ifx\@tempcntb\undefined \csname newcount\endcsname \@tempcntb \fi + +\def\setrannum#1#2#3{% count register, minimum, maximum + \@tempcnta#3\advance\@tempcnta-#2\advance\@tempcnta\@ne + \@tempcntb 2147483645 % = m - 2 = 2^{31} - 3 + \divide\@tempcntb\@tempcnta + \getr@nval + \advance\ranval#2\relax + #1\ranval +} + +\def\setrandim#1#2#3{% dimen register, minimum length, maximum length + \dimen@#2\dimen@ii#3\relax + \setrannum\ranval\dimen@\dimen@ii + #1\ranval sp\relax +} + +\def\getr@nval{% The values in \@tempcnta and \@tempcntb are parameters + \nextrandom + \ranval\randomi \advance\ranval\m@ne \divide\ranval\@tempcntb + \ifnum\ranval<\@tempcnta\else \expandafter\getr@nval \fi +} + +\def\pointless{\expandafter\PoinTless\the} +{\catcode`p=12 \catcode`t=12 +\gdef\PoinTless#1pt{#1}} + +\catcode`\@=\randomi +\global\randomi=0 +\newcount\ranval diff --git a/Master/texmf-dist/tex/generic/genmisc/ruler.tex b/Master/texmf-dist/tex/generic/genmisc/ruler.tex new file mode 100644 index 00000000000..c35928e6a68 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/ruler.tex @@ -0,0 +1,656 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Typographic ruler for TeX, version 1.1 +% Copyright Victor Eijkhout 1999 +% file name: ruler.tex +% +% Author: +% Victor Eijkhout +% Department of Computer Science +% University of Tennessee, Knoxville TN 37996 +% +% victor@eijkhout.net +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% For a copy of the GNU General Public License, write to the +% Free Software Foundation, Inc., +% 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, +% or find it on the net, for instance at +% http://www.gnu.org/copyleft/gpl.html +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This file is identical to an earlier version which was on ctan and +% other archive sites; only the license and copyright information +% has changed. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\hsize=14.5cm \vsize=32cm \voffset=-1.5cm +\nopagenumbers \raggedbottom +\overfullrule=0pt +%\tracingoutput=1 +\showboxbreadth=20 \showboxdepth=7 + +\font\tiny=cmr5 \font\ss=cmr8 +\font\big=cmss10 scaled \magstep3 +\font\manual=cmr10 + +%\font\tiny=helv at 5pt \font\ss=helv at 8pt +%\font\big=helv at 16pt +%\font\manual=times at 10pt + +\let\tt=\ss \let\rm=\ss +\parindent=0cm \offinterlineskip +\def\\{\hfill\break} + +\newdimen\margin \margin=.5cm +\newdimen\linewidth \linewidth=0.05mm +\newdimen\scalewidth \scalewidth=6mm \newdimen\magboxwidth +\newdimen\gridheight \gridheight=8cm +\newdimen\rulewidth \rulewidth=\scalewidth +\newdimen\ruleboxheight \ruleboxheight=6mm + +\newbox\magscalenames \newbox\scale \newbox\grid +\newbox\stairs \newbox\ruler +\newcount\ncol \newcount\nrow +\newcount\tempcount \newcount\tempcountb \newcount\tempcounth +\newbox\tempboxa \newbox\tempboxb +\newskip\tempskip \newskip\tempskipb +\newdimen\tempdimen \newdimen\tempdimenb \newdimen\tempdimenc + +\newbox\storea \newbox\storeb \newbox\storec +\newbox\stored \newbox\storee \newbox\storef +\newbox\storeg \newbox\storeh \newbox\storei +\newbox\storej + +\def\gobble#1{} +\def\gobbletwo#1#2{} +\def\gobblethree#1#2#3{} +\def\gobblefive#1#2#3#4#5{} + +\def\hfilll{\hskip 0cm plus 1filll\relax} + +%%%%%%%%%%%%%%%% trace +%\tracingonline=1 +%\tracingmacros=1 + +%%%%%%%%%%%%%%%% auxiliaries +\def\decimala %% #1=getal; a-> 1 plaats achter de komma + #1{{\tempcounth=#1\relax + \tempcountb=\tempcounth + \divide\tempcountb by 10\relax + \number\tempcountb.% + \multiply\tempcountb by 10\relax + \advance\tempcounth by -\tempcountb + \number\tempcounth}} + +\def\decimalb %% #1=getal; b-> 2 plaatsen achter de komma + #1{{\tempcounth=#1\relax + \tempcountb=\tempcounth + \divide\tempcountb by 100\relax + \number\tempcountb.% + \multiply\tempcountb by 100\relax + \advance\tempcounth by -\tempcountb + \ifnum\tempcounth<10 0\fi + \number\tempcounth}} + +\def\hundred#1{{\tempcounth=#1 + \tempcountb=\tempcounth + \divide\tempcounth by 100\relax + \ifnum\tempcounth>0 + \number\tempcounth.\fi + \multiply\tempcounth by 100 + \advance\tempcountb by -\tempcounth + \ifnum\tempcountb<10 0\fi + \number\tempcountb}} + +\def\thousand#1{{\tempcount=#1 \tempcountb=\tempcount + \divide\tempcount by 1000 + \ifnum\tempcount>0 \number\tempcount.\fi + \multiply\tempcount by 1000 + \advance\tempcountb by -\tempcount + \ifnum\tempcountb<100 0\fi + \ifnum\tempcountb<10 0\fi + \number\tempcountb}} + +\def\headedbox %% #1=heading text #2=vbox + #1#2{\vtop{\vbox to 0cm{\vss\setbox0=\hbox to 0cm{\tt #1\hss} \dp0=0cm + \box0 \vskip2pt} + #2}} +\def\boxit#1{\vbox{\hrule + \hbox{\vrule #1\vrule} + \hrule}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%% baseline measurement %%%%%%%%%%%%%%%%%%%%%%%% +\newskip\liftskip +%% what baselineskips are needed? +\def\baselinedist#1{\ifcase#1\or 5\or 6\or 7\or 8\or 9\or 10\or + 11\or 12\or 13\or 14\or 15\or 16\or 17\or + 18\or 20\or 22\or 25\or 30\fi} + +%% first one step in a ladder of baselineskips +\def\baselinebox %% #1=size #2=number label + #1#2{\vbox to #1pt{\vfil + \moveright .5\hsize\vbox{\hrule height \linewidth + width .5\hsize} + \vfil\vbox to 0cm{\vss\hskip2pt\tiny\number#2\vskip\liftskip} + \hrule height \linewidth}} + +%% next a whole ladder of baselineskips +\def\baselinescale %% #1=number of steps #2=point size + #1#2{\ifnum#2<7 \liftskip=0pt \else \liftskip=2pt \fi + \setbox\scale=\vbox{}% + \baselinescalei 1{#1}{#2}% + \edef\tcs{{#2}{\box\scale}}\expandafter\headedbox\tcs} +\def\baselinescalei %% #1=label #2=number of steps #3=point size + #1#2#3{\ifnum#1>#2 \def\tcs{0}\let\next=\gobblethree + \else\tempcount=#1 \advance\tempcount by 1 + \setbox\scale=\vtop{\hsize=\scalewidth + \advance\hsize by -\linewidth + \unvbox\scale + \baselinebox{#3}{#1}}% + \let\next\baselinescalei \edef\tcs{{\number\tempcount}}\fi + \expandafter\next\tcs{#2}{#3}} + +%% finally a grid of ladders of baselineskips +\def\baselinegrid %% #1=number of baseline scales #2=storage box + #1#2{\setbox\grid=\hbox{}% + \setbox#2=\vtop{\hrule height 0pt depth \linewidth + \baselinegridi 1{#1} + \hrule height \linewidth}} +\def\baselinegridi %% #1=current number #2=total number of baseline scales + #1#2{\ifnum#1>#2 \hbox{\vsize=\gridheight \unhbox\grid + \vrule width \linewidth} + \else\tempcount=\gridheight \tempskip=\baselinedist{#1}pt + \divide\tempcount by \tempskip \edef\tcs{{\number\tempcount}} + \setbox\grid= + \hbox{\vsize=\gridheight \unhbox\grid + \vrule width \linewidth + \expandafter\baselinescale\tcs{\baselinedist{#1}}} + \tempcount=#1 \advance\tempcount by 1 \edef\tcs{{\number\tempcount}} + \expandafter\baselinegridi\tcs{#2}\fi} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%% magnified font sizes %%%%%%%%%%%%%%%%%%%%%%%%% +\newcount\honcor +\long\def\bungeltext#1#2{ + \hrule height \linewidth + \kern1mm + \vbox{\hsize=#1\relax \rightskip=0cm plus 1fil + \lineskiplimit=0pt \lineskip=0pt \baselineskip=6pt + \tiny #2\par}} + +\def\magstep#1{\ifcase#1 1000\or 1095\or 1200\or 1440\or 1728\or + 2074\or 2488\fi} +\def\tienstep#1{\ifcase#1 10\or 10.95\or 12\or 14.4\or 17.28\or + 20.74\or 24.88\fi} +\def\zevenstep#1{\ifcase#1 7\or 7.67\or 8.4\or 10.08\or 12.10\or + 14.52\or 17.42\fi} +\def\vijfstep#1{\ifcase#1 5\or 5.48\or 6\or 7.2\or 8.64\or + 10.37\or 12.44\fi} + +\def\magname#1{\ifcase#1 0\or half\or 1\or 2\or 3\or 4\or 5\fi} +\def\cmmagbox#1{{\divide\tempdimen by 1000 + \multiply\tempdimen by \magstep#1% + \tempdimenb=.01mm \tempdimenc=\tempdimen + \divide\tempdimenc by \tempdimenb + \tempcount=\tempdimenc + \edef\next{\the\tempcount}% + \divide\honcor by 1000 + \multiply \honcor by \magstep#1\relax + \tempdimenc=.01pt \divide\honcor by \tempdimenc + \edef\mixt{\the\honcor}% + \edef\next{\noexpand\magbox{\the\tempdimen}{\magname#1}% + {\noexpand\hundred{\next}} + {\noexpand\corrout#1}}\next}} +\def\magbox %% #1=height #2=first text #3=second #4=third + #1#2#3#4{\vtop{\hbox{\vrule width\linewidth + \vbox{\hrule width \magboxwidth height \linewidth + \kern #1}} + \bungeltext\magboxwidth + {#2\par #3\par #4\par} + }} + +\def\magsteps{\vtop{\hbox{\cmmagbox0\cmmagbox1\cmmagbox2% + \cmmagbox3\cmmagbox4\cmmagbox5\cmmagbox6% + \vrule width \linewidth depth 0cm}}} + +\def\magrow %% #1=name #2=unit numerator #3=unit denominator + %% #4=unit size #5=design size #6=store box + #1#2#3#4#5#6{\tempdimen=#4 \divide\tempdimen by #3 + \multiply\tempdimen by #2 + \tempdimenb=#5pt \honcor=\tempdimenb + \ifnum#5=10 \let\corrout\tienstep + \else\ifnum#5=7 \let\corrout\zevenstep + \else \let\corrout\vijfstep \fi\fi + \magboxwidth=\scalewidth \setbox\tempboxa=\magsteps + \setbox\tempboxb= + \vtop{\vbox{\hsize=1.2cm + \lineskiplimit=0pt \lineskip=0pt + \baselineskip=6pt + \def\\{\hfil\break} \tiny #1 + \par \kern1mm} + \setbox0=\hbox{\tiny point size } + \bungeltext{\wd0}{magstep\par + mm \par point size\par}} + \tempdimen=\wd\tempboxa \advance\tempdimen by \wd\tempboxb + \advance\tempdimen by 2mm + \setbox#6= + \hbox to \tempdimen{\box\tempboxa \kern2mm \box\tempboxb}} + +\def\magsizebox %% #1=text + #1{\hbox to 1.5\scalewidth{\hfil \tiny #1\hfil}} + +%%%%%%%%%%%%%%%%%%%%%%%% general magrows %%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\gmagsteps %% #1=from #2=by #3=to + #1#2#3{\tempcount=#1\relax + {\multiply\tempdimen by \tempcount \tempcountb=\tempdimen + \tempdimenc=.01mm \divide\tempcountb by \tempdimenc + \edef\next{\the\tempcountb}% + \edef\next{\noexpand\magbox{\the\tempdimen}{\the\tempcount}% + {\noexpand\hundred{\next}}{}}% + \next}% + \advance\tempcount by #2% + \ifnum\tempcount=#3\relax\vrule width \linewidth depth 0cm + \else\edef\next{\noexpand\gmagsteps + {\number\tempcount}{#2}{#3}}\next\fi} + +\def\gmagrow %% #1=name #2=unit numerator #3=unit denominator + %% #4=unit size #5=from #6=by #7=to #8=store box + #1#2#3#4#5#6#7#8{\tempdimen=#4 \divide\tempdimen by #3 + \multiply\tempdimen by #2 + \setbox#8=\hbox{\magboxwidth\scalewidth \gmagsteps{#5}{#6}{#7} + \ {} + \vtop{\kern0cm + \setbox0=\hbox{\tiny point size } + \bungeltext{\wd0}{point size\\mm}}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% rulers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifleftruler \newdimen\stapje \newdimen\Stap \newdimen\hstapje +\newcount\halfway \newcount\alltheway +\newbox\onerulerbox +\newdimen\vollebreedte \newdimen\vollebreedteplus +\newdimen\overschot \overschot=.75mm + +\def\doalltheway + #1#2#3{#3{#1}\relax + \ifnum#1=#2\relax\else + \tempcount=#1 \advance\tempcount by 1 + \expandafter\doalltheway\expandafter + {\number\tempcount}{#2}{#3}\fi} + +\def\centimeterruler{\Stap=1cm \leftrulerfalse + \vollebreedte=1cm\relax + \def\rulename{centimeter}% + \let\ruledigitfont=\rm + \alltheway=10 \doruler{cm}} +\def\inchruler{\Stap=1in \leftrulertrue + \vollebreedte=1cm\relax + \def\rulename{inch}% + \let\ruledigitfont=\rm + \alltheway=8 \doruler{inch}} +\def\picaruler{\Stap=12pt \leftrulerfalse + \vollebreedte=1cm\relax + \def\rulename{pica}% + \let\ruledigitfont=\tiny + \alltheway=6 \doruler{pica}} +\def\rulerpiece + #1{\vbox to \stapje{\vfil \rulerhalfline \vfil \rulerline{#1}}} +\def\rulerline %% streepje over aantal mm; halfweg volle breedte + #1{\ifnum#1=\halfway \tempskipb=\vollebreedteplus + \else \tempskipb=#1\hstapje + \advance\tempskipb by \overschot \fi + \hbox to \vollebreedteplus + {\maybeleft \vrule width\tempskipb height\linewidth + \mayberight }} +\def\rulerhalfline + {\tempskipb=.5\hstapje \advance\tempskipb by \overschot + \hbox to \vollebreedteplus + {\maybeleft\vrule width\tempskipb height\linewidth + \mayberight}} +\def\rulerbox %% #1=label + #1{\vbox to 0cm{\kern.75mm\relax %was .5\stapje + \hbox to \vollebreedteplus + {\mayberight + \kern.75mm\ruledigitfont + #1\kern.75mm + \maybeleft} + \vss} + \copy\onerulerbox} +\def\makerulerbox{\global\setbox\onerulerbox= + \vbox to \Stap{\vbox to 0cm + {\hbox{\ifleftruler\kern\overschot\fi + \kern.5\vollebreedte + \vrule depth \Stap width\linewidth} + \vss} + \doalltheway1{\alltheway}{\rulerpiece} + \vss}} +\def\doruler %% #1=unit name #2=length #3=storage box + #1#2#3{\ifleftruler \let\maybeleft\relax \let\mayberight\hfil + \else \let\maybeleft\hfil \let\mayberight\relax + \fi + \bgroup \halfway=\alltheway \divide\halfway by 2\relax + \stapje=\Stap \divide\stapje by \alltheway + \hstapje=\vollebreedte \divide\hstapje by \alltheway + \vollebreedteplus=\vollebreedte + \advance\vollebreedteplus by \overschot + \makerulerbox + \setbox\ruler=\vbox{\hrule width \vollebreedteplus height\linewidth}% + \doruleri 0{#2}\relax + \global\setbox\ruler= + \hbox{\ifleftruler\else\vrule width\linewidth\fi + \box\ruler + \ifleftruler \vrule width\linewidth \fi}% + \xdef\tcs{{#1}{\box\ruler}}\egroup + \setbox#3\expandafter\headedbox\tcs} + \def\doruleri + #1#2{\ifnum#1>#2 \let\next=\gobbletwo \def\tcs{0}% + \else \setbox\ruler= + \vtop{\unvbox\ruler\rulerbox{#1}}% + \let\next=\doruleri + \tempcount=#1\relax \advance\tempcount by 1 + \edef\tcs{{\number\tempcount}}\fi + \expandafter\next\tcs{#2}} + +%%%%%%%%%%%%%%%%%%%%%%%%%% paper size %%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\papersize#1#2{\vtop + {\kern0cm\vbox to #2{ + \vbox to #1{\vfil\hrule width 2mm height 0cm depth \linewidth} + \vfil\hrule width 2mm height 0cm depth \linewidth}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%% rule thickness %%%%%%%%%%%%%%%%%%%%%%%%%% +\newdimen\rulelength \rulelength=.75\scalewidth +\newdimen\interruleskip \interruleskip=.5\scalewidth + +\def\ruleboxh %% #1=rule thickness #2=label + #1#2{\setbox\tempbox= + \vbox{\hsize=\rulewidth + \vfill \vskip10pt \hbox{\tiny \rulenum{#2}} + \vskip1pt \hrule height #1 width \rulewidth}% + \ifdim\ht\tempbox<\ruleboxheight + \vbox to \ruleboxheight{\unvbox\tempbox}% + \else\box\tempbox\fi} +\def\ruleboxv %% #1=rule thickness #2=label + #1#2{\vtop{\kern0cm + \hbox{\hbox to 5mm{\tiny \hfil \rulenum{#2}\kern1mm}% + \vrule height \rulelength width #1} + \kern \interruleskip}} +\let\rulebox=\ruleboxv +\def\rulestackhead %% #1=minimal label #2=label step + %% #3=minimal dimen #4=dimen step + %% #5=maximal label #6=storage box #7=header + #1#2#3#4#5#6#7{\setbox\scale=\vbox{}% + \rulestacki{#1}{#2}{#3}{#4}{#5}% + \setbox#6=\headedbox{#7}{\box\scale}} +\def\rulestack %% #1=minimal label #2=label step + %% #3=minimal dimen #4=dimen step + %% #5=maximal label #6=storage box + #1#2#3#4#5#6{\setbox\scale=\vbox{}% + \rulestacki{#1}{#2}{#3}{#4}{#5}% + \setbox#6=\box\scale} +\def\rulestacki %% #1=curr label #2=label step + %% #3=curr dimen #4=dimen step #5=total dimen + #1#2#3#4#5{\ifnum#1>#5% + \setbox\scale= + \vtop{\unvbox\scale \setbox0=\lastbox}% + \let\next=\gobblefive \def\tcs{0}% + \else \setbox\scale= + \vtop{\unvbox\scale + \rulebox{#3}{#1}}% + \tempskip=#3\relax \advance\tempskip by #4\relax + \tempcount=#1\relax \advance\tempcount by #2\relax + \let\next=\rulestacki + \edef\tcs{{\number\tempcount}}\fi + \expandafter\next\tcs{#2}{\tempskip}{#4}{#5}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%% conversion table %%%%%%%%%%%%%%%%%%%%%%%% +\def\num{\ss\enspace\hfill} +\def\me#1{\ifcase#1\relax\or pt\or pc\or dd\or cc\or bp\or mm\or in\fi} +\def\table{\halign{\strut\hbox to 1cm{\tt##\hfil}\vrule\enspace + &\num##&\num##&\num##&\num##&\num##&\num##&\num##\cr + \hfill&\tt \me1&\tt \me2&\tt \me3&\tt \me4&\tt \me5&\tt \me6&\tt \me7\cr + \noalign{\hrule} + \me1&1&.0833&&&&.351&.0138\cr + \me2&12&1&&&&4.218&.166\cr + \me3&&&1&.0833&&.376&.0148\cr + \me4&&&12&1&&4.513&.1777\cr + \me5&&&&&1&.383&.0139\cr + \me6&2.845&.237&2.659&.222&2.835&1&.0394\cr + \me7&72.27&6.0225&67.54&5.628&72&25.4&1\cr + }} +%%%%%%%%%%%%%%%%%%%%%%%%%% the whole sheet %%%%%%%%%%%%%%%%%%%%%%%%% + +\def\opskip{\vskip.5mm\relax} +\let\neerskip\opskip + +\output{} + +\begingroup\hsize=12cm \vsize=8in +\parindent=0pt \parskip=6pt +\rightskip=0cm plus 5cm \normalbaselines + +\hbox{}\vskip3cm +\big The \TeX\ ruler + +\manual +This is the \TeX\ ruler, a measuring device for +typographical designers working with \TeX. It includes ordinary +rulers in inches, centimeters, and picas. +It can be used to measure font sizes, baseline distances, +and rule weights. The design is based on a ruler +by Inge~Eijkhout, implementation in \TeX\ is by +Victor~Eijkhout. + +The \TeX\ ruler is shareware, distributed under the GNU Public License. +If you want to show your appreciation, send a contribution +to the address below. + +How to format and print this file + +This file will give you three pages. Most likely the second one +cannot be handled by your printer, but I've included it for +completeness. At the top of the source file, 3 fonts are +declared. Please change the CM fonts to something more pretty, +eg Helvetica. + +How to use the \TeX\ ruler + +Rulers. Use them like ordinary rulers. It is suggested +that you print the \TeX\ ruler on transparent plastic and +cut the edges along the rulers. + +Baseline distances. Put the top line along the baseline +of some line of text. Then see in what column the other +lines of text line up. + +Font sizes: cap height. Take an uppercase letter +such as `K' or `H'. Find the line with its font name, +or use the first line. See what box on that line +it fits in best, with the character completely between +the lines. Read out the magnification and size of the +font. Alternately check on all lines which box fits +best, then read out the size. + +General remark: all lines have a width of .05 millimeter. +This is less than the dot width of a 300dpi +laser printer, so beware of some inaccuracies. +Also your printer driver may introduce +inaccuracies. + +\leavevmode +{\obeylines \parskip=0pt % +Victor Eijkhout +Department of Computer Science +University of Tennessee +Knoxville, TN 37996 +USA\par {\tt victor@eijkhout.net}} + +\vfil +Copyright 1990-99 by Victor Eijkhout +\eject +\endgroup + +\endlinechar-1 + +\def\BigSheet{\leavevmode +\leftrulertrue \inchruler{11}{\storea} +\box\storea +\papersize{8.5in}{11in} +% +\vtop{ + \baselinegrid{18}\storea \box\storea + \kern1mm + \moveright2mm + \vbox{\hbox{\ss Baseline distances} + \neerskip \hrule} + \kern5mm + % + \moveright2mm + \hbox{ + \vtop{\vbox{\hrule \opskip \hbox{\ss Cap heights}} + \kern-3mm + \def\a{\kern2mm} + \magrow{cmr10\\cmbx10\\cmss10\\cmmi10}{250}{36}{1pt}{10}\storec + \magrow{cmtt10\\cmff10}{220}{36}{1pt}{10}\stored + \magrow{cmr7\\cmbx7\\cmmi7}{175}{36}{1pt}7\storee + \magrow{cmr5\\cmbx5\\cmmi5}{125}{36}{1pt}5\storef + \vbox{\a\box\storec \a\box\stored + \a\box\storee \a\box\storef} + % + \gmagrow{cmr10}{25}{36}{1pt}51{14}\storec + \gmagrow{cmr10}{25}{36}{1pt}{15}1{24}\stored + \gmagrow{cmr10}{25}{36}{1pt}{26}2{44}\storee + \gmagrow{cmr10}{25}{36}{1pt}{46}2{64}\storef + \vbox{\a\box\storec \a\box\stored + \a\box\storee \a\box\storef} + % + \leftrulertrue \picaruler{19}{\storea} + \setbox\storeb=\vtop{\kern0cm + \def\a{}%{\moveright1cm} + \a\vbox{\hrule \opskip + \hbox{\strut\ss Conversion of units}} + \kern2mm + \halign{\vrule height8pt depth3pt width0pt + \ss##\ &${}={}$\hfil\ \ss##&$\,$##\cr + 1{\tt in}& 72.27&{\tt pt}\cr + 1{\tt in}& 72&{\tt bp}\cr + 1{\tt in}& 25.4&{\tt mm}\cr + 1157{\tt dd}& 1238&{\tt pt}\cr + 1{\tt pt}& 65536&{\tt sp}\cr} + \kern2mm \table + \kern8mm + \hbox{\hskip1cm \big The \TeX\ Ruler} + \kern2pt + \hbox{\hskip1cm \tiny Design:\ {} + Inge and Victor Eijkhout 1990--96}} + \kern4mm + \hbox{\box\storea \kern2mm \box\storeb} + }%end of \vtop + \kern-1cm + \vtop{\vbox{\hrule \opskip \hbox{\ss Rule weights}} + \kern5mm + \let\rulenum=\decimalb + \rulestackhead{5}{5}{0.05mm}{0.05mm}{100}\storeg{mm} + \rulestack {100}{25}{1mm}{0.25mm}{525}\storeh + \let\rulenum=\decimala + \rulestackhead{5}{5}{.5pt}{.5pt}{151}\storei{pt} + \hbox{\box\storeg \kern3mm \box\storeh \kern3mm \box\storei} + }%end of second \vtop + }%end of \hbox + } +% +\kern2mm\relax +\leftrulerfalse \centimeterruler {29}{\storea} +\papersize{21cm}{29.7cm} +\box\storea +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\smallsheet{\leavevmode +\leftrulertrue \inchruler{9}{\storea} +\box\storea \kern2mm +% +\vtop{ + \baselinegrid{18}\storea \box\storea + \kern1mm + \moveright2mm + \vbox{\hbox{\ss Baseline distances} + \neerskip \hrule} + \kern5mm + % + \moveright2mm + \hbox{ + \vtop{\vbox{\hrule \opskip \hbox{\ss Cap heights}} + \kern-3mm + \def\a{\kern2mm} + \magrow{cmr10\\cmbx10\\cmss10\\cmmi10}{250}{36}{1pt}{10}\storec + \magrow{cmtt10\\cmff10}{220}{36}{1pt}{10}\stored + \magrow{cmr7\\cmbx7\\cmmi7}{175}{36}{1pt}7\storee + \magrow{cmr5\\cmbx5\\cmmi5}{125}{36}{1pt}5\storef + \vbox{\a\box\storec \a\box\stored + \a\box\storee \a\box\storef} +% + \leftrulertrue \picaruler{19}{\storea}%\showbox\storea + \setbox\storeb=\vtop{\kern0cm + \def\a{}%{\moveright1cm} + \a\vbox{\hrule \opskip + \hbox{\strut\ss Conversion of units}} + \kern2mm + \halign{\vrule height8pt depth3pt width0pt + \ss##\ &${}={}$\hfil\ \ss##&$\,$##\cr + 1{\tt in}& 72.27&{\tt pt}\cr + 1{\tt in}& 72&{\tt bp}\cr + 1{\tt in}& 25.4&{\tt mm}\cr + 1157{\tt dd}& 1238&{\tt pt}\cr + 1{\tt pt}& 65536&{\tt sp}\cr} + \kern2mm \table + \kern8mm + \hbox{\hskip1cm \big The \TeX\ Ruler} + \kern2pt + \hbox{\hskip1cm \tiny Design:\ {} + Inge and Victor Eijkhout 1990--96}} + \kern4mm + \hbox{\box\storea \kern2mm \box\storeb} + }%end of \vtop + \kern-1cm + \vtop{\vbox{\hrule \opskip \hbox{\ss Rule weights}} + \kern5mm + \let\rulenum=\decimalb + \rulestackhead{5}{5}{0.05mm}{0.05mm}{50}\storeg{mm} + \rulestack {50}{10}{.5mm}{0.1mm}{160}\storeh + \let\rulenum=\decimala + \rulestackhead{5}{5}{.5pt}{.5pt}{101}\storei{pt} + \hbox{\box\storeg \kern3mm \box\storeh \kern3mm \box\storei} + }%end of second \vtop + }%end of \hbox + } +% +\kern2mm\relax +\leftrulerfalse \centimeterruler {23}{\storea} +\box\storea +} + + +\count0=2 +\BigSheet +\vfill\eject +\count0=3 +\smallsheet + +\end +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/generic/genmisc/selectpage.tex b/Master/texmf-dist/tex/generic/genmisc/selectpage.tex new file mode 100644 index 00000000000..5a1405d3c44 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/selectpage.tex @@ -0,0 +1,30 @@ +%From Tugboat volume 8, number 2 july 1987 +%by Donald Knuth +% +% The idea is to make TeX look for a file called pages.tex. if such a +%file doesn't exit, everything works as before, Otherwise the file +%should contain a list of apge numbers, one per line, in the order that +%they will be generated. After the last page number has been matched, +%all further pages will be printed. Thus, if you want ot print pages +%123 and all pages from 300 onwards, your file pages.tex should say +% 123 +% 300 +%but if you want to print pages 123 and 300 only, the file should say, +%e.g., +% 123 +% 300 +% -99999999999 % impossible number +%so that the end of file will never occur. +% + +\let\Shipout=\shipout +\newread\pages \newcount\nextpage \openin\pages=pages +\def\getnextpage{\ifeof\pages\else + {\endlinechar=-1\read\pages to\next \ifx\next\empty % in this case we +should have eof now \else\global\nextpage=\next\fi}\fi} +\ifeof\pages\else\message{OK, I'll ship only the requested pages!} + \getnextpage\fi +\def\shipout{\ifeof\pages\let\next=\Shipout + \else\ifnum\pageno=\nextpage\getnextpage\let\next=\Shipout + \else\let\next=\Tosspage\fi\fi \next} +\newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=} diff --git a/Master/texmf-dist/tex/generic/genmisc/shade.sty b/Master/texmf-dist/tex/generic/genmisc/shade.sty new file mode 100644 index 00000000000..a5500190e1a --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/shade.sty @@ -0,0 +1,177 @@ +A `frequently asked question' is that for possibilites to produce +shaded boxes. + +Since the answers usually (just as recently) point either to PostScript +\special's and PiCTeX it seems that a `simpler' and easier to use version +is not readily available --- though I did not check this. + +A small and simple approach to shaded boxes is the use of a special font +providing shaded rectangles, and some macros which automatically compose the +desired box from these characters. + +Since, of course, the finest shading can be achieved by using single pixels +for the pattern, the best shading pattern is *device dependent*. +Furthermore, one generally defined shading pattern would imply the danger, +that - because of rounding errors - at the boundaries (between two of the +characters) `lines' would occur, and that the pattern would not look completely +uniform. Consequently, since different fonts are to be used for different +printers, the dvi file is *device dependent* in this sense, too, though the +code - both for the macros and for the metafont description - is device +independent. + +%%% SHADE.rdm +%%% ReadMe file for SHADE.mf and SHADE.tex/sty +%%% ------------------------------------------------------------------------- +%%% Version 1 - March 21, 1993 +%%% Peter Schmitt, Institute of Mathematics, University of Vienna +%%% Strudlhofgasse 4, A-1090 Wien, Austria +%%% e-mail A8131DAL@helios.edvz.univie.ac.at +%%% schmitt@awirap.bitnet +%%% ------------------------------------------------------------------------- + +\magnification=\magstep1 +\parindent0pt \parskip 3pt +\input shade.tex + +{\tt SHADE} is a \TeX\ tool that can be used to produce shaded boxes +neither using PostScript nor Pic\TeX. + +% The syntax is: + +\shade{This text will appear on a shaded background!} + +The shading macro first packs its argument into an hbox. + +\shade{\vbox{\hsize 5cm + \leftskip=0pt plus 1fil\rightskip=0pt plus 1fil + \parfillskip=0pt + Then it measures the dimensions of this box and produces a + shaded box slightly larger then this box, using the font + shade produced by {\tt shade.mf}. Finally it + puts the box back and overlays it with the shaded box. + \par + }} + +Since the best shading is achieved at the lowest possible resolution, +the font \shade{SHADE} is {\bf not device independent} --- it uses +the printer resolution. Therefore the .dvi file is +{\bf not device independent}, either. +The macro code, however, {\bf is device independent}. +This method was used because otherwise shading, and in particular +the boundaries between two shading characters, could turn out to be not +completely uniform. +For the same reason, the font should only be used at its true size. + +The {\tt shade} package consists of three files: + {\tt shade.mf, % MetaFont file for shading font + shade.tex, % macro file be used with LaTeX, too + shade.rdm. % this file + % it can be processed by TeX as a demo file + } +It was tested with a HP Laserjet II plus. + +\bye + +%%% end of SHADE.rdm %%% +%%% SHADE.tex or SHADE.sty +%%% Macros for use with font SHADE +%%% ------------------------------------------------------------------------- +%%% Version 1 - March 21, 1993 +%%% Peter Schmitt, Institute of Mathematics, University of Vienna +%%% Strudlhofgasse 4, A-1090 Wien, Austria +%%% e-mail A8131DAL@helios.edvz.univie.ac.at +%%% schmitt@awirap.bitnet +%%% ------------------------------------------------------------------------- + +\catcode`\:11 + +\font\grey:=shade at 10truept + +\newbox\shade:box +\newdimen\fill:boundary + \setbox0=\hbox{\grey:\char0\relax}\fill:boundary=\ht0 +\newcount\fill:level \newdimen\fill:size \newdimen\fill:goal + +\long\def\shade#1{\leavevmode + \setbox\shade:box=\hbox{#1}% + \def\shade:column{}\def\shade:row{}% + \fill:level=5 \fill:goal=\wd\shade:box + \advance\fill:goal by 2\fill:boundary + \let\shade:v\relax \Fill: \shade:row\shade:v + \fill:level=5 + \fill:goal=\ht\shade:box \advance\fill:goal by \dp\shade:box + \advance\fill:goal by 2\fill:boundary + \let\shade:h\relax \Fill: \shade:column\shade:h + \fill:goal=\ht\shade:box \advance\fill:goal by \dp\shade:box + \setbox0=\vbox to\fill:goal{\offinterlineskip\grey: + \def\shade:h##1{% + \def\shade:v####1{\char####1##1\relax}% + \hbox to \wd\shade:box{\hss\shade:row\hss}} + \vss \shade:column \vss + }\ht0=\ht\shade:box \dp0=\dp\shade:box + \rlap{\box0}\box\shade:box + } +\def\Fill: {\setbox0=\hbox{\grey:\char\fill:level\relax}\fill:size=\ht0 + \fill:} +\def\fill: #1#2{% + \ifdim \fill:size>\fill:goal + \advance\fill:level by-1 + \ifnum \fill:level>-1 \let \fill:next = \Fill: + \else \let \fill:next = \fill:stop \fi + \else \edef#1{#1#2\the\fill:level}\advance\fill:goal by -\fill:size + \let \fill:next = \fill: + \fi \fill:next #1#2} +\def\fill:stop#1#2{} + +\endinput + +%%% end of SHADE.tex/sty %%% +%%% SHADE.mf +%%% Font SHADE for use with SHADE.TEX/STY +%%% ------------------------------------------------------------------------- +%%% Version 1 - March 21, 1993 +%%% Peter Schmitt, Institute of Mathematics, University of Vienna +%%% Strudlhofgasse 4, A-1090 Wien, Austria +%%% e-mail A8131DAL@helios.edvz.univie.ac.at +%%% schmitt@awirap.bitnet +%%% ------------------------------------------------------------------------- + +mode_setup; +magnification=1000; +font_identifier "Shade"; +font_coding_scheme "Shade Style Matrix"; +font_size 10pt#; + +%%% a = side of smallest shaded square (3x3 pixels) + a#:=(3/pixels_per_inch)*1in#; + define_pixels(a); +%%% greybox produces a shaded rectangle: +%%% height 2^H*a +%%% width 2^W*a +%%% ... +%%% it consists of WxH `unit squares': .*. +%%% ... +%%% its character code is 10*W + H +%%% i.e., the first digit corresponds to the width and +%%% the second digit corresponds to the height of the character + +def greybox (expr H, W) = + HH:=2**H; WW:=2**W; + beginchar(10*W+H, WW*a#, HH*a#, 0); + pickup pencircle scaled 1; + fill (1,1)--(1,3*HH)--(3*WW,3*HH)--(3*WW,1)--cycle; + pickup pencircle scaled 2; + for x = 0 step 3 until 3*HH : undraw (0,x)--(3*WW,x); endfor; + for x = 0 step 3 until 3*WW : undraw (x,0)--(x,3*HH); endfor; + endchar; + enddef; + +%%% produce characters for H and W from 0 to 5 + +for ww = 0 upto 5 : + for hh = 0 upto 5 : greybox (hh,ww); endfor; + endfor; + +bye; + +%%% end of SHADE.mf %%% diff --git a/Master/texmf-dist/tex/generic/genmisc/shadebox.tex b/Master/texmf-dist/tex/generic/genmisc/shadebox.tex new file mode 100644 index 00000000000..3044d631f70 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/shadebox.tex @@ -0,0 +1,171 @@ +%% Save file as: SHADEBOX.TEX Source: FILESERV@SHSU.BITNET +%% Author: Leo@vaxc.cc.monash.edu.au +%% Original Source: Posted by Jim Hefferon <HEFFERON@SMCVAX.BITNET> to +%% INFO-TeX on Thu, 16 Jan 1992 11:21 EST + +%% Small (and subtle) bug correction on 25 July 2002 +%% by Danilo {\v S}egan <mm01142@alas.matf.bg.ac.yu> +%% +%% The mysterious factor of 65782 is number of sp in 1bp, or 1bp/1pt * 65536. +%% 1pt - printer point 1/72.27" +%% 1bp - ps point aka bigpoint 1/72" +%% 65536 - a number of TeX's scaled points (sp) in 1pt. +%% +%% The other solution is to use temporary registers for dividing all +%% dimensions by 1bp, but who would want to do that? + + +%---------------------------------------------------------------------------- +\newbox\graybox +\newdimen\xgrayspace +\newdimen\ygrayspace +%---------------------------------------------------------------------------- +% +% The following \TeX code was based on previous work by +% +% Je'ro^me Maillot, maillot@bora.inria.fr +% +%---------------------------------------------------------------------------- +% +% Use the following for one or more words within a line. +% +\def\textshade#1#2{% + \xgrayspace=4pt% + \ygrayspace=4pt% + \def\grayshade{0.95}% + \def\linewidth{1}% + \def\theradius{5}% + \setbox\graybox=\hbox{\surroundboxa{#2}}% + \hbox{% + \hbox to 0pt{% + \special{"gsave newpath 0 0 moveto % + 0 1 copy /xmin exch store % + \number\dp\graybox \space -65782 div 1 copy /ymin exch store % + \number\wd\graybox \space 65782 div 1 copy /xmax exch store % + \number\ht\graybox \space 65782 div 1 copy /ymax exch store % + \theradius\space /radius exch store + \linewidth\space /linewidth exch store + \grayshade\space /grayshade exch store + #1 grestore}}% + \box\graybox}}% +% +% Use the following for paragraphs. +% +\def\parashade#1#2{% + \xgrayspace=10pt% + \ygrayspace=10pt% + \def\grayshade{0.95}% + \def\linewidth{2}% + \def\theradius{10}% + \def\thevskip{15pt}% + \setbox\graybox=\hbox{\surroundboxb{#2}}% + \vskip\thevskip + \hbox{% + \hbox to 0pt{% + \special{"gsave newpath 0 0 moveto % + 0 1 copy /xmin exch store % + \number\dp\graybox \space -65782 div 1 copy /ymin exch store % + \number\wd\graybox \space 65782 div 1 copy /xmax exch store % + \number\ht\graybox \space 65782 div 1 copy /ymax exch store % + \theradius\space /radius exch store + \linewidth\space /linewidth exch store + \grayshade\space /grayshade exch store + #1 grestore}}% + \box\graybox}% + \vskip\thevskip% +}% +%---------------------------------------------------------------------------- +% +% A pair of box macros. Each builds a slightly oversized box +% containing the text. The text is centred both in the vertical +% horizontal directions. +% +% Use the following for one or more words within a line. +% +\long\def\surroundboxa#1{\leavevmode\hbox{\vtop{% +\vbox{\kern\ygrayspace% +\hbox{\kern\xgrayspace#1% + \kern\xgrayspace}}\kern\ygrayspace}}} +% +% Use the following for a paragraphs. +% +\long\def\surroundboxb#1{\leavevmode\hbox{\vtop{% +\vbox{\kern\ygrayspace% +\hbox{\kern\xgrayspace\vbox{\advance\hsize-2\xgrayspace#1}% + \kern\xgrayspace}}\kern\ygrayspace}}} +%---------------------------------------------------------------------------- +% +% Here are some simple PostScript routines. +% +% The TeX command \PScommands must be called before any of the +% shading routines can be used. +% +\long\def\PScommands{\special{! TeXDict begin +% +/sharpbox{% + newpath + xmin ymin moveto + xmin ymax lineto + xmax ymax lineto + xmax ymin lineto + xmin ymin lineto + closepath + }bind def +% +/roundbox{% + newpath + xmin radius add ymin moveto + xmax ymin xmax ymax radius arcto + xmax ymax xmin ymax radius arcto + xmin ymax xmin ymin radius arcto + xmin ymin xmax ymin radius arcto 16 {pop} repeat + closepath + }bind def +% +/sharpcorners{% + sharpbox gsave grayshade setgray fill grestore + linewidth setlinewidth stroke + }bind def +% +/plainbox{% + sharpbox grayshade setgray fill + }bind def +% +/roundcorners{% + roundbox gsave grayshade setgray fill grestore + linewidth setlinewidth stroke + }bind def +% +end}% Closes dictionnary +}% + +\PScommands + +This is a test of a\ \textshade{roundcorners}{shaded box} routine. +% +This is another test of a\ \textshade{sharpcorners}{shaded box} routine + +\parashade{roundcorners}{% +This is one very long line which I expect will be broken over one or more +lines. The idea is to have this paragraph enclosed in a shaded box. I'll +just keep on typing until I can be sure that there are more than two lines +in this paragraph. I expect that this should be well and truely sufficient +to test this macro. +} +\parashade{sharpcorners}{% +This is one very long line which I expect will be broken over one or more +lines. The idea is to have this paragraph enclosed in a shaded box. I'll +just keep on typing until I can be sure that there are more than two lines +in this paragraph. I expect that this should be well and truely sufficient +to test this macro. +} + +The field equations of General Relativity are\ % +% +\textshade{roundcorners}{\hbox{$G_{\mu\nu} = kT_{\mu\nu}$}} + +They can also be written as + +\parashade{sharpcorners}{$$R_{\mu\nu}-{1\over2}g_{\mu\nu}R = kT_{\mu\nu}$$} + +\bye diff --git a/Master/texmf-dist/tex/generic/genmisc/swrule.sty b/Master/texmf-dist/tex/generic/genmisc/swrule.sty new file mode 100644 index 00000000000..1632cf3c9d4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/swrule.sty @@ -0,0 +1,89 @@ +% swrule.sty +% Written by Tobias G. Dussa <tdussa@sdhs.de> +% 09oct01 +% Copyright (C) by Tobias G. Dussa <tdussa@sdhs.de> +% +% Provides two macros to create english lines a.k.a. swelled rules (i.e. +% lines % that become thicker towards the middle, much like a very +% far-stretched diamond) that only use plain tex means. +% +% The macros provided are +% - \swrule{length}{maximum width} +% - \swrulex{length}{minimum width}{maximum width} +% +% The \swrule macro is just a shortcut for \swrulex{length}{0pt}{max width}. +% +% The minimum width is the width of the line at the far left and +% right ends, while the maximum width is the width of the line in +% the very middle. +% +% The english line is made up of many short lines of different widths. +% The counter variable \swrulecount specifies how many small line pieces +% should be used to approximate the english line. It is set to 50 by +% default. The larger this value is, the finer-grained the resulting +% english line will be, so that the steps will not be as obvious. +% The \swrulecount variable should never be set to one, as a division +% by zero would occur. Likewise, any value smaller than 1 is pointless, +% albeit possible. +% +% The style package is a quick hack. If any error should occur, then +% I would greatly appreciate learning about it. +% Likewise, any suggestion is appreciated. +% +% The style package is copyrighted but may be used and extended in +% any way, as long as a pointer to the original author is maintained. +% The author is not liable for any problem that may or may not result +% from using this package. Use at your own risk. +% +% Enjoy. + +\newcount\swrulecount +\newcount\swrulestep +\newdimen\swrulemin +\newdimen\swrulemax +\newdimen\swrulelength +\newdimen\swruleraise +\newdimen\swrulewidth +\newdimen\swruledelta +\newdimen\swrulepiece + +\swrulecount=50 + +\def\swrulex#1#2#3{% +\swrulestep=\swrulecount% +\advance\swrulestep by -1% +\swrulelength=#1% +\swrulemin=#2% +\swrulemax=#3% +\swrulewidth=\swrulemin% +\swruleraise=\swrulemax% +\advance\swruleraise by -\swrulemin% +\divide\swruleraise by 2% +\swruledelta=\swrulemax% +\advance\swruledelta by -\swrulemin% +\divide\swruledelta by \swrulestep% +\multiply\swrulestep by 2\advance\swrulestep by 1% +\swrulepiece=\swrulelength% +\divide\swrulepiece by \swrulestep% +\swrulestep=1% +\hbox{% +\loop% +\raise\swruleraise\hbox{\rule{\swrulepiece}{\swrulewidth}}% +\ifnum\swrulestep<\swrulecount% +\advance\swrulestep by 1% +\advance\swruleraise by -\swruledelta% +\advance\swrulewidth by 2\swruledelta% +\repeat% +\advance\swrulestep by -1% +\advance\swruleraise by \swruledelta% +\advance\swrulewidth by -2\swruledelta% +\loop% +\raise\swruleraise\hbox{\rule{\swrulepiece}{\swrulewidth}}% +\ifnum\swrulestep>1% +\advance\swrulestep by -1% +\advance\swruleraise by \swruledelta% +\advance\swrulewidth by -2\swruledelta% +\repeat% +}} + +\def\swrule#1#2{\swrulex{#1}{0pt}{#2}} diff --git a/Master/texmf-dist/tex/generic/genmisc/tabto.tex b/Master/texmf-dist/tex/generic/genmisc/tabto.tex new file mode 100644 index 00000000000..df10685747e --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/tabto.tex @@ -0,0 +1,35 @@ +%-------------- tabto.tex ------------ +% Tab to a position relative to the left margin in a paragraph: +% some text \tabto{1in} more text, and \tabto 3in final text. +% If the text on the line already goes past the desired position, +% the tab starts a new line. +% Note that braces are allowed, but not required. +% +% Donald Arseneau (asnd@reg.triumf.ca, asnd@triumfcl (bitnet)) + +\newdimen \scratchdim % or use \@tempdima in LaTeX +\newdimen \scratchDIM % or use \@tempdimb in LaTeX + +% this preliminary mess is just TeX's awful way of reading a parameter +% with or without braces. + +\def\tabto{\futurelet\nExt\tabtO} +\def\tabtO{\ifx\nExt\bgroup\let\nExt\TabTo\else\let\nExt\tabtOO\fi\nExt} +\def\tabtOO{\afterassignment\tabTOO\scratchDIM } +\def\tabTOO{\TabTo\scratchDIM} + +\def\TabTo#1{\begingroup\leavevmode +\ifinner\scratchdim=0pt\relax % in a \hbox, so ignore +\else % unrestricted horizontal mode + \parfillskip=0pt plus 1fill % must swamp the -1fil glue + \hfil\null\penalty20 \hskip0ptplus-1fil + \hbox{\mathstrut\kern\hsize\kern-#1}\vadjust{\nobreak}\par + \scratchdim=\prevdepth + \prevdepth=-999pt % make sure I get an exact \baselineskip + \parskip=-999pt % but cancel the extra space + \advance\parskip-\baselineskip % cancel the \baselineskip + \advance\parskip-\scratchdim + \noindent +\fi \hbox to#1{\vrule depth\scratchdim width0pt\hss}\endgroup +\ignorespaces} + diff --git a/Master/texmf-dist/tex/generic/genmisc/time.sty b/Master/texmf-dist/tex/generic/genmisc/time.sty new file mode 100644 index 00000000000..e1b86ce46d5 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/time.sty @@ -0,0 +1,30 @@ +%%% Save file as: TIME.STY (TIME.TEX) Source: FILESERV@SHSU.BITNET +%%% Author: Sunando Sen <sens@nyuacf.bitnet> <sens@acfcluster.nyu.edu> +%%% Source: INFO-TeX@SHSU.edu, Mon, 6 Jan 1992 23:14 EST +%%% Purpose: The command \now produces the current time in hh:mm A.M./P.M. +%%% format; similar to \today +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%% Macro to write the current time %%%%%%%%%%%%%%%%%%% +% \now produces the current time, e.g., 11:15 A.M. % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcount\hour \newcount\minute +\hour=\time \divide \hour by 60 +\minute=\time + +\count99=\hour \multiply \count99 by -60 \advance \minute by \count99 + +\def\now{% +\ifnum \hour<13 + \ifnum \hour=0 \advance \hour by 12 \number\hour:\else \number\hour:\fi% + \ifnum \minute<10 0\fi% + \number\minute% +\ A.M.% +\else \advance \hour by -12 \number\hour:% + \ifnum \minute<10 0\fi% + \number\minute% + \ P.M.% +\fi% +} + +\endinput diff --git a/Master/texmf-dist/tex/generic/genmisc/underlin.tex b/Master/texmf-dist/tex/generic/genmisc/underlin.tex new file mode 100644 index 00000000000..eec6aaa129c --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/underlin.tex @@ -0,0 +1,18 @@ +% underlin.tex - real multi-word underlining +% By Stephen Gildea <gildea@x.org> January 1995. + +% Usage: \textul{text to underline} + +\def\textul#1{\leavevmode\let\textulnext=\textuli\textuli#1 & } +\def\textuli#1 {\ifx\unskip\let\textulnext=\relax\else + \textulword{#1}\textulspace\fi \textulnext} +\newskip\textulspskip %saved size of a space +\def\textulword#1{% + \setbox0\hbox{#1\space\global\textulspskip=\the\lastskip\unskip}% + \dimen0=\dp0\dp0=1.2pt + \setbox0\vtop{\box0\hrule}\ifdim\dp0<\dimen0\dp0=\dimen0\fi \box0} +\def\textulspace{\leaders\hrule height -1.2pt depth 1.6pt + \hskip\textulspskip} + +% For a much fancier version with many options (e.g., strikeout), +% see ulem.sty in the CTAN archive. diff --git a/Master/texmf-dist/tex/generic/genmisc/undertilde.tex b/Master/texmf-dist/tex/generic/genmisc/undertilde.tex new file mode 100644 index 00000000000..a586f5554b9 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/undertilde.tex @@ -0,0 +1,3 @@ +\def\undertilde#1{\mathord{\vtop{\ialign{##\crcr + $\hfil\displaystyle{#1}\hfil$\crcr\noalign{\kern1.5pt\nointerlineskip} + $\hfil\tilde{}\hfil$\crcr\noalign{\kern1.5pt}}}}} diff --git a/Master/texmf-dist/tex/generic/genmisc/verbatim.tex b/Master/texmf-dist/tex/generic/genmisc/verbatim.tex new file mode 100644 index 00000000000..11d684db6f3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/verbatim.tex @@ -0,0 +1,258 @@ +\catcode `\@ = 11 %%% we use commercial-at as a letter throughout; +\chardef \l@tter = 11 %%% and introduce synonyms for the \catcodes for +\chardef \@ther = 12 %%% <letter> and <other>; +\newcount \c@unt %%% a loop-counter; +\newcount \ch@rcode %%% this will hold the character-code of the + %%% escape character; +\newif \ifd@bugging %%% set <true> if you want to watch the + %%% finite-state automaton at work; +\newif \ifshewleadingspaces %%% set <true> if you want to see leading spaces + %%% shewn as inverted square cup (explicit); +\newif \ifshewembeddedspaces %%% set <false> if you want to see embedded +\shewembeddedspacestrue %%% spaces shewn as white space (implicit); +\ifd@bugging %%% if <debugging>, + \let \m@ssage = \message %%% \m@ssage is synonymous with \message +\else %%% otherwise + \def \m@ssage #1{}% %%% it simply throws its parameter away; +\fi +% +\def \verbatim %%% the \verbatim macro takes no parameter + {\begingroup %%% and immediately starts a nested group + \tracingonline = 0 + \def \n@sted %%% within which \n@sted is defined + {\begingroup %%% to start a further group within which + \let \n@sted %%% \n@sted becomes a synonym for \endgroup + = \endgroup + \@nvironment %%% and the environment is restored to that + %%% which obtained two levels of nesting out; + \ignorespaces %%% for tidyness, we ignore any <lwsp> + }% %%% which follows the escape character; + \edef \@nvironment %%% we initialise \@nvironment + {\the \font %%% who forgot this ????? + \parindent = %%% to prepare to restore \parindent + \the \parindent + \parskip = %%% and \parskip; + \the \parskip + \space %%% and ensure that the value to be assigned to + }% %%% \parskip is properly terminated; + \displayverbatimfont %%% we assume Knuth's font-selectors and + %%% select the `typewriter' font; + \parskip = 0 pt %%% we then set \parindent and + \parindent = 0 pt %%% \parskip to 0 pt; + \c@unt = 0 %%% and initialise \count to 0; + \loop %%% this loop checks the \catcode of each + %%% character code in the range 0 .. 127 + %%% (or 0 .. 255 for TeX V3) and if it + %%% is other than <letter> or <other>, as + %%% appropriate, saves the current value in + %%% \@nvironment for subsequent restoration + %%% within an inner group; it then sets the + %%% \catcode to either <letter> or <other>; + \ifnum \c@unt < `\A + \s@ve \catcode \c@unt = \@ther + \else \ifnum \c@unt > `\z + \s@ve \catcode \c@unt = \@ther + \else \ifnum \c@unt > `\Z + \ifnum \c@unt < `\a + \s@ve \catcode \c@unt = \@ther + \else \s@ve \catcode \c@unt = \l@tter + \fi + \else \s@ve \catcode \c@unt = \l@tter + \fi + \fi + \fi + \advance \c@unt by 1 + \ifnum \c@unt < 256 % or 128 for the V2 sites ... + \repeat + \v@rbatim + } +% +\def \v@rbatim #1% %%% + {\if #1 %%% + \let \n@xt = \v@rb@tim %%% + \else %%% + \def \n@xt %%% + {\v@rb@tim #1}% %%% + \fi %%% + \n@xt %%% + } %%% +% +\def \v@rb@tim #1% + {\ch@rcode = `#1 %%% + \edef \@nvironment %%% and append code to \@nvironment + {\@nvironment %%% to make the escape character active; + \catcode \the \ch@rcode + = \active + \space %%% <space> separates list items in \@nvironment + }% + \catcode \ch@rcode %%% the escape character is made active; + = \active + \uccode `\^^M = \ch@rcode %%% and the upper-case code of <return> is made + %%% equal to the character-code of the escape + %%% character; this is necessary because only + %%% <return> can be guaranteed to be active at + %%% this point, and we need an active character + %%% to form the primary operand of \def; + %%% the \@x's below are \expandafter's, + %%% and the effect is to upper-case <return> + %%% (yielding the escape character), then \def + %%% (an active instance of) this character as + %%% \n@sted, which has been defined above; +% + \@x \uppercase \@x {\@x \def \r@turn {\n@sted}}% +% + \uccode `\^^M = 0 %%% the upper-case code of <return> is then re- + %%% instated (not strictly true; it is set to 0, + %%% which is assumed to be its previous value + %%% --- could be improved here); + \@ctivecr %%% <return> is made active; + \@ctivespace %%% and so is <space> (to avoid space-elision); + %%% finally, the finite-state automaton which + }% %%% processes <space>s is set to <????>; + %%% this ends the definition of \verbatim. +% +\def \s@ve #1#2=#3% %%% \s@ve minimises the \catcode restoration + {\ifnum #1#2 = #3% %%% work of \@nvironment by saving only the + %%% \catcode of characters whose \catcode + %%% is to be changed; it then changes the + %%% \catcode of those characters. + \else \edef \@nvironment + {\@nvironment #1\the #2=\the #1#2 }% + #1#2 = #3% + \fi + }% + %%% the code which follows implements the finite + %%% state automaton which determines whether + %%% <space>s are ignored, shewn explicitly or + %%% implied, and which ensures that blank + %%% lines are reproduced correctly. +% +\def \v@id {\futurelet \n@xt \v@idifspace}% +\def \l@ad {\l@adingspace \futurelet \n@xt \l@adifspace}% +\def \sk@p {\vskip \baselineskip \futurelet \n@xt \l@adifspace}% +\def \emb@d {\emb@ddedspace}% +\def \sh@wspace {\char 32\relax}% +\def \h@despace {\leavevmode \kern \fontdimen 2 \font}% +\def \l@adingspace {\ifshewleadingspaces \sh@wspace \else \h@despace \fi}% +\def \emb@ddedspace {\ifshewembeddedspaces \sh@wspace \else \h@despace \fi}% +\def \v@idifspace {\testn@xt {\afterassignment \v@id}}% +\def \l@adifspace {\testn@xt {\afterassignment \sk@p}}% +% + %%% \testn@xt provides a common look-ahead for + %%% \v@idifspace and \l@adifspace, and also +\def \testn@xt #1% %%% implements some essential debugging hooks. + {\ifx \n@xt \sp@c@ + \m@ssage {Next character is a space}% + \let \n@xt = \relax + \else \ifx \n@xt \r@t@rn + \m@ssage {Next character is a return}% + \def \n@xt {#1\let \n@xt = }% + \else \m@ssage {Next character is \meaning \n@xt}% + \let \n@xt = \relax + \@x \let \sp@ce = \emb@d + \fi + \fi + \n@xt + }% +% + %%% We next tamper with the \catcode of <space> + %%% and <return>, while defining macros and + %%% synonyms which require them to be active; + %%% the \catcode is then restored to its default + %%% (not necessarily the previous value --- + %%% could be improved). \@ctivespace makes + %%% <space> active, then defines <space> as +\catcode `\ = \active% %%% \v@id with a synonym \sp@c@. This code is +\def\sp@ce{ }% %%% used by the finite-state automaton. +\def\@ctivespace% +{\catcode`\ =\active\def {\v@id}\let\sp@c@= }\catcode`\ =10\relax% +\catcode`\ =10\relax% +% +\catcode `\^^M = \active % %%% <return> is made active; +\def \r@turn {^^M}% %%% \r@turn defined as an active <return>; +\let \r@t@rn = ^^M% %%% \r@t@rn is made a synonym; +\def \@ctivecr % %%% and \@ctivecr is defined to + {\catcode `\^^M = \active % %%% make <return> active, then + \def ^^M% %%% define <return> to manipulate the + %%% finite-state automaton and ... + {\@x \def \sp@ce {\l@ad}% + \@x \let \@x \sp@c@ \@x =\sp@ce % +% + \endgraf % %%% insert a \par primitive (for blank lines). +% + \futurelet \n@xt \l@adifspace % + }% + \let \r@t@rn = ^^M% %%% \r@t@rn is synonymous with active <return> + }% +\catcode `\^^M = 5 % %%% finally, the \catcode of <return> is + %%% restored to its normal value; +% + %%% the \AfterGroup macro is intended for + %%% use within a nested normal environment, + %%% and causes (a concealed macro defined as) + %%% its parameter text to be inserted into + %%% TeX's input stream when the nested normal + %%% group terminates. +% +\def \AfterGroup #1{\global \def \@ftergroup {#1}\aftergroup \@ftergroup}% +% +\let \@x = \expandafter %%% \@x is a brief synonym for \expandafter; +% +% +\def \mitabrev %%% and \mitabrev defined as the closure for + {\endgroup \endgroup}% %%% \verbatim; any other name could be used, + %%% as the code performs no look-ahead for + %%% any particular string. +% + %%% Finally we announce to the world that we + %%% have been loaded, and gives some clues as + %%% to the usage. +% + +\catcode `\Ý = \active +\catcode `\| = \active + +\def Ý{\begingroup + \def \s@lidus ##1Ý{\inlineverbatimfont ##1\endgroup}% + \p@ssivate \activesp@ces \s@lidus + } + +\def |{\begingroup + + \def \s@lidus ##1|{\inlineverbatimfont ##1\endgroup}% + \p@ssivate \activesp@ces \s@lidus + } + +\def \p@ssivate + {\tracingonline = 0 + \c@unt = 0 + \loop + \ifnum \catcode \c@unt = 11 {}% + \else \ifnum \catcode \c@unt = 12 {}% + \else \catcode \c@unt = 12 + \fi + \fi + \ifnum + \c@unt < 255 + \advance \c@unt by 1 + \repeat + \catcode `\Ý = \active + \catcode `\| = \active + } + +\begingroup +\catcode `\ = \active\gdef\activesp@ce{\def {\phantom{\char`\ }}}% +\endgroup + +\def \activesp@ces {\catcode `\ = \active \activesp@ce} + +\catcode `\@ = \@ther %%% commercial-at is restored to its normal + %%% <other> catcode (not necessarily the + %%% previous value --- could be improved); + +\message {Verbatim environment loaded;}% +\message {usage: ``\noexpand \verbatim <char> ... <char> \noexpand \mitabrev''}% +\message {less functional short forms: \string Ý...\string Ý & + \string |...\string |}% + +%%% ======================================================================== %%% diff --git a/Master/texmf-dist/tex/generic/genmisc/weekday.sty b/Master/texmf-dist/tex/generic/genmisc/weekday.sty new file mode 100644 index 00000000000..cda185ad31b --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/weekday.sty @@ -0,0 +1,74 @@ +% Save file as: WEEKDAY.STY Source: FILESERV@SHSU.BITNET +%% WEEKDAY.STY -- original source: Dimitri Vulis <DLV@CUNYVMS1.BITNET> with +%% modifications by George D. Greenwade <BED_GDG@SHSU.BITNET>, and gracious +%% assistance from Bernhard Schroeder <UPK002@DBNRHRZ1.BITNET>, Hunter +%% Goatley <GOATHUNTER@WKUVX1.BITNET>, and others via INFO-TeX/comp.text.tex. +%% 21-FEB-1991 17:42:37 +%% +%% Usage: \weekday{yyyy}{mm}{dd} (where "yyyy" is a year, "mm" is the numeric +%% equilavent of the month, and "dd" is the specific calendar date +%% which may be one or two numbers) yields the weekday associated with +%% the date provided (i.e., Sunday, Monday, ...). May pass \year, +%% \month, and \day to generate today's weekday. +%% +%% -- \weekdaydate{yyyy}{mm}{dd} yields result of \weekday, as well as the +%% calendar date (i.e., \weekdaydate{1991}{02}{21} yields Thursday, +%% February 21, 1991). (NOTE: syntax is changed from \weekdaydisplay +%% to \weekdaydate to make it a little more rememberable) +%% +%% May be used as a TeX macro or as a LaTeX style, from what I can tell. +%% Please report any enhancements or bugs you come across so they can be +%% posted in FILESERV's STYle archives. George <BED_GDG@SHSU.BITNET> +%% +\newcount\wwwy +\newcount\wwwm +\newcount\wwwd +\newcount\wwwc +\newcount\wwwt +\newcount\wwws + +\def\weekday@{% +\wwwc=\wwwy +\divide\wwwc100\relax +\wwwt=-\wwwc +\multiply\wwwt100\relax +\advance\wwwy\wwwt +\wwws=\wwwy +\multiply\wwws1461\relax +\divide\wwws4\relax +\wwwt=\wwwm +\multiply\wwwt764\relax +\divide\wwwt25\relax +\advance\wwws\wwwt +\advance\wwws\wwwd +\ifnum\wwwm>\tw@\advance\wwws\thr@@\else\weekday@@\fi +\wwwt=-\wwws +\divide\wwwt7\relax +\multiply\wwwt7\relax +\advance\wwws\wwwt +} + +% By the year 2000 we ought to examine \wwwc as well + +\def\weekday@@{% +\wwwt=\wwwy +\divide\wwwt4\relax +\multiply\wwwt4\relax +\advance\wwwt-\wwwy +\ifnum\wwwt=\z@\advance\wwws4\else\advance\wwws5\fi +} + +\def\weekday#1#2#3{% year, month 1--12, day 1--31 +\wwwy=#1\relax\wwwm=#2\relax\wwwd=#3\relax \weekday@ +\ifcase\wwws Sunday\or + Monday\or Tuesday\or Wednesday\or Thursday\or Friday\or Saturday\fi} + +\def\weekdaydate#1#2#3{% year, month 1--12, day 1--31 +\wwwy=#1\relax\wwwm=#2\relax\wwwd=#3\relax\weekday@ +\ifcase\wwws Sunday,\or +Monday,\or Tuesday,\or Wednesday,\or Thursday,\or Friday,\or Saturday,\fi +\space +\ifcase #2\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 +\space\number#3, \space\number#1} % Here I (Bernhard) inserted \number diff --git a/Master/texmf-dist/tex/generic/genmisc/wiggly.tex b/Master/texmf-dist/tex/generic/genmisc/wiggly.tex new file mode 100644 index 00000000000..7f04760f34a --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/wiggly.tex @@ -0,0 +1,30 @@ +% A macro \underwiggle for drawing variable length wiggly lines horizontally +% under its argument in the same way as \underbar. +% Written by Dr. John S. Garavelli on 4 December 1987 and adapted from a routine +% by A. G. W. Cameron at Harvard University which appeared in TUGBOAT November +% 1985, vol. 6, no. 3, p. 155. +% WARNING: the computations performed by this macro can be very time consuming, +% so use it sparingly. + +\newcount\vone \newcount\vtwo \newcount\vthree \newcount\vfour \newcount\vfive +\newcount\vsix \newcount\vseven \newcount\veight \newcount\vnine \newcount\vten +\newbox\wbox \newdimen\wbsize +\def\underwiggle#1{\ifmmode\setbox\wbox=\hbox{$#1$} + \else\setbox\wbox=\hbox{#1}\fi +\dp\wbox=0pt\wbsize=\wd\wbox\lower2pt\hbox to0pt +{\hss$\vone=0\vtwo=0\vthree=7000\vfive=\vtwo +\loop +\vseven=\vone \divide\vseven by 2 +\vsix=\vfive \divide\vsix by 2 \multiply\vsix by -1 +\veight=16384 \advance\veight by \vsix +\vnine=16384 \advance\vnine by -\vsix +\vten=\vseven \advance\vten by 32768 +\hskip\vseven sp +\vrule height\veight sp width 32768 sp depth\vnine sp +\hskip-\vten sp +\ifdim\vseven sp<\wbsize \advance\vone by 20000 +\advance\vtwo by \vthree +\vfour=-\vtwo \divide\vfour by 10 +\advance\vthree by \vfour +\advance\vfive by \vtwo +\repeat$}\box\wbox} diff --git a/Master/texmf-dist/tex/generic/genmisc/zip.tex b/Master/texmf-dist/tex/generic/genmisc/zip.tex new file mode 100644 index 00000000000..c1139b3cc41 --- /dev/null +++ b/Master/texmf-dist/tex/generic/genmisc/zip.tex @@ -0,0 +1,88 @@ +% zip.tex +% +% J. Daniel Smith +% 24 May 1990 +% +% Modified from a STY file snarfed from someplace else. But I don't +% remember where the original code came from... OOPS!!! +% +% Make a barcode for a ZIP code! +% +% Example usage is below. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\catcode`@=11 % letter +% +% Dimensions of bars to be used in the barcode +\newdimen\b@rwidth \newdimen\b@rlong \newdimen\b@rshort \newdimen\b@rsep +\b@rwidth=0.02true in \b@rlong=0.125true in \b@rshort=0.05true in +\b@rsep=0.0275true in +\def\sb@r{\vrule height\b@rshort width\b@rwidth depth0pt \kern\b@rsep} +\def\lb@r{\vrule height\b@rlong width\b@rwidth depth0pt \kern\b@rsep} + +% The barcodes for each digit +\def\zerob@r{\lb@r\lb@r\sb@r\sb@r\sb@r} +\def\oneb@r{\sb@r\sb@r\sb@r\lb@r\lb@r} +\def\twob@r{\sb@r\sb@r\lb@r\sb@r\lb@r} +\def\threeb@r{\sb@r\sb@r\lb@r\lb@r\sb@r} +\def\fourb@r{\sb@r\lb@r\sb@r\sb@r\lb@r} +\def\fiveb@r{\sb@r\lb@r\sb@r\lb@r\sb@r} +\def\sixb@r{\sb@r\lb@r\lb@r\sb@r\sb@r} +\def\sevenb@r{\lb@r\sb@r\sb@r\sb@r\lb@r} +\def\eightb@r{\lb@r\sb@r\sb@r\lb@r\sb@r} +\def\nineb@r{\lb@r\sb@r\lb@r\sb@r\sb@r} + +\newcount\zipb@rm +\newcount\zipb@rn +\chardef\ten=10 + +%Almost like using \ifcase... except `-' is ignored. +\def\zipb@r@@@#1#2{\expandafter\def\csname zipb@r@@#1\endcsname% + {#2\advance\zipb@rn#1\relax}} + +\newbox\zipbarcode +\zipb@r@@@0{\global\setbox\zipbarcode\hbox{\box\zipbarcode\zerob@r}} +\zipb@r@@@1{\global\setbox\zipbarcode\hbox{\box\zipbarcode\oneb@r}} +\zipb@r@@@2{\global\setbox\zipbarcode\hbox{\box\zipbarcode\twob@r}} +\zipb@r@@@3{\global\setbox\zipbarcode\hbox{\box\zipbarcode\threeb@r}} +\zipb@r@@@4{\global\setbox\zipbarcode\hbox{\box\zipbarcode\fourb@r}} +\zipb@r@@@5{\global\setbox\zipbarcode\hbox{\box\zipbarcode\fiveb@r}} +\zipb@r@@@6{\global\setbox\zipbarcode\hbox{\box\zipbarcode\sixb@r}} +\zipb@r@@@7{\global\setbox\zipbarcode\hbox{\box\zipbarcode\sevenb@r}} +\zipb@r@@@8{\global\setbox\zipbarcode\hbox{\box\zipbarcode\eightb@r}} +\zipb@r@@@9{\global\setbox\zipbarcode\hbox{\box\zipbarcode\nineb@r}} + +\def\zipb@r@@#1{\csname zipb@r@@#1\endcsname} + +\def\zipb@r@#1{\ifx#1\null + \let\next\relax + \else + \zipb@r@@{#1}#1% + \let\next\zipb@r@ + \fi + \next} + +\def\zipbar#1{\setbox\zipbarcode=\null + \hbox{ % put numbers in an \hbox + \global\setbox\zipbarcode\hbox{\box\zipbarcode\lb@r} % start with long bar + \zipb@rn\z@\zipb@r@#1\null + \zipb@rm\zipb@rn \divide\zipb@rm\ten \multiply\zipb@rm\ten + \advance\zipb@rm-\zipb@rn + \ifnum\zipb@rm<0 + \advance\zipb@rm\ten + \fi + \zipb@r@@{\the\zipb@rm} % last digit, so that the sum is divisible by ten + \global\setbox\zipbarcode\hbox{\box\zipbarcode\lb@r}% end with a long bar + } % end of \hbox +} + +\catcode`@=12 % disable private sequences +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\zipbar{1234567890} +% +%\zipbar{48837} +% +%\zipbar{78653--0102} +%\bye +\endinput |