| 1 |
%% BEGIN tvz-hax.sty |
| 2 |
%% 93/04/01 |
| 3 |
%% Tim Van Zandt [email protected] |
| 4 |
%% |
| 5 |
%% These are some lousy hacks for typesetting the code |
| 6 |
%% and User's Guide in the Seminar and PSTricks packages. |
| 7 |
%% |
| 8 |
%% This file may be distributed and/or modified under the conditions of |
| 9 |
%% the LaTeX Project Public License, either version 1.2 of this license |
| 10 |
%% or (at your option) any later version. The latest version of this |
| 11 |
%% license is in: |
| 12 |
%% |
| 13 |
%% http://www.latex-project.org/lppl.txt |
| 14 |
%% |
| 15 |
%% and version 1.2 or later is part of all distributions of LaTeX version |
| 16 |
%% 1999/12/01 or later. |
| 17 |
%% |
| 18 |
|
| 19 |
|
| 20 |
%%%%%%%%%%%%%%%%%%%%%%%%%% PAPER SIZES %%%%%%%%%%%%%%%%%%%%%% |
| 21 |
|
| 22 |
% Default paper size is 8.5in by 11in. |
| 23 |
% Just include the `a4' style option for A4 paper size. |
| 24 |
% For other paper sizes, define \paperwidth and \paperheight |
| 25 |
% before the \documentstyle command. |
| 26 |
|
| 27 |
\@ifundefined{paperwidth}{\def\paperwidth{8.5in}}{} |
| 28 |
\@ifundefined{paperheight}{\def\paperheight{11in}}{} |
| 29 |
\@namedef{ds@a4}{\def\paperwidth{210mm}\def\paperheight{297mm}} |
| 30 |
|
| 31 |
|
| 32 |
%%%%%%%%%%%%%%%%%%%% INPUTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 33 |
|
| 34 |
\newif\iftwoup |
| 35 |
\@namedef{ds@2up}{\input 2up.tex \twouptrue} |
| 36 |
|
| 37 |
\input article.sty |
| 38 |
\input fancybox.sty % Version 0.93 or later. |
| 39 |
|
| 40 |
\iftwoup |
| 41 |
\if@twoside |
| 42 |
\targetlayout{twosided} |
| 43 |
\fi |
| 44 |
\fi |
| 45 |
|
| 46 |
\if@twoside |
| 47 |
\def\twosideclearpage{% |
| 48 |
\clearpage |
| 49 |
\ifodd\c@page\else |
| 50 |
\thispagestyle{empty}% |
| 51 |
\null\leavevmode |
| 52 |
\clearpage |
| 53 |
\fi} |
| 54 |
\else |
| 55 |
\let\twosideclearpage\clearpage |
| 56 |
\fi |
| 57 |
|
| 58 |
|
| 59 |
%%%%%%%%%%%%%%%%%%%%% MISC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 60 |
|
| 61 |
\def\arraystretch{1.2} |
| 62 |
|
| 63 |
\hfuzz 1pt |
| 64 |
|
| 65 |
% Just in case I'm using AmS-LaTeX. |
| 66 |
\def\makeatother{\catcode`\@=12\relax} |
| 67 |
|
| 68 |
|
| 69 |
%%%%%%%%%%%%%%%%%%%%%%%%%% SHORT META %%%%%%%%%%%%%%%%%%%%%%%% |
| 70 |
|
| 71 |
% Works in verbatim environments, unless specially designed. |
| 72 |
\begingroup |
| 73 |
\catcode`\<=\active |
| 74 |
\gdef\ShortMeta{% |
| 75 |
\catcode`\<=\active |
| 76 |
\def<##1>{{\MetaFont ##1\/}}} |
| 77 |
\endgroup |
| 78 |
\def\DeleteShortMeta{\catcode`\<=12\relax} |
| 79 |
\def\MetaFont{\sl} % For meta arguments. |
| 80 |
|
| 81 |
%%%%%%%%%%%%%%%%%%%%%%%%%% FILE VERSIONS %%%%%%%%%%%%%%%%%%%%% |
| 82 |
|
| 83 |
% \GetVersion{file} scans first ten lines of <file> for |
| 84 |
% \filedate and \fileversion definitions. |
| 85 |
% |
| 86 |
% \CheckVersion{file} scans <scans> file for \filedate and \fileversion |
| 87 |
% and then compares these witha \FileDate and \FileVersion. |
| 88 |
% |
| 89 |
\def\GetVersion#1{% |
| 90 |
\immediate\openin1=#1 |
| 91 |
\count@=0 |
| 92 |
\let\fileversion\relax |
| 93 |
\let\filedate\relax |
| 94 |
\@testtrue |
| 95 |
\loop |
| 96 |
\if@test |
| 97 |
\advance\count@1 |
| 98 |
\immediate\read1 to \@tempa |
| 99 |
\@tempa |
| 100 |
\ifnum\count@=10 |
| 101 |
\@latexerr{Couldn't find fileversion}\@eha |
| 102 |
\@testfalse |
| 103 |
\else |
| 104 |
\ifx\fileversion\relax |
| 105 |
\@testtrue |
| 106 |
\else |
| 107 |
\ifx\filedate\relax |
| 108 |
\@testtrue |
| 109 |
\else |
| 110 |
\@testfalse |
| 111 |
\fi |
| 112 |
\fi |
| 113 |
\fi |
| 114 |
\repeat} |
| 115 |
|
| 116 |
\def\CheckVersion#1{% |
| 117 |
\GetVersion{#1} |
| 118 |
\ifx\FileVersion\fileversion |
| 119 |
\ifx\FileDate\filedate\else |
| 120 |
\@latexerr{Doc date (\FileDate) and file date (\filedate) |
| 121 |
do not match}\@eha |
| 122 |
\fi |
| 123 |
\else |
| 124 |
\@latexerr{Doc version (\FileVersion) and file version (\fileversion) |
| 125 |
do not match}\@eha |
| 126 |
\fi} |
| 127 |
|
| 128 |
% This expands the date, as defined in \filedate. |
| 129 |
|
| 130 |
\def\expanddate#1/#2/#3/{% |
| 131 |
\number#3{} |
| 132 |
\month=#2 |
| 133 |
\ifcase\month\or |
| 134 |
January \or February \or March \or April \or May \or June \or |
| 135 |
July \or August \or September \or October \or November \or December |
| 136 |
\fi |
| 137 |
19#1} |
| 138 |
\def\thefiledate{\expandafter\expanddate\filedate/} |
| 139 |
\date{\thefiledate} |
| 140 |
|
| 141 |
|
| 142 |
%%%%%%%%%%%%%%%%% LOGOS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 143 |
|
| 144 |
\def\AmS{{\protect\the\textfont\tw@ |
| 145 |
A\kern-.1667em\lower.5ex\hbox{M}\kern-.125em S}} |
| 146 |
|
| 147 |
\def\b@LaTeX{% |
| 148 |
\begingroup |
| 149 |
\csname reset@font\endcsname |
| 150 |
\rm\bf |
| 151 |
L\kern-.32em |
| 152 |
\raise.36ex\hbox{% |
| 153 |
\ifx\@currsize\Huge\LARGE\else |
| 154 |
\ifx\@currsize\huge\Large\else |
| 155 |
\ifx\@currsize\LARGE\large\else |
| 156 |
\ifx\@currsize\Large\normalsize\else |
| 157 |
\ifx\@currsize\large\small\else |
| 158 |
\ifx\@currsize\normalsize\footnotesize\else |
| 159 |
\ifx\@currsize\small\scriptsize\else |
| 160 |
\ifx\@currsize\footnotesize\scriptscriptsize |
| 161 |
\fi\fi\fi\fi\fi\fi\fi\fi |
| 162 |
\bf A}% |
| 163 |
\kern-.15em |
| 164 |
T\kern-.1667em |
| 165 |
\lower.7ex\hbox{E}\kern-.125em |
| 166 |
X% |
| 167 |
\endgroup} |
| 168 |
\def\bLaTeX{\b@LaTeX} |
| 169 |
|
| 170 |
|
| 171 |
%%%%%%%%%%%%%%% PAGE STYLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 172 |
|
| 173 |
% The `docheadings' page style uses footers rather than headers. |
| 174 |
|
| 175 |
\def\ps@docheadings{% |
| 176 |
\let\@mkboth\markboth |
| 177 |
\def\@oddhead{}% |
| 178 |
\let\@evenhead\@oddhead% |
| 179 |
\def\@oddfoot{% |
| 180 |
\small\sf |
| 181 |
\rightmark |
| 182 |
\hfil |
| 183 |
\thepage}% |
| 184 |
\def\@evenfoot{% |
| 185 |
\small\sf |
| 186 |
\thepage |
| 187 |
\hfil |
| 188 |
\theheadertitle}% |
| 189 |
\def\sectionmark##1{\markright {##1}}}% |
| 190 |
\pagestyle{docheadings} |
| 191 |
|
| 192 |
|
| 193 |
%%%%%%%%%%%%%%%%%%%%%%%% Table of Contents %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 194 |
|
| 195 |
% Tighten up spacing in TOC: |
| 196 |
|
| 197 |
\newskip\tempskip |
| 198 |
\def\TOCshrink{.5} |
| 199 |
\def\TableOfContents{% |
| 200 |
\begin{quote} |
| 201 |
\begin{center} \Large\bf Contents \end{center} |
| 202 |
\def\numberline##1{\hbox to 0pt{\hss##1\hskip 1em}}% |
| 203 |
\let\oldaddvspace\addvspace |
| 204 |
\def\addvspace##1{% |
| 205 |
\tempskip##1\relax |
| 206 |
\oldaddvspace{\TOCshrink\tempskip}} |
| 207 |
\@starttoc{toc}% |
| 208 |
\end{quote}} |
| 209 |
\def\tableofcontents{% |
| 210 |
\clearpage |
| 211 |
\markright{Table of contents}% |
| 212 |
\TableOfContents |
| 213 |
\clearpage} |
| 214 |
|
| 215 |
|
| 216 |
%%%%%%%%%%%%%%%%%%%%%%%% code and examples %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 217 |
|
| 218 |
% `Ex' is an environment for putting samples of code. |
| 219 |
% It is a variant of |
| 220 |
% \begin{quote}\tt ... \end{quote}. |
| 221 |
% It is NOT verbatim. |
| 222 |
|
| 223 |
\def\NotNested{% |
| 224 |
\def\begin##1{% |
| 225 |
\@latexerr{Bad nesting of environments. |
| 226 |
Perhaps missing \end{\@currenvir}}\@eha |
| 227 |
\end{\@currenvir}% |
| 228 |
\begin{##1}}} |
| 229 |
|
| 230 |
\def\Ex{% |
| 231 |
\NotNested |
| 232 |
\list{}{}\item[]% |
| 233 |
\if@minipage\else\vskip\parskip\fi |
| 234 |
\leftskip\@totalleftmargin |
| 235 |
\rightskip\z@ |
| 236 |
\parindent\z@ |
| 237 |
\parskip\z@ |
| 238 |
\parfillskip\@flushglue |
| 239 |
\hfuzz 1pt |
| 240 |
\@@par |
| 241 |
\global\@inlabelfalse} |
| 242 |
\def\endEx{\endlist} |
| 243 |
|
| 244 |
% Various things to make it easier to write code and examples: |
| 245 |
|
| 246 |
\begingroup |
| 247 |
\catcode`\{=12 \catcode`\}=12 |
| 248 |
\catcode`\(=1 \catcode`\)=2 |
| 249 |
\catcode`\+=0 \catcode`\\=12 |
| 250 |
+gdef+|(\) % \| = character \ |
| 251 |
+gdef+{({) % \{ = character { |
| 252 |
+gdef+}(}) % \} = character } |
| 253 |
+endgroup |
| 254 |
\def\Backslash{\protect\|} |
| 255 |
|
| 256 |
% Define some functional font commands: |
| 257 |
|
| 258 |
\def\MainFont{\tt} % For macro definitions. |
| 259 |
\def\UsageFont{\tt} % For in-line macro names. |
| 260 |
\def\InlineFont{\tt} % For other in-line snipets of code. |
| 261 |
\def\DisplayFont{\tt} % For displayed code. |
| 262 |
|
| 263 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 264 |
|
| 265 |
\endinput |
| 266 |
%% END tvz-hax.sty |