Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I obtain the following? It should have some features:

  1. List environment is able to break over pages;
  2. Each line in list environment has 3 columns. 1st column (counters) is left aligned. 2nd column is right aligned. 3rd column is left aligned.
  3. List environment is able to be resumed. in the following file, after 3b. we have some text and after that, we have 4a.
  4. We can put a label for every list item (for example \label{1a} or \label{2}), and anywhere in the body of text, we can refer to this item. For example we put in \ref{1a} in the TeX file and we'll have in 1a. in the output file.

enter image description here

share|improve this question
    
How do you distinguish between regular and sub-enumeration? Your example also shows a drop back to 3a and 3b. Why is that? –  Werner Nov 29 '12 at 18:39
add comment

1 Answer

longtable can help here (updated with sub item numbering and again with numbering tweaked as requested): enter image description here

\documentclass{article}
\usepackage{array,longtable}

\setlength\textheight{10\baselineskip}

\begin{document}


\renewcommand\theenumii{\alph{enumii}}
\makeatletter
\def\subitem{\omit\@arstrut 
\ifnum\value{enumii}=0 \stepcounter{enumi}\fi
\refstepcounter{enumii}\theenumi\theenumii\hfill}
\def\item{\omit\setcounter{enumii}{0}\let\omit\relax}
\makeatother

\begin{longtable}{>{\refstepcounter{enumi}\setcounter{enumii}{0}\theenumi}lrl}
& something& something else\\
& foo&bar\\
\label{this}& red&blue\\
& something about \ref{this} & or that\\
& foo&bar\\
\subitem& foo&bar\\
\subitem& foo&bar\\
\item
\subitem& foo&bar\\
\subitem& foo&bar\\
\item
\subitem& foo&bar\\
& foo&bar\\
&a & b\\
&c & d\\
\subitem\label{thissubi}& foo&bar\\
\subitem& foo&bar\\
& foo&bar\\
& foo& ref subitem: \ref{thissubi}\\
& foo&bar\\
& foo&bar\\
& foo&bar
\end{longtable}


some text

\begin{longtable}{>{\refstepcounter{enumi}\theenumi}lrl}
& something& something else\\
& foo&bar\\
\label{thisb}& red&blue\\
& something about \ref{thisb} & or that\\
& foo&bar\\
\subitem& foo&bar\\
\subitem& foo&bar\\
& foo&bar\\
\end{longtable}

\end{document}
share|improve this answer
    
thanks for your answer. but it's not exactly what i want. for example, after list item number 4, we have 5 and after that, 5a. but i want 5a right after 4, not 5. there is another problem: in your example code, we have 5a and 5b. if we want "subitem" in 8th list item, we'll have 8c, 8d, ..., but we should have 8a, 8b. the last problem is referencing. in my computer when i compile your code with MikTeX 2.9, referencing does not work properly. –  smh Nov 29 '12 at 20:39
3  
You have to put labels in the first column for referencing to work, the other counting issues are easily addressed. Really these things are much easier if the question contains a complete full example document and information about the expected result. –  David Carlisle Nov 29 '12 at 22:13
    
thanks for update. but how can i refer to rows: "6a, 6b, 10a, ..."? –  smh Nov 29 '12 at 22:56
    
when i use four "\subitem" commands, it's output is, for example, "1a, 1b, 1c, 1d", but i need a maximum of two subitems in a row. for example i just want "1a, 1b, 2a, 2b, ...". i never need "c, d, ..." romans, but "a, b" for maximum. –  smh Nov 29 '12 at 23:10
    
updated to allow 6a 6b 7a 7b –  David Carlisle Nov 29 '12 at 23:49
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.