I'm looking for a way to sort of combine the features of enumerate (and other list-like environments) with features of tabular environments.

Specifically, what I like about enumerate is that it provides automatic numbering, and that it produces a straight "stream" of output that can be wrapped in a multicols environment so I can easily change how many columns I want. What I need that's similar to tabular, though, is that I need to have multiple alignment points within each enumerate item.

What I ideally want to be able to do is this:

\begin{coolEnv}{lrc}{2} % specifying two columns
   \item This should & align & and stuff
   \item This should & also align & and everything
   \item This should & additionally align & and all
   \item This here should & be aligned & with the rest

The output I want is going to look like it's six columns, but it should really be two columns, each of which has three "sub-columns". That is, my {2} in the environment is saying "I want two columns", but since each item of the environment has two align points, the separate parts should also be aligned as columns. I'd like to be able to specify the alignment of the sub-columns as I have with {lrc} there, but this is the least important part.

The reason I want to do this is that I frequently find myself creating tabulars with some number of columns, but then later deciding I want them to be wider instead of tall and skinny, with the entire tabular wrapping into multiple columns (the way enumerate does in a multicols environment). With tabular, this requires me to completely eviscerate the tabular and move all the &s and \\s around, because the tabular requires me to specify what is shown on the same line, not what data belong together. I want a way to specify the data of the table in semantic "rows" (i.e., groups of info which must remain together) without having to specify how I want it to flow (i.e., how many such groups are printed on a line). I want to retain the freedom to later say "I want X groups on a line" and not have to redo the whole thing.

I've looked at various combinations of packages like multicol, enumerate, listliketab, multienum, etc., but none of those seem to do what I want. Is there a clean solution?

  • Does this possible duplicate answer your question? Mix align and enumerate. Jun 16 '11 at 6:40
  • That example doesn't quite do what I want, for a couple reasons. First, it's using align, which puts everything into math mode. Also, the numbering there goes across rather than down. But the more major problem is that it's still making me type multiple semantic "rows" on one source row, which means having to redo everything if I decide to change the number of columns. Like, it has `\num&& x^2 + y^2 &= 1 \qquad& \num&& a + b &= c & \num&& r-x &= y+z \`, but that is combining three semantically separate items into one row (terminated by \).
    – BrenBarn
    Jun 16 '11 at 7:17
  • @BrenBarn: You're right, your question is quite different. I actually thought of the first part of the accepted answer to that other question and its use of multienumerate. That looked quite good to me. Jun 16 '11 at 12:32
  • 1
    Well, my question isn't just about to get a certain output. There are tons of ways to get the right output. The problem is that most of them require me to specify information that's redundant, semantically irrelevant, or brittle with respect to later changes. My goal is to get a certain output with clean, semantically-grounded input.
    – BrenBarn
    Jun 16 '11 at 15:41
  • @BrenBarn Does this answer solve your problem?
    – Seamus
    Jun 22 '11 at 8:34

I've always been using \makebox for this purpose. If it's needed more than two or three times, one could make a macro that accepts n arguments for n columns. E.g.


   \itemrow{This should}{align}{and stuff}
   \itemrow{This should}{also align}{and everything}
   \itemrow{This should}{additionally align}{and all}
   \itemrow{This here should}{be aligned}{with the rest}

But that is a rather inflexible solution of course.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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