summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tablists
diff options
context:
space:
mode:
authorDr. Clea F. Rees <cfrees@imapmail.org>2009-08-07 00:50:27 +0000
committerDr. Clea F. Rees <cfrees@imapmail.org>2009-08-07 00:50:27 +0000
commit4d5ea40067f8dca80c5bc08220a04cb67fc9beb6 (patch)
tree1809c2274973b662b95fae7899eff46e0d06c79f /Master/texmf-dist/source/latex/tablists
parent455929a0c1883616bb0b4db84ac28502a76dce13 (diff)
tablists new version
git-svn-id: svn://tug.org/texlive/trunk@14566 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tablists')
-rw-r--r--Master/texmf-dist/source/latex/tablists/tablists.dtx146
1 files changed, 88 insertions, 58 deletions
diff --git a/Master/texmf-dist/source/latex/tablists/tablists.dtx b/Master/texmf-dist/source/latex/tablists/tablists.dtx
index b9cf47e5550..df558fa4f94 100644
--- a/Master/texmf-dist/source/latex/tablists/tablists.dtx
+++ b/Master/texmf-dist/source/latex/tablists/tablists.dtx
@@ -16,7 +16,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{tablists}
%<*package>
- [2008/01/14 v0.0d (beta) Tabulated list of short items]
+ [2009/08/04 v0.0e (beta) Tabulated list of short items]
%</package>
%
%<*batchfile>
@@ -59,7 +59,7 @@
\clubpenalty10000
\makeatother
\providecommand*{\file}[1]{\texttt{#1}}
-\providecommand*{\pkg}[1]{\textsf{#1}}
+\providecommand*{\package}[1]{\textsf{#1}}
\providecommand*{\cls}[1]{\textsf{#1}}
\providecommand*{\env}[1]{\texttt{#1}}
@@ -105,8 +105,8 @@
%
% Each item starts with |\tabenumitem| command.
% First example of \env{tabenum} list---please note that you may set optional
-% argument in the same way as in modified environments from \pkg{enumerate}
-% or \pkg{paralist} packages:
+% argument in the same way as in modified environments from \package{enumerate}
+% or \package{paralist} packages:
%\par\begin{small}%
%\begin{verbatim}
%\begin{tabenum}[\bfseries1)]%
@@ -265,23 +265,20 @@
%
% Vertical spaces around tabulated list are equal to the list ones |\topsep+\partopsep|.
%
-% Space between rows depends on the |\jot| value, like in \pkg{amsmath} environments
-% like \env{align}, \pkg{gather} etc.
+% Space between rows depends on the |\jot| value, like in \package{amsmath} environments
+% like \env{align}, \package{gather} etc.
%
% \DescribeMacro{\tabenumsep}
% The horizontal spacing between items of list. It defined like:
% \begin{quote}
-% |\newcommand\tabenumsep{\hskip1em}|
+% |\renewcommand\tabenumsep{\hskip1em}|
% \end{quote}
% The |\labelsep| parameter is used after item number.
%
-% \subsection{The \env{tabenum} environment inside a proper list}
-%
% \DescribeMacro{\tabenumindent}
-% The |\tabenumindent| macro sets left margin of \env{tabenum}. That could be useful
-% inside, e.g., a proper list environments like \env{enumerate} or \env{itemise}.
-% It can be defined like horizontal space/skip or text.
-% For example:
+% The |\tabenumindent| command sets left margin of \env{tabenum} environment.
+% It can be defined like horizontal space/skip or text,
+% for example:
% \begin{quote}
% |\renewcommand\tabenumindent{\hskip\parindent}|
% \end{quote}
@@ -289,28 +286,37 @@
% \begin{quote}
% |\renewcommand\tabenumindent{Word }|
% \end{quote}
+% That could be useful also
+% inside, e.g., a proper list environments like \env{enumerate} or \env{itemise}
+% for corrections of left margins.
%
-% \DescribeMacro{\liststrut}
-% This command can be useful after alone list number (and not only with
-% \env{tabenum} environment). The command raises first line of next
-% text block at the baseline of previous. Without any option it puts negative
-% baselineskip. If there is a high element (any math sentence) in the first
-% line of next text, it must be written in option, the height of this argument used for
-% compensating skips argument without |$|'s.
+% \subsection{The \env{tabenum} environment inside a proper list}
%
-% Here the combination of these two commands:
+% The version 0.0e of \package{tablists} package enlarges left margin
+% of \env{tabenum}, when environment appears inside proper list,
+% by the value of left margin of this list. Sometimes left edges
+% of \env{tabenum} labels and list labels of the same level are not aligned
+% correctly (it happens when |\labelwidth| value is not equal to the natural
+% width of labels). In these cases you may define the correction skip
+% with the |\tabenumindent| command.
+%
+% Also the version 0.0e loads labels of empty items of upper/outer list
+% at the left side of the first item of \env{tabenum} automatically. It follows
+% mechanism similar to building of empty items in list environment.
+% (Empty items of \LaTeX\ list are consecutively stored to special box register
+% and printed out at the beginning when the list text appears;
+% the same happens at the beginning of \env{tabenum} environment:
+% this box, if not empty, is printed at the left of first \env{tabenum} item.)
%\par\begin{small}%
%\begin{verbatim}
%\begin{enumerate}[\bfseries1)]%
-%\item\renewcommand\tabenumindent{1)\hskip\labelsep}%
-% \liststrut[\displaystyle\frac /y]
+%\item
%\begin{tabenum}[a)]%
%...
%\end{verbatim}%
%\end{small}%
% \begin{enumerate}[\bfseries1)]%
-% \item\renewcommand\tabenumindent{1)\hskip\labelsep}%
-% \liststrut[\displaystyle\frac /y]
+% \item
% \begin{tabenum}[a)]%
% \item
% {$z=\displaystyle\frac xy$};
@@ -336,11 +342,30 @@
% \item
% $2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\skipitem
% \item
-% $t=5u^2+8v^2$;
-% \end{tabenum}
+% $t=5u^2+8v^2$.%
+% \end{tabenum}%
% \end{enumerate}%
-% \emph{Note}: The |\liststrut| not always works correctly.\RestoreSpaces
-%
+%\par\kern-\baselineskip
+% \emph{Please note} that for the case of \env{tabenum} environment inside list,
+% there is not compatibility between version 0.0e and earlier
+% versions---left margin of \env{tabenum} is changed (mechanism
+% of placing empty list items on one baseline using compensating vertical
+% spaces could work but its calculation was changed, see also next paragraph).\smallskip
+%
+% \begin{small}%
+% \DescribeMacro{\liststrut}
+% In versions until 0.0d there was offered the |\liststrut| command in the
+% cases when needed to put empty list item on the same line with first item of
+% \env{tabenum}. The command raises first line of next text block at the baseline of
+% previous. (Without any option it puts negative
+% baselineskip. If there is a high element (any math sentence) in the first
+% line of next text, it must be written in option without |$|'s,
+% the height of this argument is used for compensating skips argument.)
+% Since this command must take into account various vertical skips, which
+% appear at the start of new item and also height of printing text,
+% the adjusting of baselines does not always work correctly.\par
+% \end{small}%
+% \RestoreSpaces
% \subsection{The \env{subtabenum} environment: second level, variant I}
%
% \DescribeMacro{subtabenum}
@@ -423,7 +448,7 @@
%
% If you put |\subtabenumitem| (|\subitem|) after |\tabenumitem| (|\item|), you get extra space between
% two numbers, created by |\tabenumsep| skip. The |\negtabenumsep| command
-% cancels this skip: the version 0.1c included this command inside the |\tabenumitem| definition.
+% cancels this skip: the version 0.0c included this command inside the |\tabenumitem| definition.
%\par\begin{small}\openup-1pt\enlargethispage{2\baselineskip}
%\begin{verbatim}
%\def\tabenumsep{\qquad}
@@ -444,14 +469,14 @@
%\subitem
%$v=gt+\displaystyle\frac{g}{4}t$,
%\subitem
-%$u=2^{5x-3y+z}$.\\
+%$u=2^{5x-3y+z}$.\\
%\startsubnumber{7}\subtabrow
%\subitem
%$w=(v+7)^2+(u-3)^2$;
%\subitem
%$5^x=\displaystyle\frac{4}{3} ;$
%\subitem
-%$z=(x+1)^2+y^2$;\\
+%$z=(x+1)^2+y^2$;\\
%\subtabrow
%\subitem
%$2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\skipitem
@@ -477,14 +502,14 @@
% \subitem
% $v=gt+\displaystyle\frac{g}{4}t$,
% \subitem
-% $u=2^{5x-3y+z}$.\\
+% $u=2^{5x-3y+z}$.\\
%\startsubnumber{7}\subtabrow
% \subitem
% $w=(v+7)^2+(u-3)^2$;
% \subitem
% $5^x=\displaystyle\frac{4}{3} ;$
% \subitem
-% $z=(x+1)^2+y^2$;\\
+% $z=(x+1)^2+y^2$;\\
%\subtabrow
% \subitem
% $2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\skipitem
@@ -571,7 +596,7 @@
%
% \section{Code of package}
%
-% First goes request of \pkg{makecell} package.
+% First goes request of \package{makecell} package.
% \begin{macrocode}
\RequirePackage{makecell}
\@ifpackagelater{makecell}{2007/05/24 V0.1d}{}{\PackageError
@@ -593,9 +618,10 @@
% \begin{macro}{\subtabenumitem}
% Definition of aligned items of `tabular'ed list
% \begin{macrocode}
-\newcommand\tabenumitem{&\@ifnextchar[%]
+\newcommand\tabenumitem{\ifvoid\@labels\else\llap{\box\@labels\hspace{-\@totalleftmargin}}\fi
+ &\@ifnextchar[%
{\TeXr@@tabenumitem{&}}%
- {\TeXr@tabenumitem{&}{\@enumctr}}\setcounter{\@subenumctr}\z@}
+ {\TeXr@tabenumitem{&}{\@enumctr}\setcounter{\@subenumctr}\z@}}
% \end{macrocode}
% The macro for second level of tabulated items.
% \begin{macrocode}
@@ -606,14 +632,14 @@
{\TeXr@tabenumitem{&}{\@subenumctr}}}
% \end{macrocode}
% The macros for list and optional numeration. For a successful usage of |\label|--|\ref| mechanism
-% the |\refstepcounter| contains were divided in two parts: the |\stepcounter| command was plased in the
+% the |\refstepcounter| contains were divided in two parts: the |\stepcounter| command was placed in the
% first column, before printing of label, on the second column was placed mechanism of creation
% labels.
% \changes{0.0b}{2007/09/07}{The \cmd{\refstepcounter} command divided into two parts to allow
% labels for tabular items.}
% \begin{macrocode}
\newcommand\TeXr@tabenumitem[2]{%
- \stepcounter{#2}\@nameuse{label#2}#1
+ \stepcounter{#2}{\@nameuse{label#2}}#1
\protected@edef
\@currentlabel{\csname p@#2\endcsname\csname the#2\endcsname}}
\@ifdefinable\TeXr@@tabenumitem{}
@@ -673,7 +699,7 @@
% Start of definition of tabulated lists themselves---\env{tabenum}
% and \env{rtabenum}.
% They allow usage of optional argument in the same way as in
-% \env{enumerate} environment from \pkg{paralist} package.
+% \env{enumerate} environment from \package{paralist} package.
% The second definition, \env{rtabenum}, replaces |\Alph|/|\alph|
% numeration for \texttt{A}/texttt{a} entries by Russian
% |\Asbuk|/|\asbuk| numeration.
@@ -703,12 +729,12 @@
\@topsepadd\topsep\advance\@topsepadd\partopsep
\advance\@topsepadd-\jot
\ifdim\@topsepadd<\z@\@topsepadd=\z@\fi
- \if@nobreak\else\addvspace\@topsepadd\fi
+ \if@nobreak\vspace{-\jot}\else\addvspace\@topsepadd\fi
% \end{macrocode}
-% Interline spacing enlarged by |\jot| as in \pkg{amsmath}'s environments like
+% Interline spacing enlarged by |\jot| as in \package{amsmath}'s environments like
% \env{align} etc.
% \begin{macrocode}
- \openup\jot%
+ \openup\jot
% \end{macrocode}
% Check for list depth and settings for first level.
% If it exceeded, the error message pops out.
@@ -767,17 +793,19 @@
% \begin{macrocode}
\newcommand{\@TeXr@tabenum}{\begingroup
\let\\\TeXr@arraycr\TeXr@tlist@arrayjot\let\par=\cr
- \settowidth\@tempdima{\tabenumindent}%
+ \settowidth\@tempdima{\tabenumindent}\gdef\tabenumindent{}%
\settowidth\@tempdimb{\tabenumsep}%
+ \ifnum\@listdepth>\z@\advance\@tempdima\@totalleftmargin\fi
\let\qedhere\tabqedhere
\halign\bgroup
\strut##\hskip\@tempdima
- \hskip-\@tempdimb&&\tabenumsep\hfil##\hskip\labelsep&##\hfil\cr}
+ \hskip-\@tempdimb&&\hskip\@tempdimb\hfil##\hskip\labelsep
+ &##\hfil\cr}
% \end{macrocode}
%
% Finish of \env{tabenum} environment.
% \begin{macrocode}
-\def\endtabenum{\crcr\egroup\endgroup\gdef\tabenumindent{}\par
+\def\endtabenum{\crcr\egroup\endgroup\par
\addpenalty\@endparpenalty
\advance\@topsepadd\jot
\addvspace\@topsepadd}
@@ -789,7 +817,7 @@
% \begin{environment}{rsubtabenum}
% The tabulated list of second level. This list uses a real \env{tabular}
% environment. In this case it is placed in one page. This list as its
-% parent environment use optional argument in the way of \pkg{paralist}'s
+% parent environment use optional argument in the way of \package{paralist}'s
% \env{enumerate}.
% \begin{macrocode}
\newcommand\subtabenum[1][]{\TeXr@tlist@arrayjot
@@ -862,20 +890,22 @@
% This command inserts negative |\baselineskip| and put start of
% `tabular'ed list on the baseline of list number.
%
-% Optional argument allows to align baselines in the case of height
-% elements in first line of \env{tablist}
+% Optional argument allows to align baselines in the case of high
+% elements in first line of \env{tablist}. In the version 0.0e the calculation
+% of compensating space was changed.
% \begin{macrocode}
\newcommand\liststrut[1][]{\def\tempa{#1}\ifx\tempa\empty
- \strut
- \@tempdima-1.3\baselineskip
- \vspace*{\@tempdima}\par%
- \else\settoheight\@tempdima{{$#1$}}\strut
- \advance\@tempdima\lineskip
- \noindent\vrule\@height\@tempdima\@width\z@\@depth\z@
- \strut\advance\@tempdima.3\baselineskip
- \vspace*{-\@tempdima}\par%
+ \strut\@tempskipa\z@
+ \else\settoheight\@tempdima{{$#1$}}\vrule height\@tempdima depth\dp\strutbox width\z@
+ \advance\@tempdima-\ht\strutbox
+ \ifdim\@tempdima>\lineskip\advance\@tempdima\lineskip\fi
+ \@tempskipa\@tempdima
\fi
- \@nobreaktrue}
+ \advance\@tempskipa\baselineskip
+% \advance\@tempskipa-\@outerparskip
+ \par\nobreak\vskip-\parskip
+% \advance\@tempskipa\lastskip
+ \nobreak\kern-\@tempskipa\@nobreaktrue}
% \end{macrocode}
% \end{macro}
%