diff options
author | Karl Berry <karl@freefriends.org> | 2017-08-13 21:01:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-08-13 21:01:29 +0000 |
commit | d321aa6f41b135b877d844c29d2dc89338b90235 (patch) | |
tree | e00cf4cdb648fae42e44b1f450d85fac61ac2e65 | |
parent | 2887cf9346f189a57ee10dc903f5237b64880edb (diff) |
cellspace (13aug17)
git-svn-id: svn://tug.org/texlive/trunk@45034 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/cellspace/README | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/cellspace/cellspace.pdf | bin | 340602 -> 331414 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/cellspace/cellspace.tex | 163 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cellspace/cellspace.sty | 38 |
4 files changed, 49 insertions, 164 deletions
diff --git a/Master/texmf-dist/doc/latex/cellspace/README b/Master/texmf-dist/doc/latex/cellspace/README index cd395219f2c..74f6e9d4db4 100644 --- a/Master/texmf-dist/doc/latex/cellspace/README +++ b/Master/texmf-dist/doc/latex/cellspace/README @@ -1,4 +1,4 @@ -% (C) 2006-2009 Josselin Noirel +% (C) 2006-2017 Josselin Noirel % % Package cellspace: Ensuring a minimal spacing of table cells. % @@ -13,6 +13,10 @@ horizontal rules. This package provides a modifier S to usual column types (l, c, r, p, m, and b) that ensures a minimal spacing between rules and cells of an array. -v1.6: New feature as suggested by Bastien Roucaries - an option [math] -has been introduced, which allows to use cellspace's features into -matrix environments. +v1.6: New feature as suggested by Bastien Roucaries: an option [math] + has been introduced, which allows to use cellspace's features into + matrix environments. + +v1.7: New features as suggested by Bastien Roucaries: (1) Possibility + to change the name of the column used for spacing; (2) Make the + math column independent of the colum name. diff --git a/Master/texmf-dist/doc/latex/cellspace/cellspace.pdf b/Master/texmf-dist/doc/latex/cellspace/cellspace.pdf Binary files differindex 62baa91cfa9..d4754ed27db 100644 --- a/Master/texmf-dist/doc/latex/cellspace/cellspace.pdf +++ b/Master/texmf-dist/doc/latex/cellspace/cellspace.pdf diff --git a/Master/texmf-dist/doc/latex/cellspace/cellspace.tex b/Master/texmf-dist/doc/latex/cellspace/cellspace.tex index ccfde640689..df0315a0086 100644 --- a/Master/texmf-dist/doc/latex/cellspace/cellspace.tex +++ b/Master/texmf-dist/doc/latex/cellspace/cellspace.tex @@ -1,15 +1,13 @@ -% (C) 2006-2009 Josselin Noirel +% (C) 2006-2017 Josselin Noirel % % Package cellspace: Ensuring a minimal spacing of table cells. % % This material is subject to the LaTeX Project Public License. See % http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html . % -\def \tempa $#1 #2 #3 #4 #5 #6 #7 ${% - \def \filedate {#4}% - \def \fileversion {v#3}% -} -\tempa $Id: cellspace.tex,v 1.6 2009/07/31 09:00:00 noirel Exp $ +\def \filedate {2017/08/12}% +\def \fileversion {v1.7}% + \ProvidesFile{cellspace}% [\filedate \space \fileversion \space cellspace documentation (JN)] \pdfoutput = 1 @@ -114,7 +112,7 @@ an array. \end{abstract} -\section {Introduction} +\section{Introduction} The mechanism used by \LaTeX{} to build tables---using struts---has an important consequence: the cells of a table that extend too much tend to @@ -293,7 +291,6 @@ layout is obtained with \pack{booktabs}: \end{tabular} } - The following example shows that how it works with paragraph columns. % \compare{% @@ -359,6 +356,20 @@ As a~consequence, the \tex{amsmath} package can be loaded beforehand with other packages (such as \tex{empheq} or \tex{mathtools}), were an incompatibility to arise from one's loading it later. +\section{Using a different column name} + +An other column name than \tex{S} can be used if \tex{S} conflicts +with the user's own definitions or a package's. A keyval option can +be passed to the package to that effect; +% +\begin{verbatim} +\usepackage[column=O]{cellspace} +\end{verbatim} +% +can be used to provide cellspace's functionality through the \tex{O} +column modifier instead of the \tex{S} column modifier. + + \section{Bugs and limitations} This package hasn't been heavily tested, so there may be plenty of bugs. @@ -389,7 +400,7 @@ particular. \end{trivlist} \pack{tabls}\footnote{Thanks to Jim Hefferon for pointing this out.} is a -package that does a similar job than \pack{cellspace}. +package that does a similar job as \pack{cellspace}. The differences are: \pack{tabls} affects a whole table while \pack{cellspace} affects only the columns on which applies the modifier \tex{S}. Each cell affected by \pack{cellspace} is affected in the same @@ -403,137 +414,3 @@ distance to the rule is big enough). As a last point, \pack{tabls}, as far as I can see, cannot work with \pack{array}. \end{document} - -Old documentation: - - - DOCUMENTATION - - Abstract - This package is intended to allow automatic spacing out of - the lines of an array. People often complain about text touching the - \hline of a tabular when it is too high or too deep. For example (with - the amsmath package) a \dfrac{1}{2} surrounded by \hlines touches the - horizontal rules. Spacing out can be achieved through two mechanims - - 1. The optional argument of \\[<dimen>] but <dimen> is not necessarily - added it simply ensures that the distance between two rows will be at - least the normal depth (\dp\@arstrutbox) plus <dimen>. It a cell is - deeper than this value, no spacing is actually done; furthermore even - if some spacing occurs it is not computed according the actual depth, - needing a fine tuning by hand by the user. - - 2. \noalign{\vspace{<dimen>}} that presents the drawback of breaking out - the vertical rules (even though, admittedly, vertical rules are often - overused). Another disadvantage is that it spaces out everytime even - when no spacing is needed. Again, the user has to intervene by hand - and check it out before taking any decision. - - We believe a better solution can be easily provided through a modifier - of normal column types: S (for spacing of course). A column l would be - now be declared Sl, c becomes Sc, r becomes Sr. Special care is needed - for paragraph columns: p{<dimen>} becomes S{p{<dimen>}}, etc. - - What happens is that if the text inside the column has a height that - makes it too close from the top of the cell (more precisely closer than - \cellspacetoplimit) then the height of the cell is increased of - \cellspacetoplimit. Conversely, if the depth of a cell makes it too - close of the bottom of the cell (more precisely closer than - \cellspacebottomlimit), then \cellspacebottomlimit is added to the - actual depth to ensure a minimal spacing. The values of - \cellspace{top,bottom}limit can be changed by - - \setlength{\cellspacetoplimit}{<dimen>} - \setlength{\cellspacebottomlimit}{<dimen>} - - Actually the modifier S acts very differently depending on if it is - working on a LR mode column (l, c, and r) or on a paragraph column - (p{<dimen>}, m{<dimen>}, and b{<dimen>}). If you declare a new column - type and use S with it, S will assume that it is a LR mode column. For - a paragraph column type, use in the preamble - - \addparagraphcolumntypes{<paragraph types>} - - Example file - - \documentclass{article} - - \usepackage{cellspace} - \usepackage{booktabs} - - \begin{document} - - \begin{tabular}[t]{l} - \hline - $\displaystyle \frac{1}{2}$ \\ - \hline - \end{tabular}\quad - \begin{tabular}[t]{Sl} - \hline - $\displaystyle \frac{1}{2}$ \\ - \hline - \end{tabular} - - \vspace*{\stretch{1}} - - \begin{tabular}[t]{l} - \toprule - $\displaystyle \frac{1}{2}$ \\ - \bottomrule - \end{tabular}\quad - \begin{tabular}[t]{Sl} - \toprule - $\displaystyle \frac{1}{2}$ \\ - \bottomrule - \end{tabular} - - \vspace*{\stretch{1}} - - \begin{tabular}[t]{p{5cm}} - \hline - $\displaystyle \frac{1}{2}$ - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - $\displaystyle \frac{1}{2}$ \\ - \hline - \end{tabular}\quad - \begin{tabular}[t]{S{p{5cm}}} - \hline - $\displaystyle \frac{1}{2}$ - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - $\displaystyle \frac{1}{2}$ \\ - \hline - \end{tabular} - - \vspace*{\stretch{1}} - - \begin{tabular}[t]{p{5cm}} - \toprule - $\displaystyle \frac{1}{2}$ - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - $\displaystyle \frac{1}{2}$ \\ - \bottomrule - \end{tabular}\quad - \begin{tabular}[t]{S{p{5cm}}} - \toprule - $\displaystyle \frac{1}{2}$ - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - A A A A A A A A A A A A A A - $\displaystyle \frac{1}{2}$ \\ - \bottomrule - \end{tabular} - - \end{document} diff --git a/Master/texmf-dist/tex/latex/cellspace/cellspace.sty b/Master/texmf-dist/tex/latex/cellspace/cellspace.sty index 387025e669d..393e803ff31 100644 --- a/Master/texmf-dist/tex/latex/cellspace/cellspace.sty +++ b/Master/texmf-dist/tex/latex/cellspace/cellspace.sty @@ -1,23 +1,21 @@ -% (C) 2006-2009 Josselin Noirel +% (C) 2006-2017 Josselin Noirel % % Package cellspace: Ensuring a minimal spacing of table cells. % % This material is subject to the LaTeX Project Public License. See % http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html . % -\def \@tempa $#1 #2 #3 #4 #5 #6 #7 ${% - \def \filedate {#4}% - \def \fileversion {v#3}% -} -\@tempa $Id: cellspace.sty,v 1.6 2009/07/31 09:00:00 noirel Exp $ +\def \filedate {2017/08/12}% +\def \fileversion {v1.7}% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{cellspace}% [\filedate \space \fileversion \space Spacing table cells (JN)] -\RequirePackage{ifthen} % \newboolean, \ifthenelse -\RequirePackage{array} % \newcolumntype, \@{start,end}pbox -\RequirePackage{calc} % \setlength{<dimen>}{<expression>} +\RequirePackage{ifthen} % \newboolean, \ifthenelse +\RequirePackage{array} % \newcolumntype, \@{start,end}pbox +\RequirePackage{calc} % \setlength{<dimen>}{<expression>} +\RequirePackage{xkeyval} % key=val options % 2. Check the definitions of \@startpbox and \@endpbox % from array.sty @@ -51,11 +49,12 @@ % Options -\DeclareOption{math}{\setboolean{cellspace@m}{true}} -\DeclareOption{nomath}{\setboolean{cellspace@m}{false}} +\DeclareOptionX{math}{\setboolean{cellspace@m}{true}} +\DeclareOptionX{nomath}{\setboolean{cellspace@m}{false}} +\define@key{cellspace.sty}{column}{\def\cellspace@column{#1}} -\ExecuteOptions{nomath} -\ProcessOptions +\ExecuteOptionsX{nomath, column=S} +\ProcessOptionsX % 4. Redefinitions @@ -82,6 +81,7 @@ \par % Save the depth of the last line \global \cellspace@lastdp = \prevdepth + \expandafter % v1.7 This expandafter is now important \color@endgroup % \ifcellspace@ is only locally true, so we need to expand it before % \egroup stops it action @@ -128,13 +128,17 @@ \def \env@matrix {% \hskip -\arraycolsep \let \@ifnextchar \new@ifnextchar - \array{*{\c@MaxMatrixCols}{>{$}Sc<{$}}@{}}% - } + \array{% + *{\c@MaxMatrixCols}% + {>{\bcolumn c\@nil$}c<{$\ecolumn}}@{}}}% \fi % 5. Defining a prefix -\newcolumntype{S}[1]{>{\bcolumn #1\@nil}#1<{\ecolumn}} +\expandafter +\newcolumntype +\expandafter{\cellspace@column}[1]% + {>{\bcolumn #1\@nil}#1<{\ecolumn}} \newcommand*{\bcolumn}{} \def \bcolumn #1#2\@nil {% @@ -146,7 +150,7 @@ \ifcellspace@lr \begingroup \lrbox {\@tempboxa}% \else - \setboolean{cellspace@}{true}% + \cellspace@true \fi } |