]> matita.cs.unibo.it Git - helm.git/blob - helm/papers/matita/klumac.sty
ocaml 3.09 transition
[helm.git] / helm / papers / matita / klumac.sty
1 %
2 %
3 \ifcat a\noexpand @\let\next\relax\else \def\next{%
4 \documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
5 \NeedsTeXFormat{LaTeX2e}
6 \def\filedate{1998/02/11}
7 \def\filename{klumac.sty}
8 %\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi}
9 %\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname}
10 %\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\gdef,\@cla,\@clb}
11 %\DoNotIndex{\normalsize,\protect,\global,\setbox,\hbox,\vbox,\endinput}
12 %\DoNotIndex{\egroup,\endgroup,\bgroup,\begingroup,\let}
13 %\CodelineIndex
14 %\newcommand{\Bs}{$\backslash$}%
15 %\parindent=0pt
16 %\parskip=3pt
17 %\hfuzz=10pt
18 %\MakeShortVerb{\|}
19 %\addtolength{\textwidth}{4pc}
20 %\begin{document}
21 %\begin{opening}
22 %\title{\filename}
23 %\date{\filedate}
24 %\author{Kluwer Academic Publishers\surname{}}
25 %\institute{~}
26 %\begin{abstract}
27 % This internal stylefile defines some handy macros and exports the special 
28 % \AmSTeX\ fonts if available.
29 %\end{abstract}
30 %\end{opening}
31 %\tableofcontents
32 %\newpage\section{Usage}
33 %Here are tests for the macro commands used and defined in this file:   
34 %{\def\mentry#1{$#1$ & \$\string #1\$ &}
35 %\def\tentry#1{#1 & \string #1 &} 
36 %
37 %\begin{tabular}{lllllllll}\hline
38 %$\I         $&\verb!$\I$!         &$\iduaal$     &\verb!$\iduaal$!     \\
39 %$\restrict  $&\verb!$\restrict$!  &$\diamond$    &\verb!$\diamond$!    \\
40 %$\depth     $&\verb!$\depth$!     &$\dom$        &\verb!$\dom$!        \\
41 %$\mapdown{a}$&\verb!$\mapdown{a}$!&$\dC$         &\verb!$\dC$!         \\
42 %$\dF        $&\verb!$\dF$!        &$\dP$         &\verb!$\dP$!         \\
43 %$\dZ        $&\verb!$\dZ$!        &$\dQ$         &\verb!$\dQ$!         \\
44 %$\gsim      $&\verb!$\gsim$!      &$\logr$       &\verb!$\logr$!       \\
45 %$\dres      $&\verb!$\dres$!      &\today        &\verb!\today!      \\
46 %$\forces    $&\verb!$\forces$!    &\.{a} & \verb!\.{a}! \\
47 %$\concat    $&\verb!$\concat$!    &$\lh$         &\verb!$\lh$!         \\  
48 %$\range     $&\verb!$\range$!     &$\mapright{a}$&\verb!$\mapright{a}$!\\
49 %$\dL        $&\verb!$\dL$!        &$\dE$         &\verb!$\dE$!\\
50 %$\dN        $&\verb!$\dN$!        &$\dR$         &\verb!$\dR$!\\
51 %$\nequiv    $&\verb!$\nequiv$!    &$\lsim$       &\verb!$\lsim$!\\  
52 %$\grlo      $&\verb!$\grlo$!      &$\oast$       &\verb!$\oast$!   \\
53 %$\res$       &\verb!$\res$!       &$\dres$        &\verb!$\dres$!  \\
54 %$\bigo{a}$   &\verb!$\bigo{a}$!   &$\Res{a}$       &\verb!$\Res{a}$!\\ 
55 %$\down{a}$   &\verb!$\down{a}$!   &\timenow      &\verb!\timenow!&  \\
56 %\TODAY       &\verb!\TODAY!       &\nbox{6}{500}{}{.}{4}{1}&
57 %\verb!\nbox{6}{500}{0}{.}{4}{1}! \\
58 %\cb[6pc]{Quite a bit to long a text to fit in one column}& 
59 %\verb!\cb[6pc]{Qu.... mn}!& \nbox{6}{600}{}{.}{4}{74}  & 
60 %\verb!\nbox{6}{600}{0}{.}{4}{74}!\\
61 %\hline
62 %\end{tabular}                      
63 %          
64 % \begin{itemize}
65 % \spitem spitem. (\verb!\spitem spitem. !)                         
66 % \spitem item) (\verb!\spitem spitem) !)                         
67 % \spitem em] (\verb!\spitem spitem] !)                         
68 % \spitem - (\verb!\spitem spitem- !)                         
69 % \spitem * (\verb!\spitem spitem* !)
70 % \end{itemize}                         
71 %\newpage\section{Implementation}   
72 % Input special fonts. The commands for kluwer's internal font are
73 % always valid, but this option defines the font. This is needed
74 % because we do not intend to supply the font to everyone. 
75 %
76 % Policy is that we want the ams fonts defined. However, not everybody
77 % has these fonts installed, so it's better to be careful.
78 %    \begin{macrocode}              
79 \ProvidesPackage{klumac}[\filedate ]
80 \font\@klusymfont=cmr10             
81 \DeclareOption{klusym}{\font\@klusymfont=klusym10 }
82 \ExecuteOptions{}
83 \ProcessOptions
84 \IfFileExists{amssymb.sty}{\RequirePackage{amssymb}%
85     \global\font\smallmsa=msam7
86     \gdef\Register{$^{\mbox{\smallmsa\char114}}$~}}{}
87 \IfFileExists{wasysym.sty}{\RequirePackage{wasysym}}{%
88   \IfFileExists{wasysym.tex}{\input{wasysym}}{}}
89 %    \end{macrocode}
90
91 % \subsection{Math macro's}
92 %    \begin{macrocode}
93 \newcommand\I{{\bf I}}
94 \newcommand\iduaal{\overline{\I}}
95 \let\forces\Vdash
96 \newcommand\rrestrict{\hbox{$\mid$ \kern-5pt \raise3.6pt\hbox{$
97                       \scriptscriptstyle \backslash$}}}
98 \newcommand\restrict{\mathrel{\mathpalette\rrestrict{}}}
99 \let\diamond\lozenge
100 \newcommand\concat{\mathrel{\raise1pt\hbox{$\!\!^\frown\!\!$}}}
101 \newcommand\lh{\mathop\mathrm{lh}}
102 \newcommand\depth{\mathop\mathrm{depth}}
103 \newcommand\dom{\mathop\mathrm{dom}}
104 \newcommand\range{\mathop\mathrm{range}}
105 \newcommand\mapright[1]{\smash{\mathop{\longrightarrow}\limits^{#1}}}
106 \newcommand\mapdown[1]{\big\downarrow
107                        \rlap{$\vcenter{\hbox{$\scriptstyle#1$}}$}}
108 \newcommand{\dC}{C \! \! \! \! {\scriptscriptstyle {}^{{}_|}}\ }
109 \newcommand{\dL}{I \! \! L}
110 \newcommand{\dE}{I \! \! E}
111 \newcommand{\dF}{I \! \! F}
112 \newcommand{\dP}{I \! \! P}
113 \newcommand{\dN}{I \! \! N}
114 \newcommand{\dR}{I \! \! R}
115 \newcommand{\dZ}{Z \! \! \! Z}
116 \newcommand{\dQ}{Q \! \! \! \! {\scriptscriptstyle {}^|}\ }
117 \newcommand{\nequiv}{\setbox0\hbox{$\equiv$}%
118                      \rlap{\hbox{$\equiv$}}%
119                      \hbox to \wd0{\hfil $/$\hfil}}
120 \newcommand{\lsim}{\rlap{\raise -.3ex\hbox{${\scriptstyle\sim}$}}%
121                    \raise .6ex\hbox{${\scriptstyle <}$}}%
122 \newcommand{\gsim}{\rlap{\raise -.3ex\hbox{${\scriptstyle\sim}$}}%
123                    \raise .6ex\hbox{${\scriptstyle >}$}}%
124 \newcommand{\logr}{\rlap{\raise -.3ex\hbox{${\scriptstyle <}$}}%
125                    \raise .6ex\hbox{${\scriptstyle >}$}}%
126 \newcommand{\grlo}{\rlap{\raise -.3ex\hbox{${\scriptstyle >}$}}%
127                    \raise .6ex\hbox{${\scriptstyle <}$}}%
128 \newcommand{\oast}{\setbox0\hbox{$\odot$}%
129                    \rlap{\hbox to \wd0{\hfil$\ast$\hfil}}\box0}
130 \newcommand{\res}{\oalign{\hbox{$\grave{}$\kern-3pt$\mid$}}}
131 \newcommand{\dres}{\mid \! \res}
132 \newcommand{\bigo}[1]{\setbox0\hbox{$\bigcirc$}%
133              \rlap{\raise .2ex\hbox to \wd0{\hfil ${\scriptscriptstyle
134                    #1}$\hfil}}\box0}
135 \newcommand{\Res}[1]{\mathop{\hbox{Res}}\limits_{\scriptscriptstyle #1}}
136 \newcommand{\down}[1]{\raise -1ex\hbox{{$\scriptstyle #1$}}}
137 %    \end{macrocode}
138 % \subsection{General}
139
140 %    \begin{macrocode} 
141 \newcount\@cla
142 \newcount\@clb
143 \hyphenation{equiv-a-lent equiv-a-lent-ly sat-is-fy sat-is-fies
144              sat-is-fied}
145 \newcommand\fn{\hspace*{14pt} \= \kill}
146 \newcommand\mc{\multicolumn}
147 \newcommand{\dummy}[1]{}
148 \def\today{\ifcase\month\or January\or February\or March\or April\or 
149    May\or June\or July\or August\or September\or October\or November\or 
150    December\fi \space\number\day, \number\year}
151 \def\TODAY{\number\day/\ifcase\month\or 01\or 02\or 03\or 04\or 05\or 
152     06\or 07\or 08\or 09\or 10\or 11\or 12\fi/\number\year}
153 \def\timenow{%
154   \@tempcnta=\time \divide\@tempcnta by 60 \number\@tempcnta:\multiply
155   \@tempcnta by 60 \@tempcntb=\time \advance\@tempcntb by -\@tempcnta
156   \ifnum\@tempcntb <10 0\number\@tempcntb\else\number\@tempcntb\fi}
157 \def\numtoword#1{\ifcase#1\or one\or two\or three\or four\or
158   five\or six\or seven\or eight\or nine\or ten\or eleven\or twelve\or
159   thirteen\or fourteen\or fifteen\or sixteen\or seventeen\or
160   eighteen\or nineteen\or twenty\fi}
161 \def\NUMTOWORD#1{\ifcase#1\or ONE\or TWO\or THREE\or FOUR\or
162   FIVE\or SIX\or SEVEN\or EIGHT\or NINE\or TEN\or ELEVEN\or TWELVE\or
163   THIRTEEN\or FOURTEEN\or FIFTEEN\or SIXTEEN\or SEVENTEEN\or
164   EIGHTEEN\or NINETEEN\or TWENTY\fi}
165
166 %    \end{macrocode}
167 % |\genaccent| is defined below. |\ifempty| is a shortcut used inside
168 % |\genaccent|.
169 %    \begin{macrocode}
170 \def\ifempty#1#2#3{\def\inner{#1}\ifx\inner\empty 
171    #2\else #3\fi }
172 \def\ifdef#1{\edef\tempa{\expandafter\@gobble\string #1}%
173    \expandafter\expandafter\expandafter\ifx\expandafter\csname
174    \tempa \endcsname\relax
175    \let\next\nosw \else \let\next=\yessw \fi \next}
176 \def\nosw{\iffalse}
177 \def\yessw{\iftrue}
178 %    \end{macrocode}
179 % \subsubsection{Spitem} 
180 % This can be done better. 
181 %    \begin{macrocode}
182 \newif\ifklaar
183 \newbox\bdj                   
184 \def\onestep#1{\ifklaar\else
185            \if#1){)}\klaartrue\else
186            \if#1.{.}\klaartrue\else
187            \if#1]{]}\klaartrue\else
188            \if#1-{--}\klaartrue\else
189            \if#1*{*}\klaartrue\else
190            #1%
191            \fi\fi\fi\fi\fi
192                \fi}
193 \def\subspitem#1{\scan#1\end}
194 \def\spitem#1 {%
195   \def\scan##1##2\end{\def\aux{##1}%
196      \ifklaar\global\setbox\bdj=\hbox{##1##2\space}\else
197      \ifx\aux\empty \else \def\aux{##2}\onestep{##1}%
198      \ifx\aux\empty \else \scan##2\end \fi \fi \fi}%
199   \global\setbox\bdj\hbox{}%
200   \klaarfalse\expandafter\item[\subspitem{#1}]%
201   \unhbox\bdj}
202 %    \end{macrocode}
203 % \subsubsection{Genaccent}
204 %    \begin{macrocode}
205 \font\genacc=cmr10
206 \def\genaccent#1#2#3#4#5{\protect\@genaccent{#1}{#2}{#3}{#4}{#5}}
207 \def\@genaccent#1#2#3#4#5{%
208    \leavevmode\setbox0=\hbox{#3}%
209    \vbox{\offinterlineskip
210    \ifempty{#1}{}{%\else 
211     \hbox to\wd0{\hss\genacc \char#1\hss}}%
212     \ifempty{#4}{\kern -.8ex}{\kern #4}%
213    \vbox to\ht0{\copy0\vss}%
214    \vtop{\null\vbox to\dp0{\vss}%
215    \ifempty{#2}{}{%\else
216      \ifempty{#5}{\kern .2ex}{\kern#5}%
217      \hbox to \wd0{\hss \genacc\char #2\hss}}%
218     }}}
219 \renewcommand\.[1]{\genaccent{95}{}{#1}{}{}}
220 %    \end{macrocode}
221 % \subsubsection{Table labels}
222 % Note that these are font-dependant, the option |klusym| is needed to
223 % initialize the correct font, otherwise the symbols will be in |cmr|.
224 %    \begin{macrocode}
225 \newcommand\BlackBox{\hbox{\@klusymfont B}~}
226 \newcommand\EmptyBox{\hbox{\@klusymfont E}~}
227 \newcommand\HstripeBox{\hbox{\@klusymfont H}~}
228 \newcommand\VstripeBox{\hbox{\@klusymfont V}~}
229 \newcommand\LstripeBox{\hbox{\@klusymfont L}~}
230 \newcommand\RstripeBox{\hbox{\@klusymfont R}~}
231 \newcommand\UpCrossBox{\hbox{\@klusymfont U}~}
232 \newcommand\DiagCrossBox{\hbox{\@klusymfont D}~}
233 %    \end{macrocode}
234 % \subsection{Table macro's} 
235 % |\cb| it a typing shortcut for |\parbox|, without forcing this
236 % width. 
237 %    \begin{macrocode}
238 \def\cb{\@ifnextchar[{\@cbone}{\@cbone[8pc]}}
239 \def\@cbone[#1]#2{{\setbox0\hbox{#2}%
240      \ifdim\wd0 >#1 \parbox[t]{#1}{#2}\else #2\fi}}
241 %    \end{macrocode}
242 % |\nbox| allows typesetting of aligned numbers. Arguments \#1, \#3
243 % and \#5 specify widths in number of digits for the arguments \#2,
244 % \#4 and \#6. Typeset as |lcr|.  Empty arguments  for widths  means
245 % natural width. This macro is a lot easier to use inside of another
246 % macro.   
247 %    \begin{macrocode}
248 \def\nbox#1#2#3#4#5#6{\begingroup\setbox0\hbox{0}%
249     \ifempty{#1}{\hfil #2}{\hbox to #1\wd0{\hfil #2}}%
250     \ifempty{#3}{\hbox{#4}}{\hbox to #3\wd0{\hfil #4\hfil }}%
251     \ifempty{#5}{#6 \hfil}{\hbox to #5\wd0{#6\hfil }}% 
252     \endgroup}
253 %    \end{macrocode}
254
255 %
256 % \subsection{Charkern macro's}
257 %  
258 % These are not very readable, but they work quite well.
259 %
260 % Use dollars for inlinemath, not |\(....\)|.
261 %
262 % Special handling added for the (quite often appearing) case of 
263 % |\charkern{\notesname}|, and a security check for the often
264 % appearing case of no argument at all.    
265 %    \begin{macrocode}
266 \newif\ifkern@mathmode \kern@mathmodefalse
267 \def\charkerncharspace{\kern 0.5ex}
268 \def\charkernwordspace{\kern 0.5em\penalty 10}
269 \let\charkerncommand\uppercase
270 \def\@kap@tfor#1:=#2\do#3{\ifempty{#1}{}{%
271   \@tforloop#2\@nil\@nil\@@#1{#3}}}
272 \def\charkern#1{%
273     \ifempty{#1}{}{%else             
274   \begingroup             
275   \def\test##1##2!!!!{\def\@tempa{##2}}\test#1!!!!%
276   \ifx\@tempa\empty \edef\@@kc{#1}\else \def\@@kc{#1}\fi
277   \def\c@@k{@s@e@v@y}%
278   \def\ck@@##1 @s@e@v@y\@@ck{\def\@@kc{##1}}%
279   \def\ck@##1 ##2\@@ck{\def\@kc{##1}\def\@@kc{##2}}%
280 %    \end{macrocode}
281 %   |\@kc| == first word of remaining sentence
282 %    \begin{macrocode}
283   \def\iterate{\expandafter\expandafter\expandafter\ck@
284 %    \end{macrocode}
285 % The |\space| forces the line to end on with a space.
286 %
287 % In |\@kernword| most of the real work is done
288 %
289
290 %    \begin{macrocode}
291     \expandafter\@@kc\space @s@e@v@y\@@ck
292     \expandafter\@kernword\expandafter{\@kc}%
293     \ifx\@@kc\c@@k
294       \let\next\relax
295     \else
296       \expandafter\ck@@\@@kc\@@ck
297       \let\next\iterate\charkernwordspace
298     \fi\next}\iterate
299   \endgroup
300   }}
301      
302 \def\@kernword#1{\def\d@ll@rm@th{$}\@kap@tfor\@nextchar:=#1\do{%
303     \ifx\@nextchar\d@ll@rm@th
304       \ifkern@mathmode
305         \kern@mathmodefalse
306 %    \end{macrocode}
307 %
308 % Here all collected math is typeset
309 %
310 %    \begin{macrocode}
311         $\kern@math$%
312       \else
313         \kern@mathmodetrue
314         \xdef\kern@math{}%
315       \fi
316     \else
317       \ifkern@mathmode
318         \begingroup
319           \def\protect{\noexpand}%
320 %    \end{macrocode}
321
322 % eat up math char by char
323
324 % |ab -> A\kern .5ex B\kern .5ex|
325 %                              
326 %    \begin{macrocode}
327           \xdef\kern@math{\kern@math\@nextchar}%
328         \endgroup
329       \else 
330           \charkerncommand\expandafter{\@nextchar}\charkerncharspace
331       \fi
332     \fi
333 }}          
334
335 \newcount\tracingkluwer
336 \def\kludebug#1{\relax\ifcase\tracingkluwer \or
337     \wlog{kap: #1}\or \typeout{kap: #1}\else
338     \immediate\wlog{kap*: #1}\typeout{kap: #1}\fi}
339 \global\tracingkluwer=3
340 \def\kluverbatim{\par\begingroup\vbox \bgroup\trivlist 
341     \item\relax \vskip\parskip 
342     \rightskip\z@skip \parindent\z@
343     \parfillskip\@flushglue \parskip0pt \@@par \@tempswafalse
344     \def\par{\if@tempswa \leavevmode\null\@@par\penalty\interlinepenalty
345     \else \@tempswatrue \ifhmode\@@par\penalty\interlinepenalty\fi \fi}
346     \let\do\@makeother \catcode`\|=0 
347     \obeylines \verbatim@font \@noligs \dospecials \catcode`\%=14 
348     \frenchspacing\@vobeyspaces
349     \everypar \expandafter{\the\everypar \unpenalty }}
350 \def\endkluverbatim{\endtrivlist\egroup\endgroup}
351 \endinput       
352 %    \end{macrocode}
353 %\PrintIndex
354 %\end{document}
355 %% end of klumac.sty
356                     
357
358
359