diff options
author | Karl Berry <karl@freefriends.org> | 2010-04-15 23:18:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-04-15 23:18:28 +0000 |
commit | d76b75890bbe6fcc8e7417b910a6e548a7a5fe42 (patch) | |
tree | 6e27f4f20eef28d193341a8813df13600d01a7a5 /Master/texmf-dist/source | |
parent | 01645834cb18fc3b9c16d9dfed43a85b5710d923 (diff) |
new latex package tabularborder (15apr10)
git-svn-id: svn://tug.org/texlive/trunk@17885 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/tabularborder/tabularborder.dtx | 515 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/tabularborder/tabularborder.ins | 54 |
2 files changed, 569 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/tabularborder/tabularborder.dtx b/Master/texmf-dist/source/latex/tabularborder/tabularborder.dtx new file mode 100644 index 00000000000..1b6270edb52 --- /dev/null +++ b/Master/texmf-dist/source/latex/tabularborder/tabularborder.dtx @@ -0,0 +1,515 @@ +% \iffalse meta-comment +% +% Copyright (C) Johannes Fink +% ----------------------------------- +% +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.2 +% of this license or (at your option) any later version. +% The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{tabularborder} +%<package> [2010/04/14 v1.0a Tabular without border] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{tabularborder} + +\EnableCrossrefs + +\CodelineIndex + +\RecordChanges + +%\OnlyDescription + +\begin{document} +\DocInput{tabularborder.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{162} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v1.0}{2010/04/03}{Initial version} +% +% \GetFileInfo{tabularborder.sty} +% +% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } +% \DoNotIndex{\@ne} +% \DoNotIndex{\advance,\begingroup,\catcode,\closein} +% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup} +% \DoNotIndex{\bgroup,\egroup,\newcommand} +% \DoNotIndex{\ifx,\fi} +% \DoNotIndex{\let} +% +% \title{The \textsf{tabularborder} package +% \thanks{This document corresponds to \textsf{tabularborder}~\fileversion, +% dated \filedate.}} +% \author{Johannes Fink\\ +% \iffalse\texttt{fink@unileoben.ac.at}\fi +% } +% +% \maketitle +% +% \begin{abstract} +% This package changes the space for horizontal lines +% at the left side and the right side of a |tabular| (but not |array|) to zero space. +% +% \end{abstract} +% \tableofcontents +% \section{Introduction} +% Usually, the |tabular| environment adds a space of |\tabcolsep| on the left side and on the right +% side of the text. For this reason a |\hline|, or a |\toprule|, etc. will exceed the text by +% the total length of 2 |\tabcolsep|. +% \tboff\vskip3ex +% +% \begin{tabular}{llll} +% \toprule +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{l}{multicol 1-2} +% & \multicolumn{2}{l}{multicol 3-4}\\ +% \bottomrule +% \end{tabular} +% +% \begin{verbatim} +% \begin{tabular}{llll} +% \toprule +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{l}{multicol 1-2} +% & \multicolumn{2}{l}{multicol 3-4}\\ +% \bottomrule +% \end{tabular} +% \end{verbatim} +% +% +% If some publishers, or authors, respectively, do +% not like these additional length of the horizontal lines, the |tabular| must be reformatted. +% +% \vskip3ex +% +% \begin{tabular}{@{}llll@{}} +% \toprule +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{@{}l}{multicol 1-2} +% & \multicolumn{2}{l@{}}{multicol 3-4}\\ +% \bottomrule +% \end{tabular} +% +% \begin{verbatim} +% \begin{tabular}{@{}llll@{}} +% \toprule +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{@{}l}{multicol 1-2} +% & \multicolumn{2}{l@{}}{multicol 3-4}\\ +% \bottomrule +% \end{tabular} +% \end{verbatim} +% +% Formatting is done with |@{}|, as shown above. Note that the |\multicolumn| commands must +% be formatted separately. +% In a longer project, such as a thesis or book, +% this reformatting may be a time consuming and a tedious task. +% In particular, if the supervisor of a thesis work changes his opinion about the layout several times +% in the course of correcting. +% +% This package changes the leading and trailing spaces automatically into zero without the need of inserting the |@{}|. +% \tbon\vskip3ex +% \begin{center} +% \begin{tabular}{llll} +% \toprule +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{l}{multicol 1-2} +% & \multicolumn{2}{l}{multicol 3-4}\\ +% \bottomrule +% \end{tabular} +% \end{center} +% +% +% Of course, with such an arrangement, outer +% vertical lines do not make sense, +% and actually, they are displaced if tried anyway. +% By the way, we are using here the package |booktabs|. +% +% +% +% \section{Usage} +% +% Here are some examples: +% \subsection{Basic Example} +% \begin{center} +% \begin{tabular}{llll} +% \toprule +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{l}{multicol 1-2} +% & \multicolumn{2}{l}{multicol 3-4}\\ +% \bottomrule +% \end{tabular} +% \end{center} +% % +% Source code: +% \begin{verbatim} +% \begin{tabular}{llll} +% \toprule +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{l}{multicol 1-2} +% & \multicolumn{2}{l}{multicol 3-4}\\ +% \bottomrule +% \end{tabular} +% \end{verbatim} +% +% \subsection{Odd Example} +% Vertical lines look odd here: +% +% \begin{center} +% \begin{tabular}{|ll|ll|} +% \hline +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{l}{multicol 1-2} +% & \multicolumn{2}{l}{multicol 3-4}\\ +% \hline +% \end{tabular} +% \end{center} +% % +% Source code: +% \begin{verbatim} +% \begin{tabular}{|ll|ll|} +% \hline +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{l}{multicol 1-2} +% & \multicolumn{2}{l}{multicol 3-4}\\ +% \hline +% \end{tabular} +% \end{verbatim} +% +% \subsection{Improved Example} +% But we may switch off the |tabularborder| package with |\tboff|. +% \tboff +% \begin{center} +% \begin{tabular}{|ll|ll|} +% \hline +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{|l|}{multicol 1-2} +% & \multicolumn{2}{l|}{multicol 3-4}\\ +% \hline +% \end{tabular} +% \end{center} +% % +% Source code: +% \begin{verbatim} +% \begin{tabular}{|ll|ll|} +% \hline +% col 1 & col 2 & col 3 & col4\\ +% \multicolumn{2}{|l|}{multicol 1-2} +% & \multicolumn{2}{l|}{multicol 3-4}\\ +% \hline +% \end{tabular} +% \end{verbatim} +% But we had still to manipulate the |\multicolumn| command. +% And now switch on again with |\tbon|. \tbon +% \subsection{Sophisticated Example} +% +% % +% \begin{center} +% \begin{tabular}{>{\sf}l|r@{}l} +% \toprule +% Article & \multicolumn{2}{c}{Price/[USD]} \\ +% \midrule +% Beer & \hskip4ex 3&.40\\ +% Whisky & 8&.20 \\ +% \bottomrule +% \end{tabular} +% \end{center} +% +% Source code: +% \begin{verbatim} +% \begin{tabular}{>{\sf}l|r@{}l} +% \toprule +% Article & \multicolumn{2}{c}{Price/[USD]} \\ +% \midrule +% Beer & \hskip4ex 3&.40\\ +% Whisky & 8&.20 \\ +% \bottomrule +% \end{tabular} +% \end{verbatim} +% +% +% \subsection{Example Using Helpers} +% +% \begin{tabular} +% {b{0.5\tabcolwidthii\hangindent2ex}% +% b{0.5\tabcolwidthii\hangindent2ex}} +% \toprule +% Article & Remark \\ +% \midrule +% Beer & Note that this article +% can be sold only +% in special shops\\ +% Whisky & --- \\ +% \bottomrule +% \end{tabular} +% \vskip3ex +% Source code: +% \begin{verbatim} +% \begin{tabular} +% {b{0.5\tabcolwidthii\hangindent2ex}% +% b{0.5\tabcolwidthii\hangindent2ex}} +% \toprule +% Article & Remark \\ +% \midrule +% Beer & Note that this article +% can be sold only +% in special shops\\ +% Whisky & --- \\ +% \bottomrule +% \end{tabular} +% \end{verbatim} +% +% \subsection{Example Using Helpers} +% \label{2010.04.03.17:45} +% +% \begin{tabular} +% {b{0.25\tabcolwidthiv\hangindent2ex}% +% b{0.25\tabcolwidthiv\hangindent2ex}% +% b{0.25\tabcolwidthiv\hangindent2ex}% +% b{0.25\tabcolwidthiv\hangindent2ex}}% +% \toprule +% Article &\hskip-2ex Code & \hskip-4ex Subcode & Remark\\ +% \midrule +% Beer &B&12 & Note that this article +% can be sold only +% in special shops\\ +% Whisky &W&10& --- \\ +% \bottomrule +% \end{tabular} +% \vskip3ex +% Source code: +% \begin{verbatim} +% \begin{tabular} +% {b{0.25\tabcolwidthiv\hangindent2ex}% +% b{0.25\tabcolwidthiv\hangindent2ex}% +% b{0.25\tabcolwidthiv\hangindent2ex}% +% b{0.25\tabcolwidthiv\hangindent2ex}}% +% \toprule +% Article &\hskip-2ex Code & \hskip-4ex Subcode & Remark\\ +% \midrule +% Beer &B&12 & Note that this article +% can be sold only +% in special shops\\ +% Whisky &W&10& --- \\ +% \bottomrule +% \end{tabular} +% \end{verbatim} +% +% \subsection{Array Example} +% The |array| environment is left as before: +% \[ +% \begin{array}{lcr} +% \toprule +% x^2+y^2 &=& z^2\\ +% \end{array} +% \] +% \vskip3ex +% Source code: +% \begin{verbatim} +% \[ +% \begin{array}{lcr} +% \toprule +% x^2+y^2 &=& z^2\\ +% \end{array} +% \] +% \end{verbatim} +% \subsection{Example Using Tabular Star Form} +% +% The following does not make sense: +% \vskip3ex +% \begin{tabular*}{0.5\textwidth}{@{}lr} +% \toprule +% first column & second column\\ +% first column & next second column\\ +% \bottomrule +% \end{tabular*} +% +% \vskip3ex +% Source code: +% \vskip3ex +% +% +% \begin{verbatim} +% \begin{tabular*}{0.5\textwidth}{@{}lr} +% \toprule +% first column & second column\\ +% first column & next second column\\ +% \bottomrule +% \end{tabular*} +% \end{verbatim} +% +% +% +% \subsection{Nested Tabular Example} +% +% A nested tabular: +% \vskip3ex +% \begin{tabular}{ll} +% \toprule +% first column & second column\\ +% first column & next second column\\ +% \bottomrule +% \multicolumn{2}{l} +% {\begin{tabular}{ll} +% \textsuperscript{a} & A nested tabular, longer in this field now \\ +% \end{tabular}}\\ +% \end{tabular} +% +% \vskip3ex +% Source code: +% \vskip3ex +% +% +% \begin{verbatim} +% \begin{tabular}{ll} +% \toprule +% first column & second column\\ +% first column & next second column\\ +% \bottomrule +% \multicolumn{2}{l} +% {\begin{tabular}{ll} +% \textsuperscript{a} & A nested tabular, longer in this field now \\ +% \end{tabular}}\\ +% \end{tabular} +% \end{verbatim} +% +% +% +% +% +% +% \StopEventually{\PrintIndex} +% +% \section{Implementation} +% +%\iffalse +%<*package> +%\fi +% \begin{macro}{\RequirePackage} +% This package has been tested based on the following package: +% \begin{macrocode} +\RequirePackage{booktabs} +\RequirePackage{array}[2003/12/17 v2.4a Tabular extension package (FMi)] +% \end{macrocode} +% However, the examples given here are working with version |v2.4c| too. +% \end{macro} +% \begin{macro}{\tb@ialign} +% We redefine |\ialign|, |\tabskip| into |-\col@sep|: +% \begin{macrocode} +\newcommand{\tb@ialign}{\everycr{}\tabskip-\col@sep\halign} +% \end{macrocode} +% Here we change definitions so that only the |tabular| is involved. +% \begin{macrocode} +\newcommand{\tb@tbtabarray}{\@ifnextchar[{\tb@array}{\tb@array[c]}} +\def\@tabular{% + \leavevmode + \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup + \let\d@llarend\endgroup + \@tb@tbtabarray} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\tbon \tboff} +% The following allows to switch back to the original settings by |\tboff| and reactivate by |\tbon|. +% \begin{macrocode} +\newcommand{\@tb@tbtabarray}{} +\newcommand{\tbon}{\global\let\@tb@tbtabarray\tb@tbtabarray} +\tbon +\newcommand{\tboff}{\global\let\@tb@tbtabarray\@tabarray} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\tb@array} +% We change the definition of the macro |\@@array| and rename it. +% Only three changes are needed, but we must place the full macro. +% \begin{macrocode} +\newcommand{\tb@array}{} +\def\tb@array[#1]#2{% + \@tempdima \ht \strutbox + \advance \@tempdima by\extrarowheight + \setbox \@arstrutbox \hbox{\vrule + \@height \arraystretch \@tempdima + \@depth \arraystretch \dp \strutbox + \@width \z@}% +% \end{macrocode} +% \begin{macrocode} + \begingroup + \@mkpream{#2}% +% \end{macrocode} +% Here we use |\tb@ialign|, and in the next line we reset the |\tabskip|. +% \begin{macrocode} + \xdef\@preamble{\noexpand \tb@ialign \@halignto + \bgroup \@arstrut \tabskip \z@skip \@preamble +% \end{macrocode} +% In the next line we are switching the |\tabskip| to +% |-\col@sep|. +% \begin{macrocode} + \tabskip-\col@sep \cr}% +% \end{macrocode} +% The rest of the macro is unchanged. +% \begin{macrocode} + \endgroup + \@arrayleft + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi + \bgroup + \let \@sharp ##\let \protect \relax + \lineskip \z@ + \baselineskip \z@ + \m@th + \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble} +% \end{macrocode} +% \end{macro} +% +% \subsection{Additional Helpers} +% Here are some additional definitions that facilitate the handling of a tabular. +% An example is given in section \ref{2010.04.03.17:45}. +% \begin{macrocode} +\ifdefined\tabcolwidthi\else\newlength{\tabcolwidthi}\fi +\ifdefined\tabcolwidthii\else\newlength{\tabcolwidthii}\fi +\ifdefined\tabcolwidthiii\else\newlength{\tabcolwidthiii}\fi +\ifdefined\tabcolwidthiv\else\newlength{\tabcolwidthiv}\fi +\setlength{\tabcolwidthi}{\textwidth} +\addtolength{\tabcolwidthi}{-0\tabcolsep} +\setlength{\tabcolwidthii}{\textwidth} +\addtolength{\tabcolwidthii}{-2\tabcolsep} +\setlength{\tabcolwidthiii}{\textwidth} +\addtolength{\tabcolwidthiii}{-4\tabcolsep} +\setlength{\tabcolwidthiv}{\textwidth} +\addtolength{\tabcolwidthiv}{-6\tabcolsep} +% \end{macrocode} +%\iffalse +%</package> +%\fi +% \PrintChanges +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/tabularborder/tabularborder.ins b/Master/texmf-dist/source/latex/tabularborder/tabularborder.ins new file mode 100644 index 00000000000..d08094f8f3f --- /dev/null +++ b/Master/texmf-dist/source/latex/tabularborder/tabularborder.ins @@ -0,0 +1,54 @@ +%% +%% Copyright (C) Johannes Fink +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.2 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.2 or later is part of all distributions of +%% LaTeX version 1999/12/01 or later. +%% +\input docstrip.tex +\keepsilent +\usedir{tex/latex/tabularborder} +\preamble + +This is a generated file. +Copyright (C) Johannes Fink + +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version +1.2 of this license or (at your option) any later version. The +latest version of this license is in: +http://www.latex-project.org/lppl.txt and version 1.2 or later is +part of all distributions of LaTeX version 1999/12/01 or later. + +\endpreamble + +\generate{\file{tabularborder.sty}{\from{tabularborder.dtx}{package}}} + + +\Msg{*********************************************************} + +\Msg{*} + +\Msg{* To finish the installation you have to move the} + +\Msg{* following file into a directory searched by TeX:} + +\Msg{*} + +\Msg{* \space\space tabularborder.sty} + +\Msg{*} + +\Msg{* To produce the documentation run the file tabularborder.dtx} + +\Msg{* through LaTeX.} + +\Msg{*********************************************************} + +\endbatchfile |