]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/papers/matita/klumac.sty
ported to kluwer style
[helm.git] / helm / papers / matita / klumac.sty
diff --git a/helm/papers/matita/klumac.sty b/helm/papers/matita/klumac.sty
new file mode 100644 (file)
index 0000000..5b337cd
--- /dev/null
@@ -0,0 +1,359 @@
+%
+%
+\ifcat a\noexpand @\let\next\relax\else \def\next{%
+\documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
+\NeedsTeXFormat{LaTeX2e}
+\def\filedate{1998/02/11}
+\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 ]
+\font\@klusymfont=cmr10             
+\DeclareOption{klusym}{\font\@klusymfont=klusym10 }
+\ExecuteOptions{}
+\ProcessOptions
+\IfFileExists{amssymb.sty}{\RequirePackage{amssymb}%
+    \global\font\smallmsa=msam7
+    \gdef\Register{$^{\mbox{\smallmsa\char114}}$~}}{}
+\IfFileExists{wasysym.sty}{\RequirePackage{wasysym}}{%
+  \IfFileExists{wasysym.tex}{\input{wasysym}}{}}
+%    \end{macrocode}
+% 
+% \subsection{Math macro's}
+%    \begin{macrocode}
+\newcommand\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 {}^|}\ }
+\newcommand{\nequiv}{\setbox0\hbox{$\equiv$}%
+                     \rlap{\hbox{$\equiv$}}%
+                     \hbox to \wd0{\hfil $/$\hfil}}
+\newcommand{\lsim}{\rlap{\raise -.3ex\hbox{${\scriptstyle\sim}$}}%
+                   \raise .6ex\hbox{${\scriptstyle <}$}}%
+\newcommand{\gsim}{\rlap{\raise -.3ex\hbox{${\scriptstyle\sim}$}}%
+                   \raise .6ex\hbox{${\scriptstyle >}$}}%
+\newcommand{\logr}{\rlap{\raise -.3ex\hbox{${\scriptstyle <}$}}%
+                   \raise .6ex\hbox{${\scriptstyle >}$}}%
+\newcommand{\grlo}{\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}
+\endinput       
+%    \end{macrocode}
+%\PrintIndex
+%\end{document}
+%% end of klumac.sty
+                    
+
+
+