diff options
author | Norbert Preining <preining@logic.at> | 2008-01-17 07:34:54 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-01-17 07:34:54 +0000 |
commit | 3e56d20c2a2cb5cea6130d931676205f6abee822 (patch) | |
tree | 7b2dde6d17fa573922e691ead56f0ee7430fc474 /Master/texmf-dist/source/latex/tablists | |
parent | 86d0ec5ee6adca8e4c0f78ee072aabaafee5d6d4 (diff) |
new package tablists
git-svn-id: svn://tug.org/texlive/trunk@6280 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tablists')
-rw-r--r-- | Master/texmf-dist/source/latex/tablists/tablists.dtx | 903 |
1 files changed, 903 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/tablists/tablists.dtx b/Master/texmf-dist/source/latex/tablists/tablists.dtx new file mode 100644 index 00000000000..b9cf47e5550 --- /dev/null +++ b/Master/texmf-dist/source/latex/tablists/tablists.dtx @@ -0,0 +1,903 @@ +% \iffalse +% +% tablists.dtx - tabulated list of short items. +% (c) 2007, 2008 Olga Lapko (Lapko.O@g23.relcom.ru) +% +% This program is provided under the terms of the +% LaTeX Project Public License distributed from CTAN +% archives in directory macros/latex/base/lppl.txt. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{tablists.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{tablists} +%<*package> + [2008/01/14 v0.0d (beta) Tabulated list of short items] +%</package> +% +%<*batchfile> +\begingroup + +\input docstrip.tex + +\keepsilent +\askforoverwritefalse + +\generate{\file{tablists.sty}{\from{tablists.dtx}{package}}} + +\endgroup +%</batchfile> +% +%<*driver> +\documentclass{ltxdoc} + +\usepackage{ifpdf} +\ifpdf + \usepackage{mathptmx,courier} + \usepackage[scaled=0.90]{helvet} + \addtolength\marginparwidth{15pt} +\fi + +\usepackage{paralist} +\usepackage{makecell} +\usepackage{amsthm} +\newtheorem{theorem}{Theorem} +\usepackage{tablists} +\IfFileExists{hyperref.sty}{\usepackage{hyperref}}{} +\IfFileExists{listpen.sty}{\usepackage{listpen}}{} +\providecommand\RestoreSpaces{\bigskip} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\makeatletter +\@beginparpenalty10000 +\widowpenalty10000 +\clubpenalty10000 +\makeatother +\providecommand*{\file}[1]{\texttt{#1}} +\providecommand*{\pkg}[1]{\textsf{#1}} +\providecommand*{\cls}[1]{\textsf{#1}} +\providecommand*{\env}[1]{\texttt{#1}} + +\OnlyDescription +\begin{document} + \DocInput{tablists.dtx} + \PrintChanges +\end{document} +%</driver> +% \fi +% +% \CheckSum{493} +% +% \GetFileInfo{tablists.dtx} +% +% \DoNotIndex{\newcommand,\newenvironment} +% +% +% \title{The \textsf{tablists} package\thanks{This +% file has version number \fileversion, +% last revised \filedate.}} +% \author{% +% Olga Lapko\\ +% {\tt Lapko.O@g23.relcom.ru} } +% \date{\filedate} +% \maketitle +% \begin{abstract} +% This package gives variant of environment for creating of list of short +% items in the way of tabular alignment. That could be useful for list of +% exercises in math educational literature. It allows to build one-level +% and two-level tabulated lists. +% \end{abstract} +% +% \tableofcontents +% +%\newpage +% \section{Building Commands} +% +% \DescribeMacro{tabenum} +% \DescribeMacro{\tabenumitem} +% \DescribeMacro{\item} +% The \env{tabenum} environment prints short items aligned in columns. +% +% 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: +%\par\begin{small}% +%\begin{verbatim} +%\begin{tabenum}[\bfseries1)]% +%\tabenumitem +%$z=\displaystyle\frac xy$; +%\tabenumitem +%$2^x=9;$\cr +% +%\tabenumitem +%$3^{2x+3}=16 $; +%\tabenumitem +%$z=2x^2+4y^2$;\par +%\tabenumitem +%$u=\sqrt{x^2+y^2+z^2}$; +%\tabenumitem +%$v=gt+\displaystyle\frac{g}{4}t$;\\[1ex] +%\tabenumitem +%$u=2^{5x-3y+z}$; +%\tabenumitem +%$w=(v+7)^2+(u-3)^2$; +% +% +%\tabenumitem +%$5^x=\displaystyle\frac{4}{3} ;$ +%\tabenumitem +%$z=(x+1)^2+y^2$;\\* +%\tabenumitem +%$2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$ +%\tabenumitem +%$t=5u^2+8v^2$; +%\end{tabenum} +%\end{verbatim} +%\end{small} +% \begin{tabenum}[\bfseries1)]% +% \tabenumitem +% $z=\displaystyle\frac xy$; +% \tabenumitem +% $2^x=9;$\cr +% +% \tabenumitem +% $3^{2x+3}=4 $; +% \tabenumitem +% $z=2x^2+4y^2$;\par +% \tabenumitem +% $u=\sqrt{x^2+y^2+z^2}$; +% \tabenumitem +% $v=gt+\displaystyle\frac{g}{4}t$;\\[1ex] +% \tabenumitem +% $u=2^{5x-3y+z}$; +% \tabenumitem +% $w=(v+7)^2+(u-3)^2$; +% +% +% \tabenumitem +% $5^x=\displaystyle\frac{4}{3} ;$ +% \tabenumitem +% $z=(x+1)^2+y^2$;\\* +% \tabenumitem +% $2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$ +% \tabenumitem +% $t=5u^2+8v^2$; +% \end{tabenum} +% +% You may see that empty line (or |\par| command), |\\| command and |\cr| +% do the same: start a new row. The |\\| macro works like in array environment +% and allows optional argument with vertical correction. +% (Also the |\\*| command suppresses breaking between pages, see next example.) +% +% Please note that two or more |\par|'s +% |\cr|'s or |\\|'s (and also any combination of these three commands) +% create additional empty lines. +% +% You may use the |\item| +% macro instead of |\tabenumitem| in this \env{tabenum} environments (see next examples). +% +% \DescribeMacro{\notabenumitem} +% \DescribeMacro{\noitem} +% \DescribeMacro{\skipitem} +% On the next step you can wish to do the list like before more compact. The +% |\multicolumn| does not work here correctly\footnote{ +% Also the plain \TeX's commands like \cs{omit} and \cs{span}/\cs{multispan} commands, +% I think, need too complex code.}. At first you may use plain \TeX's +% command |\hidewidth| to hide width of widest column entry; then you may use +% other variant of |\tabenumitem|(|\item|) command---|\notabenumitem|(|\noitem|)---%^^A +% this command increases list entry, but does not create a new column; +% third command |\skipitem| allows you to skip +% one \env{tabenum} column\footnote{The \env{tabenum} column includes two columns: +% it works like \texttt{rl} columns in \env{tabular} environment. Thus, \cs{skipitem} +% equals to \texttt{\&\&} combination.}. +% Next example show usage of these three commands: +%\par\begin{small}% +%\begin{verbatim} +%\begin{tabenum}[\bfseries1)]% +%\item +%$z=\displaystyle\frac xy$; +%\noitem +%$2^x=9;$ +%\item +%$3^{2x+3}=4 $. +%\item +%$z=2x^2+4y^2$;\nopagebreak +% +%\item +%$u=\sqrt{x^2+y^2+z^2}$; +%\item +%$v=gt+\displaystyle\frac{g}{4}t$, +%\item +%$u=2^{5x-3y+z}$.\cr +%\item +%$w=(v+7)^2+(u-3)^2$; +%\item +%$5^x=\displaystyle\frac{4}{3} ;$ +%\item +%$z=(x+1)^2+y^2$;\\* +%\item +%$2+5+8+ \ldots +(3n+2)=155$, +% $n\in \mathrm{N};$\hidewidth\skipitem +%\item +%$t=5u^2+8v^2$; +%\end{tabenum} +%\end{verbatim} +%\end{small}% +% \begin{tabenum}[\bfseries1)]% +% \item\label{tabenum:I:1} +% $z=\displaystyle\frac xy$; +% \noitem\label{tabenum:I:2} +% $2^x=9;$ +% \item +% $3^{2x+3}=4 $. +% \item +% $z=2x^2+4y^2$;\nopagebreak +% +% \item +% $u=\sqrt{x^2+y^2+z^2}$; +% \item +% $v=gt+\displaystyle\frac{g}{4}t$, +% \item +% $u=2^{5x-3y+z}$.\cr +% \item +% $w=(v+7)^2+(u-3)^2$; +% \item +% $5^x=\displaystyle\frac{4}{3} ;$ +% \item +% $z=(x+1)^2+y^2$;\\* +% \item\label{tabenum:I:11} +% $2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\skipitem +% \item +% $t=5u^2+8v^2$; +% \end{tabenum} +% The items \ref{tabenum:I:1} and \ref{tabenum:I:2} were joined in one column: the item \ref{tabenum:I:2} +% used |\noitem| (|\notabenumitem|) command. The item \ref{tabenum:I:11} occupies two columns, +% so it uses the |\hidewidth| (hides item width) and |\skipitem| (skips column of next item) commands. +% +% +% \subsection{Spacing} +% +% 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. +% +% \DescribeMacro{\tabenumsep} +% The horizontal spacing between items of list. It defined like: +% \begin{quote} +% |\newcommand\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: +% \begin{quote} +% |\renewcommand\tabenumindent{\hskip\parindent}| +% \end{quote} +% or +% \begin{quote} +% |\renewcommand\tabenumindent{Word }| +% \end{quote} +% +% \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. +% +% Here the combination of these two commands: +%\par\begin{small}% +%\begin{verbatim} +%\begin{enumerate}[\bfseries1)]% +%\item\renewcommand\tabenumindent{1)\hskip\labelsep}% +% \liststrut[\displaystyle\frac /y] +%\begin{tabenum}[a)]% +%... +%\end{verbatim}% +%\end{small}% +% \begin{enumerate}[\bfseries1)]% +% \item\renewcommand\tabenumindent{1)\hskip\labelsep}% +% \liststrut[\displaystyle\frac /y] +% \begin{tabenum}[a)]% +% \item +% {$z=\displaystyle\frac xy$}; +% \noitem +% {$2^x=9;$} +% \item +% {$3^{2x+3}=4 $}. +% \item +% {$z=2x^2+4y^2$};\nopagebreak +% +% \item +% $u=\sqrt{x^2+y^2+z^2}$; +% \item +% $v=gt+\displaystyle\frac{g}{4}t$, +% \item +% $u=2^{5x-3y+z}$.\\ +% \item +% $w=(v+7)^2+(u-3)^2$; +% \item +% $5^x=\displaystyle\frac{4}{3} ;$ +% \item +% $z=(x+1)^2+y^2$;\cr +% \item +% $2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\skipitem +% \item +% $t=5u^2+8v^2$; +% \end{tabenum} +% \end{enumerate}% +% \emph{Note}: The |\liststrut| not always works correctly.\RestoreSpaces +% +% \subsection{The \env{subtabenum} environment: second level, variant I} +% +% \DescribeMacro{subtabenum} +% The second level of equations/exersizes list \env{subtabenum} based on \env{tabular} +% environment. +% +%\begin{small}% +%\begin{verbatim} +%\begin{tabenum}[\bfseries 1)]% +%\item +%\begin{subtabenum}[a)]% +%\item +%$z=\displaystyle\frac xy$; +%\noitem +%$2^x=9;$ +%\item +%$3^{2x+3}=4 $. +%\item +%$z=2x^2+4y^2$; +%\end{subtabenum} +% +%\item +%\begin{subtabenum}[a)]% +%\item +%$u=\sqrt{x^2+y^2+z^2}$; +%\item +%... +%\end{subtabenum} +%\end{tabenum} +%\end{verbatim}% +%\end{small}% +% \begin{tabenum}[\bfseries 1)]% +% \item +% \begin{subtabenum}[a)]% +% \item +% $z=\displaystyle\frac xy$; +% \noitem +% $2^x=9;$ +% \item +% $3^{2x+3}=4 $. +% \item +% $z=2x^2+4y^2$; +% \end{subtabenum}\nopagebreak +% +% \item +% \begin{subtabenum}[a)] +% \item +% $u=\sqrt{x^2+y^2+z^2}$; +% \item +% $v=gt+\gape[b]{\displaystyle\frac{g}{4}}t$, +% \item +% $u=2^{5x-3y+z}$.\\ +% \item +% $w=(v+7)^2+(u-3)^2$; +% \item +% $5^x=\gape[b]{\displaystyle\frac{4}{3}} ;$ +% \item +% $z=(x+1)^2+y^2$;\\ +% \item +% $2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\strut\skipitem +% \item +% $t=5u^2+8v^2$; +% \end{subtabenum} +% \end{tabenum} +% Please note that |\hidewidth| skip is followed by the |\strut| command inside +% \env{subtabenum} environment: +% the skips at the ``edges'' of \env{tabular} columns or before |\\| command doesn't work. +% +% \subsection{The \cs{subtabenumitem}/\cs{subitem} macros: second level, variant II} +% +% The previous example shows that columns were destroyed from one +% \env{subtabenum} environment to another. Also the rows of sublist cannot break between pages. +% +% \DescribeMacro{\subtabenumitem} +% \DescribeMacro{\subitem} +% There is another variant for two-level tabulated list. If you use second option +% in \env{tabenum} environment, you may use |\subtabenumitem|/|\subitem| commands +% for the second level\footnote{If there are not second optional argument, these commands +% work like \cs{tabenumitem}/\cs{item}.}. +% +% 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. +%\par\begin{small}\openup-1pt\enlargethispage{2\baselineskip} +%\begin{verbatim} +%\def\tabenumsep{\qquad} +%\begin{tabenum}[\bfseries 1)][a)]% +%\item +%\subitem +%$z=\displaystyle\frac xy$; +%\nosubitem +%$2^x=9;$ +%\subitem +%$3^{2x+3}=4 $. +%\subitem +%$z=2x^2+4y^2$;\\ +%\startnumber{4} +%\item +%\subitem +%$u=\sqrt{x^2+y^2+z^2}$; +%\subitem +%$v=gt+\displaystyle\frac{g}{4}t$, +%\subitem +%$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$;\\ +%\subtabrow +%\subitem +%$2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\skipitem +%\subitem +%$t=5u^2+8v^2$; +%\end{tabenum} +%\end{verbatim}% +%\end{small} +% \begin{tabenum}[\bfseries 1)][a)]% +% \item +% \subitem +% $z=\displaystyle\frac xy$; +% \nosubitem +% $2^x=9;$ +% \subitem +% $3^{2x+3}=4 $. +% \subitem +% $z=2x^2+4y^2$;\\ +% \startnumber{4}\relax +% \item +% \subitem +% $u=\sqrt{x^2+y^2+z^2}$; +% \subitem +% $v=gt+\displaystyle\frac{g}{4}t$, +% \subitem +% $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$;\\ +%\subtabrow +% \subitem +% $2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\skipitem +% \subitem +% $t=5u^2+8v^2$; +% \end{tabenum} +% There were used two commands |\startnumber| and |\startsubnumber| which set +% next start numbers for items of each of two levels\footnote{The \cs{startnumber} +% command can be used inside any list +% environment.}. The |\startnumber| +% allows you to divide \env{tabenum} environment and restart with necessary counter. +% You may still use the traditional |\setcounter{enum..}{..}| combination, +% if you know the level of your list and \env{tabenum}/\allowbreak\env{subtabenum} environments. +% For start of the new row from subitem, you need to use~\nobreak\quad1)\nobreak\enskip +% the |\skipitem| command to skip +% column, occupied by the ``parent'' label (|\tabenumitem|) and~\nobreak\quad2)\nobreak\enskip +% the |\negtabenumsep| command to undo column separation. +% These two commands abbreviated by |\subtabrow| command. +% +% \subsection{Placing the QED sign at the end of \env{tabenum} environment} +% +% When the \env{tabenum} environment is used inside \env{proof} environment (the +% \texttt{amsthm} package), +% the better way is to put QED at the end of last \env{tabenum} line. You may use +% the |\tabqedhere| command: +% +% \begin{theorem}% +% You may put the QED sign inside the \env{tabenum} environment. +% \end{theorem}% +% \begin{proof}% +% Let's put our favorite \env{tabenum} environment inside the \env{proof} one, +% and at the end of it write the |\tabqedhere| (or |\qedhere|) command: +%\begin{verbatim} +%\begin{theorem} +% You may put the QED sign inside the \env{tabenum} environment. +%\end{theorem} +%\begin{proof} +% Let's put... +%\begin{tabenum}[\bfseries 1)][a)]% +%... +%\subitem +%$t=5u^2+8v^2$;\qedhere +%\end{tabenum} +%\end{proof} +%\end{verbatim}% +% \begin{tabenum}[\bfseries 1)][a)]% +% \item +% \subitem +% $z=\displaystyle\frac xy$; +% \nosubitem +% $2^x=9;$ +% \subitem +% $3^{2x+3}=4 $. +% \subitem +% $z=2x^2+4y^2$;\\ +% \startnumber{4}\relax +% \item +% \subitem +% $u=\sqrt{x^2+y^2+z^2}$; +% \subitem +% $v=gt+\displaystyle\frac{g}{4}t$, +% \subitem +% $u=2^{5x-3y+z}$.\\ \subtabrow +% \subitem +% $w=(v+7)^2+(u-3)^2$; +% \subitem +% $5^x=\displaystyle\frac{4}{3} ;$ +% \subitem +% $z=(x+1)^2+y^2$;\\ \subtabrow +% \subitem +% $2+5+8+ \ldots +(3n+2)=155$, $n\in \mathrm{N};$\hidewidth\skipitem +% \subitem +% $t=5u^2+8v^2$;\qedhere +% \end{tabenum} +% \end{proof}% +% +% \subsection{Restoring of \cs{item} as command from list environments} +% +% \DescribeMacro{\restorelistitem} +% For the cases when standard lists appear inside \env{tablist}, you may +% restore original |\item| meaning. +% +% \StopEventually{}\clearpage +% +% \section{Code of package} +% +% First goes request of \pkg{makecell} package. +% \begin{macrocode} +\RequirePackage{makecell} +\@ifpackagelater{makecell}{2007/05/24 V0.1d}{}{\PackageError + {tablists}{For a successful cooperation we need at least\MessageBreak + version `2007/05/24 V0.1d' of package makecell,\MessageBreak + but only version\MessageBreak + `\csname ver@makecell.\@pkgextension\endcsname'\MessageBreak + is available}\@eha\endinput} +% \end{macrocode} +% +% The horizontal separation space between items/columns. +% \begin{macrocode} +\newcommand\tabenumsep{\hskip1em} +\newcommand\negtabenumsep{% + \settowidth\@tempdima{\tabenumsep}\hspace*{-\@tempdima}} +% \end{macrocode} +% +% \begin{macro}{\tabenumitem} +% \begin{macro}{\subtabenumitem} +% Definition of aligned items of `tabular'ed list +% \begin{macrocode} +\newcommand\tabenumitem{&\@ifnextchar[%] + {\TeXr@@tabenumitem{&}}% + {\TeXr@tabenumitem{&}{\@enumctr}}\setcounter{\@subenumctr}\z@} +% \end{macrocode} +% The macro for second level of tabulated items. +% \begin{macrocode} +\newcommand\subtabenumitem{\ifnum\value{\@subenumctr}=\z@\negtabenumsep + \let\negtabenumsep\relax\fi& + \@ifnextchar[%] + {\TeXr@@tabenumitem{&}}% + {\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 +% 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 + \protected@edef + \@currentlabel{\csname p@#2\endcsname\csname the#2\endcsname}} +\@ifdefinable\TeXr@@tabenumitem{} +\def\TeXr@@tabenumitem#1[#2]{{#2}#1} +% \end{macrocode} +% \end{macro}% +% \end{macro}% +% +% \begin{macro}{\notabenumitem} +% \begin{macro}{\nosubtabenumitem} +% Definition of not aligned items with emulation of spaces around. +% The starred form of |\notabenumitem| skips space before number. +% \begin{macrocode} +\newcommand\notabenumitem{\@ifstar + {\TeXr@notabenumitem{\@enumctr}}% + {\tabenumsep\TeXr@notabenumitem{\@enumctr}}} +% \end{macrocode} +% The macro for second level of tabulated items. +% \begin{macrocode} +\newcommand\nosubtabenumitem{\@ifstar + {\TeXr@notabenumitem{\@subenumctr}}% + {\tabenumsep\TeXr@notabenumitem{\@subenumctr}}} +\newcommand\TeXr@notabenumitem[1]{\@ifnextchar[%] + {\TeXr@@tabenumitem{\hskip\labelsep}}% + {\TeXr@tabenumitem{\hskip\labelsep}{#1}}} +% \end{macrocode} +% \end{macro}% +% \end{macro}% +% +% \begin{macro}{\skipitem} +% Command allows to skip column of items in tabulated list. +% One item column occupies two tabular ones and needs |&&| for skipping +% \begin{macrocode} +\newcommand\skipitem[1][1]{\count@=#1\multiply\count@2\advance\count@\@ne + \eline{\count@}} +% \end{macrocode} +% \end{macro}% +% +% \begin{macro}{\subtabrow} +% Command allows to skip column of items in tabulated list. +% One item column occupies two tabular ones and needs |&&| for skipping +% \begin{macrocode} +\newcommand\subtabrow{\skipitem\negtabenumsep} +% \end{macrocode} +% \end{macro}% +% +% \begin{macro}{\tabenumindent} +% If this command empty there is no any indentation. To set necessary indentation +% you may define this command as any text or horizontal skip. +% \begin{macrocode} +\newcommand\tabenumindent{} +% \end{macrocode} +% \end{macro}% +% +% \begin{environment}{tabenum} +% \begin{environment}{rtabenum} +% 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. +% The second definition, \env{rtabenum}, replaces |\Alph|/|\alph| +% numeration for \texttt{A}/texttt{a} entries by Russian +% |\Asbuk|/|\asbuk| numeration. +% \begin{macrocode} +\newenvironment{rtabenum}{\let\Alph\Asbuk\let\alph\asbuk + \tabenum}{\endtabenum} +% \end{macrocode} +% +% These environments use mechanism of optional argument from |\@enumlabel@| +% command. +% \begin{macrocode} +\newcommand\tabenum{\@ifnextchar[{\TeXr@tabenum@}{\TeXr@tabenum@[]}} +\@ifdefinable\TeXr@tabenum@{} +\def\TeXr@tabenum@[#1]{\@ifnextchar[%] + {\TeXr@tabenum@@[#1]}{\TeXr@tabenum@@[#1][]}} +% \end{macrocode} +% +% These environments allow two options for item numeration and subitem numeration. +% \begin{macrocode} +\@ifdefinable\TeXr@tabenum@@{} +\long\def\TeXr@tabenum@@[#1][#2]{\par + \addpenalty\@beginparpenalty +% \end{macrocode} +% Vertical spaces around \env{tabenum} similar to spaces in list environments. +% The space above reduced by |\jot| to make it equal to the space below. +% \begin{macrocode} + \@topsepadd\topsep\advance\@topsepadd\partopsep + \advance\@topsepadd-\jot + \ifdim\@topsepadd<\z@\@topsepadd=\z@\fi + \if@nobreak\else\addvspace\@topsepadd\fi +% \end{macrocode} +% Interline spacing enlarged by |\jot| as in \pkg{amsmath}'s environments like +% \env{align} etc. +% \begin{macrocode} + \openup\jot% +% \end{macrocode} +% Check for list depth and settings for first level. +% If it exceeded, the error message pops out. +% \begin{macrocode} + \ifnum\@enumdepth>\thr@@ + \@toodeep + \else + \advance\@enumdepth\@ne + \edef\@enumctr{enum\romannumeral\the\@enumdepth}% + \setcounter{\@enumctr}\z@ + \let\item\tabenumitem\let\noitem\notabenumitem +% \end{macrocode} +% Check for list depth and settings for second level. +% If it exceeded, one level used. +% \begin{macrocode} + \ifnum\@enumdepth>\thr@@ + \PackageWarning{tablists}{tablist has one level}{}% + \let\subitem\tabenumitem\let\nosubitem\notabenumitem + \else + \let\subitem\subtabenumitem\let\nosubitem\nosubtabenumitem + \advance\@enumdepth\@ne + \edef\@subenumctr{enum\romannumeral\the\@enumdepth}% + \setcounter{\@subenumctr}\z@ + \fi + \fi +% \end{macrocode} +% Checks for first option. If option is absent used default enumerating. +% \begin{macrocode} + \def\tempa{#1}\ifx\tempa\empty\else + \TeXr@enumlabel@{#1}{\@enumctr}\fi +% \end{macrocode} +% Checks for second option. If option is absent used default enumerating. +% \begin{macrocode} + \def\tempa{#2}\ifx\tempa\empty\else + \TeXr@enumlabel@{#2}{\@subenumctr}\fi + \@TeXr@tabenum + } +% \end{macrocode} +% There building macro for item/subitem labels. +% \begin{macrocode} +\newcommand\TeXr@enumlabel@[2]{% + \@tempcnta0 + \TeXr@lab{}\def\TeXr@label{\TeXr@label@{#2}}% + \expandafter\TeXr@loop\@gobble{}#1\@@@ + \ifnum\@tempcnta=1\else + \PackageWarning{tablists}{Incorrect label; no or multiple + counters.\MessageBreak The label is: \@gobble#1}% + \fi + \expandafter\edef\csname label#2\endcsname{\the\TeXr@lab}% + \expandafter\let\csname the#2\endcsname\TeXr@the% +} +% \end{macrocode} +% +% For column alignment is used |\halign| command of plain \TeX. +% In this case \env{tabenum}/\env{rtabenum} environments can run through a few pages. +% \begin{macrocode} +\newcommand{\@TeXr@tabenum}{\begingroup + \let\\\TeXr@arraycr\TeXr@tlist@arrayjot\let\par=\cr + \settowidth\@tempdima{\tabenumindent}% + \settowidth\@tempdimb{\tabenumsep}% + \let\qedhere\tabqedhere + \halign\bgroup + \strut##\hskip\@tempdima + \hskip-\@tempdimb&&\tabenumsep\hfil##\hskip\labelsep&##\hfil\cr} +% \end{macrocode} +% +% Finish of \env{tabenum} environment. +% \begin{macrocode} +\def\endtabenum{\crcr\egroup\endgroup\gdef\tabenumindent{}\par + \addpenalty\@endparpenalty + \advance\@topsepadd\jot + \addvspace\@topsepadd} +% \end{macrocode} +% \end{environment}% +% \end{environment}% +% +% \begin{environment}{subtabenum} +% \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 +% \env{enumerate}. +% \begin{macrocode} +\newcommand\subtabenum[1][]{\TeXr@tlist@arrayjot + \setcounter{\@subenumctr}\z@ + \def\tempa{#1}\ifx\tempa\empty\else + \TeXr@enumlabel@{#1}{\@subenumctr}\fi + \let\item\subtabenumitem\let\noitem\nosubtabenumitem + \let\tabenumitem\subtabenumitem\let\notabenumitem\nosubtabenumitem + \let\subitem\subtabenumitem\let\nosubitem\nosubtabenumitem + \@TeXr@subtabenum + } +\newcommand{\@TeXr@subtabenum}{\let\negtabenumsep\relax + \hbox{\ifnum0=`}\fi + \begin{tabular}[t]{@{\tabenumindent}l@{} + *{12}{r@{\hskip\labelsep}l@{\tabenumsep}}@{}}% + } +\def\endsubtabenum{\end{tabular}% + \ifnum0=`{\fi}\gdef\tabenumindent{}} +% \end{macrocode} +% +% Russified environment with |\Asbuk|/|\asbuk| counters instead of +% |\Alph|/|\alph|. +% \begin{macrocode} +\newenvironment{rsubtabenum}{\let\Alph\Asbuk\let\alph\asbuk% + \subtabenum}{\endsubtabenum} +% \end{macrocode} +% \end{environment}% +% \end{environment}% +% +% \begin{macro}{\arrayjot} +% The redefinition of |\\| command inside tabular to enlarge interline spacing +% by |\jot| value---to create analogous spacing to parent, \env{tabenum}, environment. +% \begin{macrocode} +\@ifdefinable\TeXr@rixarraycr{} +\let\TeXr@rixarraycr\TeXr@xarraycr +\newcommand\TeXr@Xarraycr{\@ifnextchar[%] + \TeXr@Xargarraycr {\@argarraycr[\jot]}} +\@ifdefinable\TeXr@Xargarraycr{} +\def\TeXr@Xargarraycr[#1]{\@tempdima\jot\advance\@tempdima#1% + \@argarraycr[\@tempdima]} +\@ifdefinable\TeXr@arrayjot{} +\def\TeXr@arrayjot [#1]{\let\@xarraycr\TeXr@Xarraycr\jot#1} +\def\noarrayjot{\let\@xarraycr\TeXr@rixarraycr} +\newcommand\TeXr@tlist@arrayjot {\@ifnextchar[%] + \TeXr@arrayjot{\TeXr@arrayjot[\jot]}} +\AtBeginDocument{\let\arrayjot\TeXr@tlist@arrayjot} +\def\TeXr@arraycr{% + \relax\iffalse{\fi\ifnum 0=`}\fi + \@ifstar{\vadjust{\penalty\@M}\@xarraycr}\@xarraycr} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\startnumber} +% The variant of |\setcounter{enum..}{..}| sentence. +% This command sets start number of current list (you must put this command +% inside of list or \env{tabenum} environment). +% The |\setcounter{enum..}{..}| sentence needs previous number, +% but |\startnumber| needs a real start number of a list. +% \begin{macrocode} +\newcommand\startnumber[1]{\count@#1\advance\count@-1% + \global\expandafter\csname c@\@enumctr\endcsname\count@} +\newcommand\startsubnumber[1]{\count@#1\advance\count@-1% + \global\expandafter\csname c@\@subenumctr\endcsname\count@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\liststrut} +% For the cases of \env{tablist} appears just after empty +% \env{enumerate} (or analogous) list entry. +% 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} +% \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% + \fi + \@nobreaktrue} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabqedhere} +% Places the QED sign at the end of \env{tabenum} line inside the \env{proof} environment. +% \begin{macrocode} +\newcommand\tabqedhere{\cr + \noalign{\@par\@tempdima\prevdepth + \kern-\@tempdima\kern-\baselineskip\kern\lineskip + {\strut\popQED}\@par\kern\@tempdima}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\restorelistitem} +% For the cases when standard lists appear inside \env{tablist}. +% \begin{macrocode} +\let\TeXr@orilistitem\item +\newcommand\restorelistitem{\let\item\TeXr@orilistitem} +% \end{macrocode} +% \end{macro} +% +% \Finale +\endinput +%% +%% End of file tablists.dtx
\ No newline at end of file |