summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/kluwer/klumac.sty
blob: 4678a7b09b16fd1a922c0b56cf8d985eced77438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
%
%<*other>
\ifcat a\noexpand @\let\next\relax\else \def\next{%
\documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
\NeedsTeXFormat{LaTeX2e}
\def\filedate{2000/04/29}
% \def\changes#1#2{}
% \changes{1999/11/08}{I by def instead of newcommand}
% \changes{1999/11/30}{reclassification of some math symbols}
% \changes{2000/02/15}{psamsfonts option for amssymb}
\def\filename{klumac.sty}
%\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi}
%\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname}
%\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\gdef,\@cla,\@clb}
%\DoNotIndex{\normalsize,\protect,\global,\setbox,\hbox,\vbox,\endinput}
%\DoNotIndex{\egroup,\endgroup,\bgroup,\begingroup,\let}
%\CodelineIndex
%\newcommand{\Bs}{$\backslash$}%
%\parindent=0pt
%\parskip=3pt
%\hfuzz=10pt
%\MakeShortVerb{\|}
%\addtolength{\textwidth}{4pc}
%\begin{document}
%\begin{opening}
%\title{\filename}
%\date{\filedate}
%\author{Kluwer Academic Publishers\surname{}}
%\institute{~}
%\begin{abstract}
% This internal stylefile defines some handy macros and exports the special 
% \AmSTeX\ fonts if available.
%\end{abstract}
%\end{opening}
%\tableofcontents
%\newpage\section{Usage}
%Here are tests for the macro commands used and defined in this file:   
%\def\mentry#1{$#1$ & \$\string #1\$ &}
%\def\tentry#1{#1 & \string #1 &} 
%
%\begin{tabular}{lllllllll}\hline
%$\I         $&\verb!$\I$!         &$\iduaal$     &\verb!$\iduaal$!     \\
%$\restrict  $&\verb!$\restrict$!  &$\diamond$    &\verb!$\diamond$!    \\
%$\depth     $&\verb!$\depth$!     &$\dom$        &\verb!$\dom$!        \\
%$\mapdown{a}$&\verb!$\mapdown{a}$!&$\dC$         &\verb!$\dC$!         \\
%$\dF        $&\verb!$\dF$!        &$\dP$         &\verb!$\dP$!         \\
%$\dZ        $&\verb!$\dZ$!        &$\dQ$         &\verb!$\dQ$!         \\
%$\gsim      $&\verb!$\gsim$!      &$\logr$       &\verb!$\logr$!       \\
%$\dres      $&\verb!$\dres$!      &\today        &\verb!\today!      \\
%$\forces    $&\verb!$\forces$!    &\.{a} & \verb!\.{a}! \\
%$\concat    $&\verb!$\concat$!    &$\lh$         &\verb!$\lh$!         \\  
%$\range     $&\verb!$\range$!     &$\mapright{a}$&\verb!$\mapright{a}$!\\
%$\dL        $&\verb!$\dL$!        &$\dE$         &\verb!$\dE$!\\
%$\dN        $&\verb!$\dN$!        &$\dR$         &\verb!$\dR$!\\
%$\nequiv    $&\verb!$\nequiv$!    &$\lsim$       &\verb!$\lsim$!\\  
%$\grlo      $&\verb!$\grlo$!      &$\oast$       &\verb!$\oast$!   \\
%$\res$       &\verb!$\res$!       &$\dres$        &\verb!$\dres$!  \\
%$\bigo{a}$   &\verb!$\bigo{a}$!   &$\Res{a}$       &\verb!$\Res{a}$!\\ 
%$\down{a}$   &\verb!$\down{a}$!   &\timenow      &\verb!\timenow!&  \\
%\TODAY       &\verb!\TODAY!       &\nbox{6}{500}{}{.}{4}{1}&
%\verb!\nbox{6}{500}{0}{.}{4}{1}! \\
%\cb[6pc]{Quite a bit to long a text to fit in one column}& 
%\verb!\cb[6pc]{Qu.... mn}!& \nbox{6}{600}{}{.}{4}{74}  & 
%\verb!\nbox{6}{600}{0}{.}{4}{74}!\\
%\hline
%\end{tabular}                      
%          
% \begin{itemize}
% \spitem spitem. (\verb!\spitem spitem. !)                         
% \spitem item) (\verb!\spitem spitem) !)                         
% \spitem em] (\verb!\spitem spitem] !)                         
% \spitem - (\verb!\spitem spitem- !)                         
% \spitem * (\verb!\spitem spitem* !)
% \end{itemize}                         
%\newpage\section{Implementation}   
% Input special fonts. The commands for kluwer's internal font are
% always valid, but this option defines the font. This is needed
% because we do not intend to supply the font to everyone. 
%
% Policy is that we want the ams fonts defined. However, not everybody
% has these fonts installed, so it's better to be careful.
%    \begin{macrocode}              
\ProvidesPackage{klumac}[\filedate ]
%</other>
%<*head>
\font\@klusymfont=cmr10             
\DeclareOption{klusym}{\font\@klusymfont=klusym10 }
%\DeclareOption{psamsfonts}{\PassOptionsToPackage\CurrentOption{amssymb}}
%\ExecuteOptions{}
%</head>
%<*other>
\ProcessOptions
%</other>
%<*neck>
\IfFileExists{amssymb.sty}{\RequirePackage[psamsfonts]{amssymb}%
    \global\font\smallmsa=msam7
    \gdef\Register{$^{\mbox{\smallmsa\char114}}$~}}{}
\IfFileExists{wasysym.sty}{\RequirePackage{wasysym}}{%
  \IfFileExists{wasysym.tex}{\input{wasysym}}{}}
%</neck>
%<*main>
%    \end{macrocode}
% 
% \subsection{Math macro's}
%    \begin{macrocode}
%\newcommand\I{{\bf I}}
\def\I{{\bf I}}
\newcommand\iduaal{\overline{\I}}
\let\forces\Vdash
\newcommand\rrestrict{\hbox{$\mid$ \kern-5pt \raise3.6pt\hbox{$
                      \scriptscriptstyle \backslash$}}}
\newcommand\restrict{\mathrel{\mathpalette\rrestrict{}}}
\let\diamond\lozenge
\newcommand\concat{\mathrel{\raise1pt\hbox{$\!\!^\frown\!\!$}}}
\newcommand\lh{\mathop\mathrm{lh}}
\newcommand\depth{\mathop\mathrm{depth}}
\newcommand\dom{\mathop\mathrm{dom}}
\newcommand\range{\mathop\mathrm{range}}
\newcommand\mapright[1]{\smash{\mathop{\longrightarrow}\limits^{#1}}}
\newcommand\mapdown[1]{\big\downarrow
                       \rlap{$\vcenter{\hbox{$\scriptstyle#1$}}$}}
\newcommand{\dC}{C \! \! \! \! {\scriptscriptstyle {}^{{}_|}}\ }
\newcommand{\dL}{I \! \! L}
\newcommand{\dE}{I \! \! E}
\newcommand{\dF}{I \! \! F}
\newcommand{\dP}{I \! \! P}
\newcommand{\dN}{I \! \! N}
\newcommand{\dR}{I \! \! R}
\newcommand{\dZ}{Z \! \! \! Z}
\newcommand{\dQ}{Q \! \! \! \! {\scriptscriptstyle {}^|}\ }
% 99/11/30 SK: nequiv, lsim, gsim, logr, grlo now mathrel
\newcommand{\nequiv}{\mathrel{\setbox0\hbox{$\equiv$}%
                     \rlap{\hbox{$\equiv$}}\hbox to \wd0{\hfil $/$\hfil}}}
\newcommand{\lsim}{\mathrel{\rlap{\raise -.3ex\hbox{${\scriptstyle\sim}$}}%
                   \raise .6ex\hbox{${\scriptstyle <}$}}}%
\newcommand{\gsim}{\mathrel{\rlap{\raise -.3ex\hbox{${\scriptstyle\sim}$}}%
                   \raise .6ex\hbox{${\scriptstyle >}$}}}%
\newcommand{\logr}{\mathrel{\rlap{\raise -.3ex\hbox{${\scriptstyle <}$}}%
                   \raise .6ex\hbox{${\scriptstyle >}$}}}%
\newcommand{\grlo}{\mathrel{\rlap{\raise -.3ex\hbox{${\scriptstyle >}$}}%
                   \raise .6ex\hbox{${\scriptstyle <}$}}}%
\newcommand{\oast}{\setbox0\hbox{$\odot$}%
                   \rlap{\hbox to \wd0{\hfil$\ast$\hfil}}\box0}
\newcommand{\res}{\oalign{\hbox{$\grave{}$\kern-3pt$\mid$}}}
\newcommand{\dres}{\mid \! \res}
\newcommand{\bigo}[1]{\setbox0\hbox{$\bigcirc$}%
             \rlap{\raise .2ex\hbox to \wd0{\hfil ${\scriptscriptstyle
                   #1}$\hfil}}\box0}
\newcommand{\Res}[1]{\mathop{\hbox{Res}}\limits_{\scriptscriptstyle #1}}
\newcommand{\down}[1]{\raise -1ex\hbox{{$\scriptstyle #1$}}}
%    \end{macrocode}
% \subsection{General}
% 
%    \begin{macrocode} 
\newcount\@cla
\newcount\@clb
\hyphenation{equiv-a-lent equiv-a-lent-ly sat-is-fy sat-is-fies
             sat-is-fied}
\newcommand\fn{\hspace*{14pt} \= \kill}
\newcommand\mc{\multicolumn}
\newcommand{\dummy}[1]{}
\def\today{\ifcase\month\or January\or February\or March\or April\or 
   May\or June\or July\or August\or September\or October\or November\or 
   December\fi \space\number\day, \number\year}
\def\TODAY{\number\day/\ifcase\month\or 01\or 02\or 03\or 04\or 05\or 
    06\or 07\or 08\or 09\or 10\or 11\or 12\fi/\number\year}
\def\timenow{%
  \@tempcnta=\time \divide\@tempcnta by 60 \number\@tempcnta:\multiply
  \@tempcnta by 60 \@tempcntb=\time \advance\@tempcntb by -\@tempcnta
  \ifnum\@tempcntb <10 0\number\@tempcntb\else\number\@tempcntb\fi}
\def\numtoword#1{\ifcase#1\or one\or two\or three\or four\or
  five\or six\or seven\or eight\or nine\or ten\or eleven\or twelve\or
  thirteen\or fourteen\or fifteen\or sixteen\or seventeen\or
  eighteen\or nineteen\or twenty\fi}
\def\NUMTOWORD#1{\ifcase#1\or ONE\or TWO\or THREE\or FOUR\or
  FIVE\or SIX\or SEVEN\or EIGHT\or NINE\or TEN\or ELEVEN\or TWELVE\or
  THIRTEEN\or FOURTEEN\or FIFTEEN\or SIXTEEN\or SEVENTEEN\or
  EIGHTEEN\or NINETEEN\or TWENTY\fi}

%    \end{macrocode}
% |\genaccent| is defined below. |\ifempty| is a shortcut used inside
% |\genaccent|.
%    \begin{macrocode}
\def\ifempty#1#2#3{\def\inner{#1}\ifx\inner\empty 
   #2\else #3\fi }
\def\ifdef#1{\edef\tempa{\expandafter\@gobble\string #1}%
   \expandafter\expandafter\expandafter\ifx\expandafter\csname
   \tempa \endcsname\relax
   \let\next\nosw \else \let\next=\yessw \fi \next}
\def\nosw{\iffalse}
\def\yessw{\iftrue}
%    \end{macrocode}
% \subsubsection{Spitem} 
% This can be done better. 
%    \begin{macrocode}
\newif\ifklaar
\newbox\bdj                   
\def\onestep#1{\ifklaar\else
           \if#1){)}\klaartrue\else
           \if#1.{.}\klaartrue\else
           \if#1]{]}\klaartrue\else
           \if#1-{--}\klaartrue\else
           \if#1*{*}\klaartrue\else
           #1%
           \fi\fi\fi\fi\fi
               \fi}
\def\subspitem#1{\scan#1\end}
\def\spitem#1 {%
  \def\scan##1##2\end{\def\aux{##1}%
     \ifklaar\global\setbox\bdj=\hbox{##1##2\space}\else
     \ifx\aux\empty \else \def\aux{##2}\onestep{##1}%
     \ifx\aux\empty \else \scan##2\end \fi \fi \fi}%
  \global\setbox\bdj\hbox{}%
  \klaarfalse\expandafter\item[\subspitem{#1}]%
  \unhbox\bdj}
%    \end{macrocode}
% \subsubsection{Genaccent}
%    \begin{macrocode}
\font\genacc=cmr10
\def\genaccent#1#2#3#4#5{\protect\@genaccent{#1}{#2}{#3}{#4}{#5}}
\def\@genaccent#1#2#3#4#5{%
   \leavevmode\setbox0=\hbox{#3}%
   \vbox{\offinterlineskip
   \ifempty{#1}{}{%\else 
    \hbox to\wd0{\hss\genacc \char#1\hss}}%
    \ifempty{#4}{\kern -.8ex}{\kern #4}%
   \vbox to\ht0{\copy0\vss}%
   \vtop{\null\vbox to\dp0{\vss}%
   \ifempty{#2}{}{%\else
     \ifempty{#5}{\kern .2ex}{\kern#5}%
     \hbox to \wd0{\hss \genacc\char #2\hss}}%
    }}}
\renewcommand\.[1]{\genaccent{95}{}{#1}{}{}}
%    \end{macrocode}
% \subsubsection{Table labels}
% Note that these are font-dependant, the option |klusym| is needed to
% initialize the correct font, otherwise the symbols will be in |cmr|.
%    \begin{macrocode}
\newcommand\BlackBox{\hbox{\@klusymfont B}~}
\newcommand\EmptyBox{\hbox{\@klusymfont E}~}
\newcommand\HstripeBox{\hbox{\@klusymfont H}~}
\newcommand\VstripeBox{\hbox{\@klusymfont V}~}
\newcommand\LstripeBox{\hbox{\@klusymfont L}~}
\newcommand\RstripeBox{\hbox{\@klusymfont R}~}
\newcommand\UpCrossBox{\hbox{\@klusymfont U}~}
\newcommand\DiagCrossBox{\hbox{\@klusymfont D}~}
%    \end{macrocode}
% \subsection{Table macro's} 
% |\cb| it a typing shortcut for |\parbox|, without forcing this
% width. 
%    \begin{macrocode}
\def\cb{\@ifnextchar[{\@cbone}{\@cbone[8pc]}}
\def\@cbone[#1]#2{{\setbox0\hbox{#2}%
     \ifdim\wd0 >#1 \parbox[t]{#1}{#2}\else #2\fi}}
%    \end{macrocode}
% |\nbox| allows typesetting of aligned numbers. Arguments \#1, \#3
% and \#5 specify widths in number of digits for the arguments \#2,
% \#4 and \#6. Typeset as |lcr|.  Empty arguments  for widths  means
% natural width. This macro is a lot easier to use inside of another
% macro.   
%    \begin{macrocode}
\def\nbox#1#2#3#4#5#6{\begingroup\setbox0\hbox{0}%
    \ifempty{#1}{\hfil #2}{\hbox to #1\wd0{\hfil #2}}%
    \ifempty{#3}{\hbox{#4}}{\hbox to #3\wd0{\hfil #4\hfil }}%
    \ifempty{#5}{#6 \hfil}{\hbox to #5\wd0{#6\hfil }}% 
    \endgroup}
%    \end{macrocode}
% 
%
% \subsection{Charkern macro's}
%  
% These are not very readable, but they work quite well.
%
% Use dollars for inlinemath, not |\(....\)|.
%
% Special handling added for the (quite often appearing) case of 
% |\charkern{\notesname}|, and a security check for the often
% appearing case of no argument at all.    
%    \begin{macrocode}
\newif\ifkern@mathmode \kern@mathmodefalse
\def\charkerncharspace{\kern 0.5ex}
\def\charkernwordspace{\kern 0.5em\penalty 10}
\let\charkerncommand\uppercase
\def\@kap@tfor#1:=#2\do#3{\ifempty{#1}{}{%
  \@tforloop#2\@nil\@nil\@@#1{#3}}}
\def\charkern#1{%
    \ifempty{#1}{}{%else             
  \begingroup             
  \def\test##1##2!!!!{\def\@tempa{##2}}\test#1!!!!%
  \ifx\@tempa\empty \edef\@@kc{#1}\else \def\@@kc{#1}\fi
  \def\c@@k{@s@e@v@y}%
  \def\ck@@##1 @s@e@v@y\@@ck{\def\@@kc{##1}}%
  \def\ck@##1 ##2\@@ck{\def\@kc{##1}\def\@@kc{##2}}%
%    \end{macrocode}
%   |\@kc| == first word of remaining sentence
%    \begin{macrocode}
  \def\iterate{\expandafter\expandafter\expandafter\ck@
%    \end{macrocode}
% The |\space| forces the line to end on with a space.
%
% In |\@kernword| most of the real work is done
%
% 
%    \begin{macrocode}
    \expandafter\@@kc\space @s@e@v@y\@@ck
    \expandafter\@kernword\expandafter{\@kc}%
    \ifx\@@kc\c@@k
      \let\next\relax
    \else
      \expandafter\ck@@\@@kc\@@ck
      \let\next\iterate\charkernwordspace
    \fi\next}\iterate
  \endgroup
  }}
     
\def\@kernword#1{\def\d@ll@rm@th{$}\@kap@tfor\@nextchar:=#1\do{%
    \ifx\@nextchar\d@ll@rm@th
      \ifkern@mathmode
        \kern@mathmodefalse
%    \end{macrocode}
%
% Here all collected math is typeset
%
%    \begin{macrocode}
        $\kern@math$%
      \else
        \kern@mathmodetrue
        \xdef\kern@math{}%
      \fi
    \else
      \ifkern@mathmode
        \begingroup
          \def\protect{\noexpand}%
%    \end{macrocode}
% 
% eat up math char by char
% 
% |ab -> A\kern .5ex B\kern .5ex|
%                              
%    \begin{macrocode}
          \xdef\kern@math{\kern@math\@nextchar}%
        \endgroup
      \else 
          \charkerncommand\expandafter{\@nextchar}\charkerncharspace
      \fi
    \fi
}}          

\newcount\tracingkluwer
\def\kludebug#1{\relax\ifcase\tracingkluwer \or
    \wlog{kap: #1}\or \typeout{kap: #1}\else
    \immediate\wlog{kap*: #1}\typeout{kap: #1}\fi}
\global\tracingkluwer=3
\def\kluverbatim{\par\begingroup\vbox \bgroup\trivlist 
    \item\relax \vskip\parskip 
    \rightskip\z@skip \parindent\z@
    \parfillskip\@flushglue \parskip0pt \@@par \@tempswafalse
    \def\par{\if@tempswa \leavevmode\null\@@par\penalty\interlinepenalty
    \else \@tempswatrue \ifhmode\@@par\penalty\interlinepenalty\fi \fi}
    \let\do\@makeother \catcode`\|=0 
    \obeylines \verbatim@font \@noligs \dospecials \catcode`\%=14 
    \frenchspacing\@vobeyspaces
    \everypar \expandafter{\the\everypar \unpenalty }}
\def\endkluverbatim{\endtrivlist\egroup\endgroup}
%</main>
%<*other>
\endinput       
%    \end{macrocode}
%\PrintIndex
%\end{document}
%% end of klumac.sty
%</other>