summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/shipunov/tex/sltables.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/shipunov/tex/sltables.sty')
-rw-r--r--macros/latex/contrib/shipunov/tex/sltables.sty267
1 files changed, 267 insertions, 0 deletions
diff --git a/macros/latex/contrib/shipunov/tex/sltables.sty b/macros/latex/contrib/shipunov/tex/sltables.sty
new file mode 100644
index 0000000000..b6238e8678
--- /dev/null
+++ b/macros/latex/contrib/shipunov/tex/sltables.sty
@@ -0,0 +1,267 @@
+% Modified from the original LaTeX 2.09 sources by Alexey Shipunov, dactylorhiza@gmail.com
+
+\ProvidesPackage{sltables}
+ [2008/02/07 v1.2 S-Tables LaTeX package]
+
+% Some modifications to LaTeX: aded LaTeX 2.09 counter
+\newcount\mscount
+
+%
+% S-Tables Macro v1.0, ACS, TAMU (RANHELP@VENUS.TAMU.EDU)
+%
+% Help Text
+%
+\newhelp\stablestylehelp{You must choose a style between 0 and 3.}%
+\newhelp\stablelinehelp{You should not use special hrules when stretching
+a table.}%
+\newhelp\stablesmultiplehelp{You have tried to place an S-Table inside another
+S-Table. I would recommend not going on.}%
+%
+% Line Thicknesses (Values)
+%
+\newdimen\stablesthinline
+\stablesthinline=0.4pt
+\newdimen\stablesthickline
+\stablesthickline=1pt
+%
+% Border and Internal Line Thicknesses
+%
+\newif\ifstablesborderthin
+\stablesborderthinfalse
+\newif\ifstablesinternalthin
+\stablesinternalthintrue
+\newif\ifstablesomit
+\newif\ifstablemode
+\newif\ifstablesright
+\stablesrightfalse
+%
+% Save Registers
+%
+\newdimen\stablesbaselineskip
+\newdimen\stableslineskip
+\newdimen\stableslineskiplimit
+%
+% Counters
+%
+\newcount\stablesmode
+\newcount\stableslines
+\newcount\stablestemp
+\stablestemp=3
+\newcount\stablescount
+\stablescount=0
+\newcount\stableslinet
+\stableslinet=0
+%
+% Table Style Selection
+%
+% 0 - Centered
+% 1 - Left Justified
+% 2 - Right Justified
+% 3 - Not Justified
+%
+\newcount\stablestyle
+\stablestyle=0
+%
+% Element Buffering Definitions
+%
+\def\stablesleft{\quad\hfil}%
+\def\stablesright{\hfil\quad}%
+%
+% Vertical Bar Activation <== changed!
+%
+{\catcode`\|=\active
+\gdef\Start@Bar{%
+\global\catcode`\|=\active
+ \global\def|{\global\advance\stablesmode by 1&&&}%
+ \global\def\|{\global\advance\stablesmode by 1&\omit\vrule width 0pt%
+\hfil&&}}}%
+%
+%
+% Strut Control
+%
+\newcount\stablestrutsize
+\newbox\stablestrutbox
+\setbox\stablestrutbox=\hbox{\vrule height10pt depth5pt width0pt}
+\def\stablestrut{\relax\ifmmode%
+ \copy\stablestrutbox%
+ \else%
+ \unhcopy\stablestrutbox%
+ \fi}%
+%
+% Misc. Internal Stuff
+%
+\newdimen\stablesborderwidth
+\newdimen\stablesinternalwidth
+\newdimen\stablesdummy
+\newcount\stablesdummyc
+\newif\ifstablesin
+\stablesinfalse
+%
+% Table Macros
+%
+\def\stable{\Start@Bar\stablestart% <== changed!
+ \stablemodetrue%
+ \stablesadj%
+ \halign%
+ \stablesdef}%
+\def\stableto#1{\Start@Bar\stablestart% <== changed!
+ \stablemodefalse%
+ \stablesadj%
+ \halign to #1%
+ \stablesdef}%
+\def\stablesp#1{\Start@Bar\stablestart% <== changed!
+ \stablemodefalse%
+ \stablesadj%
+ \halign spread #1%
+ \stablesdef}%
+\def\stablesadj{%
+ \ifcase\stablestyle%
+ \hbox to \hsize\bgroup\hss\vbox\bgroup%
+ \or%
+ \hbox to \hsize\bgroup\vbox\bgroup%
+ \or%
+ \hbox to \hsize\bgroup\hss\vbox\bgroup%
+ \or%
+ \hbox\bgroup\vbox\bgroup%
+ \else%
+ \errhelp=\stablestylehelp%
+ \errmessage{Invalid style selected, using default}%
+ \hbox to \hsize\bgroup\hss\vbox\bgroup%
+ \fi}%
+\def\stablesend{\egroup%
+ \ifcase\stablestyle%
+ \hss\egroup%
+ \or%
+ \hss\egroup%
+ \or%
+ \egroup%
+ \or%
+ \egroup%
+ \else%
+ \hss\egroup%
+ \fi}%
+\def\stablestart{%
+ \ifstablesin%
+ \errhelp=\stablesmultiplehelp%
+ \errmessage{An S-Table cannot be placed within an S-Table!}%
+ \fi
+ \global\stablesintrue%
+ \global\advance\stablescount by 1%
+ \message{<S-Tables Generating Table \number\stablescount}%
+ \begingroup%
+ \stablestrutsize=\ht\stablestrutbox%
+ \advance\stablestrutsize by \dp\stablestrutbox%
+ \ifstablesborderthin%
+ \stablesborderwidth=\stablesthinline%
+ \else%
+ \stablesborderwidth=\stablesthickline%
+ \fi%
+ \ifstablesinternalthin%
+ \stablesinternalwidth=\stablesthinline%
+ \else%
+ \stablesinternalwidth=\stablesthickline%
+ \fi%
+ \tabskip=0pt%
+ \stablesbaselineskip=\baselineskip%
+ \stableslineskip=\lineskip%
+ \stableslineskiplimit=\lineskiplimit%
+ \offinterlineskip%
+ \def\borderrule{\vrule width \stablesborderwidth}%
+ \def\internalrule{\vrule width \stablesinternalwidth}%
+%
+ \def\thinline{\noalign{\hrule height \stablesthinline}}%
+ \def\thickline{\noalign{\hrule height \stablesthickline}}%
+ \def\trule{\omit\leaders\hrule height \stablesthinline\hfill}%
+ \def\ttrule{\omit\leaders\hrule height \stablesthickline\hfill}%
+ \def\tttrule##1{\omit\leaders\hrule height ##1\hfill}%
+ \def\stablesel{&\omit\global\stablesmode=0%
+ \global\advance\stableslines by 1\borderrule\hfil\cr}%
+ \def\el{\stablesel&}%
+ \def\elt{\stablesel\thinline&}%
+ \def\eltt{\stablesel\thickline&}%
+ \def\elttt##1{\stablesel\noalign{\hrule height ##1}&}%
+ \def\elspec{&\omit\hfil\borderrule\cr\omit\borderrule&%
+ \ifstablemode%
+ \else%
+ \errhelp=\stablelinehelp%
+ \errmessage{Special ruling will not display properly}%
+ \fi}%
+%
+ \def\stmultispan##1{\mscount=##1 \loop\ifnum\mscount>3 \stspan\repeat}%
+ \def\stspan{\span\omit \advance\mscount by -1}%
+%
+ \def\multicolumn##1{\omit\multiply\stablestemp by ##1%
+ \stmultispan{\stablestemp}%
+ \advance\stablesmode by ##1%
+ \advance\stablesmode by -1%
+ \stablestemp=3}%
+ \def\multirow##1{\stablesdummyc=##1\parindent=0pt\setbox0\hbox\bgroup%
+ \aftergroup\emultirow\let\temp=}
+ \def\emultirow{\setbox1\vbox to\stablesdummyc\stablestrutsize%
+ {\hsize\wd0\vfil\box0\vfil}%
+ \ht1=\ht\stablestrutbox%
+ \dp1=\dp\stablestrutbox%
+ \box1}%
+%
+% \def\stvcen##1{\vtop{\vfill\hbox{##1}\vfill}}% Currently does not work!
+ \def\stpar##1{\vtop\bgroup\hsize ##1%
+ \baselineskip=\stablesbaselineskip%
+ \lineskip=\stableslineskip%
+ \lineskiplimit=\stableslineskiplimit\bgroup\aftergroup\estpar\let\temp=}%
+ \def\estpar{\vskip 6pt\egroup}%
+ \def\stparrow##1##2{\stablesdummy=##2%
+ \setbox0=\vtop to ##1\stablestrutsize\bgroup%
+ \hsize\stablesdummy%
+ \baselineskip=\stablesbaselineskip%
+ \lineskip=\stableslineskip%
+ \lineskiplimit=\stableslineskiplimit%
+ \bgroup\vfil\aftergroup\estparrow%
+ \let\temp=}%
+ \def\estparrow{\vfil\egroup%
+ \ht0=\ht\stablestrutbox%
+ \dp0=\dp\stablestrutbox%
+ \wd0=\stablesdummy%
+ \box0}%
+%
+ \def\vt{\global\advance\stablesmode by 1&\omit\vrule width \stablesthinline%
+ \hfil&&}%
+ \def\vtt{\global\advance\stablesmode by 1&\omit\vrule width \stablesthickline%
+ \hfil&&}%
+ \def\vttt##1{\global\advance\stablesmode by 1&\omit\vrule width ##1%
+ \hfil&&}%
+ \def\vtr{\global\advance\stablesmode by 1&\omit\hfil\vrule width%
+ \stablesthinline&&}%
+ \def\vttr{\global\advance\stablesmode by 1&\omit\hfil\vrule width%
+ \stablesthickline&&}%
+ \def\vtttr##1{\global\advance\stablesmode by 1&\omit\hfil\vrule width ##1&&}%
+ \stableslines=0%
+ \stablesomitfalse}
+%
+\def\stablesdef{\bgroup\stablestrut\borderrule##\tabskip=0pt plus 1fil%
+ &\stablesleft##\stablesright%
+ &##\ifstablesright\hfill\fi\internalrule\ifstablesright\else\hfill\fi%
+ \tabskip 0pt&&##\hfil\tabskip=0pt plus 1fil%
+ &\stablesleft##\stablesright%
+ &##\ifstablesright\hfill\fi\internalrule\ifstablesright\else\hfill\fi%
+ \tabskip=0pt\cr%
+ \ifstablesborderthin%
+ \thinline%
+ \else%
+ \thickline%
+ \fi&%
+}%
+\def\endstable{\advance\stableslines by 1\advance\stablesmode by 1% <== changed!
+ \message{- Rows: \number\stableslines, Columns: \number\stablesmode>}%
+ \stablesel%
+ \ifstablesborderthin%
+ \thinline%
+ \else%
+ \thickline%
+ \fi%
+ \egroup\stablesend%
+\endgroup%
+\global\stablesinfalse%
+\global\catcode`\|=12}% <== new!
+\let\endstableto\endstable% <== new!
+\let\endstablesp\endstable% <== new!
+%