1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
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
|