]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/papers/matita/klutab.sty
ported to kluwer style
[helm.git] / helm / papers / matita / klutab.sty
diff --git a/helm/papers/matita/klutab.sty b/helm/papers/matita/klutab.sty
new file mode 100644 (file)
index 0000000..f59dc11
--- /dev/null
@@ -0,0 +1,242 @@
+%
+%
+\ifcat a\noexpand @\let\next\relax\else \def\next{%
+\documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
+\def\filedate{1998/02/11}
+\def\filename{klutab.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 
+%\changes{1997/02/12}{TH: Inserted definition of `array' to accomodate `hline'.}
+%\newcommand{\Bs}{$\backslash$}
+%\parindent=0pt
+%\parskip=3pt
+%\hfuzz=10pt
+%\MakeShortVerb{\|}
+%\setlength{\marginparwidth}{0in} 
+%\addtolength{\textwidth}{4pc}
+%\begin{document}
+%\begin{opening}
+%\title{\filename}
+%\date{\filedate}
+%\author{Kluwer Academic Publishers\surname{}}
+%\institute{~}
+%\begin{abstract}
+% This internal stylefile takes care of tabulars.
+%\end{abstract}                                 
+%\end{opening}
+%\tableofcontents
+%\section{Usage}
+%
+% All of this is quite simple code. What happens
+% is that some extra lines for use in tabulars are defined and
+% included in the original definition of |tabular| and
+% |tabular*|. These have a bit of extra vertical space which breaks
+% the use of vertical rules in tabular's, which is why the old
+% definitions are saved as |TABULAR| and |TABULAR*|. 
+%
+% There are some variations on |\cline|. I moved internal commands out of the
+% definition of |tabular| so they could be used in |tabular*| easily. \\[6pt]
+% |\rcline| == hbox 3pt to the left\\
+% |\lcline| == hbox 3pt to the right\\
+% |\lrcline| == both \\
+% |\rlcline| == |\lrcline| (to provide symmetry)
+%
+% All of the environments  have
+% been changed so that they also set the value of |\@tabwidth|, which
+% is needed by |klufloa.sty|.
+%
+% |tabular*| has been adjusted to flush out the excess space over all
+% columns instead of to the right of the last one. This is controlled
+% by the value of |\stretchtabsep|, whose default value equals |\hfil|
+%
+%\newpage\section{Implementation}
+%    \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{klutab}[\filedate ]
+%    \end{macrocode}
+% \subsection{Tabular}
+% First some needed values. The `array' things may not belong here,
+% but is also not save to put them somewhere else. After all, \LaTeX\
+% seems to think this is correct. 
+%    \begin{macrocode}
+\arraycolsep 6pt
+\tabcolsep 6pt
+\arrayrulewidth .4pt
+\doublerulesep 2pt
+%    \end{macrocode}
+%
+% Internal versions of the rules check whether first arg $>1$, and assign
+% |\@tabklu@tmpa| accordingly. Next, execute |\@tabklu@tmpa| and
+% unskip vertical width of rule. (All three are similar)
+%    \begin{macrocode}
+\def\@rcline[#1-#2]{%
+  \noalign{%
+       \global\@cla #1\relax
+       \global\advance\@cla\m@ne
+       \ifnum\@cla >0 
+         \global\let\@tabklu@tmpa\@rclinea
+       \else
+         \global\let\@tabklu@tmpa\@rclineb
+       \fi
+       \global\@clb #2\relax
+       \global\advance\@clb-\@cla }%
+    \@tabklu@tmpa
+    \noalign{\vskip-\arrayrulewidth}%
+  }%
+\def\@rclinea{%
+    \multispan\@cla&\multispan\@clb 
+    \hbox to 3pt{\hfil }%
+    \unskip
+    \leaders\hrule \@height \arrayrulewidth\hfill 
+    \cr}%
+\def\@rclineb{%
+   \multispan\@clb 
+   \hbox to 3pt{\hfil }%
+   \unskip
+   \leaders\hrule \@height \arrayrulewidth\hfill 
+   \cr}%
+\def\@lcline[#1-#2]{%
+  \noalign{%
+     \global\@cla #1\relax
+     \global\advance\@cla\m@ne
+     \ifnum\@cla >0
+        \global\let\@tabklu@tmpa\@lclinea
+     \else
+        \global\let\@tabklu@tmpa\@lclineb
+     \fi
+     \global\@clb #2\relax
+     \global\advance\@clb-\@cla
+  }\@tabklu@tmpa
+  \noalign{\vskip-\arrayrulewidth}%
+}%
+\def\@lclinea{%
+     \multispan\@cla&\multispan\@clb
+     \unskip
+     \leaders\hrule \@height \arrayrulewidth\hfill
+     \hbox to 3pt{\hfil }\cr}%
+\def\@lclineb{%
+     \multispan\@clb
+     \unskip
+     \leaders\hrule \@height \arrayrulewidth\hfill
+     \hbox to 3pt{\hfil }\cr}%
+\def\@lrcline[#1-#2]{%
+   \noalign{%
+     \global\@cla #1\relax
+     \global\advance\@cla\m@ne
+     \ifnum\@cla>0
+        \global \let\@tabklu@tmpa\@lrclinea
+     \else
+        \global \let\@tabklu@tmpa\@lrclineb
+     \fi
+     \global \@clb #2\relax
+     \global \advance\@clb-\@cla
+     }%
+     \@tabklu@tmpa
+     \noalign{\vskip -\arrayrulewidth}%
+  }%
+\def\@lrclinea{%
+     \multispan\@cla&\multispan\@clb 
+     \hbox to 3pt{\hfil }%
+     \unskip\leaders\hrule \@height \arrayrulewidth\hfill
+     \hbox to 3pt{\hfil }%
+     \cr}%
+\def\@lrclineb{%
+     \multispan\@clb 
+     \hbox to 3pt{\hfil }%
+     \unskip\leaders\hrule \@height \arrayrulewidth\hfill
+     \hbox to 3pt{\hfil }%
+     \cr}%
+%    \end{macrocode}
+% This is used for |tabular*|
+%    \begin{macrocode}
+\newlength\stretchtabsep
+\setlength\stretchtabsep{0pt plus 1fil}
+%    \end{macrocode}
+% |\hline| has been redefined to provide some extra vertical
+% space. Unforunately, we could not do the same for |\cline| and
+% friend, because there can be more than one in one row. The old value
+% of |\hline| is saved in |\savehline| in case you need it.
+%
+% |\arraystretch| is left to it's default value, but we did want extra
+% spacing, so |\strut| is redefined (indirectly) to give some.
+%
+% And then, the entire tabular is saved in a |\hbox| so we can measure
+% it up later. (See above for why we need to know this). There is a
+% grouping level added to stop definitions from running away, but
+% maybe this isn't needed. Not sure.
+%    \begin{macrocode}
+\let\savehline\hline
+\def\tabular{\begingroup
+   \def\hline{\noalign{\vskip3pt}\savehline\noalign{\vskip3pt}}%
+   \def\rcline##1{\@rcline[##1]}%   
+   \def\lcline##1{\@lcline[##1]}%   
+   \def\lrcline##1{\@lrcline[##1]}%
+   \let\rlcline=\lrcline   
+    \setbox\strutbox\hbox{\vrule height.8\baselineskip
+            depth.4\baselineskip width\z@}%
+    \setbox0=\hbox\bgroup\def\@halignto{}\@tabular}%
+%    \end{macrocode}
+% |\endtabular| is quite straightforward.
+%    \begin{macrocode}
+\def\endtabular{\crcr\egroup\egroup $\egroup
+  \egroup \tabwidth{\wd0}\unhbox0 \endgroup}%
+%    \end{macrocode}     
+% 
+% Apparently we need to restore the definition of |\hline|
+% inside of array's. This is just a quick hack that 'fixes' 
+% the problem.
+%    \begin{macrocode}
+\let\klu@intarray\array     
+\let\klu@intendarray\endarray     
+\def\array{\begingroup \let\hline\savehline \klu@intarray }
+\def\endarray{\klu@intendarray \endgroup}   
+%    \end{macrocode}     
+%
+% |tabular*| follows the same rules, except for redefining
+% |\@tabacol| to insert a |\hfil| value for |\tabskip| in the first
+% preamble-entry (and all following, but these don't count), 
+% thereby stretching out all intercolumn space instead
+% of just the last (\LaTeX\ standard behaviour).  
+%    \begin{macrocode}
+\@namedef{tabular*}#1{%
+   \begingroup 
+   \let\savehline\hline
+   \def\hline{\noalign{\vskip3pt}\savehline\noalign{\vskip3pt}}%
+   \def\rcline##1{\@rcline[##1]}%   
+   \def\lcline##1{\@lcline[##1]}%   
+   \def\lrcline##1{\@lrcline[##1]}%   
+   \let\rlcline=\lrcline   
+   \setbox\strutbox\hbox{\vrule height.8\baselineskip
+            depth.4\baselineskip width\z@}%
+    \setbox0=\hbox\bgroup\def\@halignto{to #1}%
+        \def\@tabacol{\edef\@preamble{\@preamble 
+            \tabskip \stretchtabsep \hskip \tabcolsep}}\@tabular}
+\@namedef{endtabular*}{\endtabular}
+%
+%    \end{macrocode}
+% \subsection{TABULAR}
+% This is just ordinary \LaTeX\ tabular, apart from the |\hbox|. 
+%    \begin{macrocode}
+\def\TABULAR{%
+     \let\savehline\hline %compatibility
+     \let\rcline\cline \let\lcline\cline 
+     \let\lrcline\cline \let\rlcline\cline 
+     \setbox0=\hbox\bgroup\def\@halignto{}\@tabular}%
+\def\endTABULAR{\crcr\egroup\egroup $\egroup
+  \egroup \tabwidth{\wd0}\unhbox0 }%
+\@namedef{TABULAR*}#1{%
+     \let\savehline\hline %compatibility
+     \let\rcline\cline \let\lcline\cline 
+     \let\lrcline\cline \let\rlcline\cline 
+     \setbox0=\hbox\bgroup\def\@halignto{to #1}\@tabular}%
+\@namedef{endTABULAR*}{\endtabular}
+\endinput
+%    \end{macrocode}
+%\def\IndexParms{\hbadness=10000}
+%\PrintIndex
+%\end{document}
+% end of klutab.sty