Is there a way to get the n'th element of a list, e.g. an enumerate? Itemize, enumerate and others are all wrappers for the list environment, defined in the LaTeX kernel.

Regardless of the existence of the n'th element, I want to place the items into a tabular environment. The first thing to do would be to prevent the list environment from printing the items. I couldn't exactly grasp the how list operates with \item, but I would guess calling \item does not store the contents of that item in somewhere? And I also guess that what I want to do requires some hooks, since the items are going to be placed arbitrarily in an arbitrary tabular environment? Right, I'm a bit confused.

Further explanation: I want to create a multiple choice question environment with a flexible format. Look at here. {32} means 2 tabular environments, one with 3 and the other with 2 columns. I am modifying choices environment from the exam package.

  • 2
    Can you give an example of what you want to achieve?
    – Guido
    Oct 28 '12 at 21:31
  • @Guido I edited the question with more explanation.
    – osolmaz
    Oct 28 '12 at 21:41
  • 1
    Perhaps this might be helpful: onlyitems? How to select specific items from an item list. Oct 29 '12 at 0:22
  • I did a workaround by writing from scratch, but answers are still welcome.
    – osolmaz
    Oct 29 '12 at 9:50
  • 1
    @OnurSolmaz Why don't you post your workaround here?
    – egreg
    Dec 1 '12 at 21:53

What I wanted to do was to create my own layout to typeset a multiple choice question. Since a multiple choice question is composed of a question body and a list of choices, it was logical to manipulate a Latex list derivative to suit my needs. I did not know my way around TeX Macros at the time, so I did not have a clue on how to do that.

I ended up modifying the environments from the exam package. I wanted to place the choices in flexible layouts, so I created two environments choices and choices*.

choices is a simplified version of its counterpart from the exam package. I just modified the spaces and choice label. (1 choice per line)

choices* allows you to create flexible layouts using the tabular environment. For example, if you have 5 choices, you may want to distribute it like 3x2 or 2x2x1, (3 choices for the first line, 2 choices for the second line, and vice versa).

I did it all by learning TeX ^^. I mean macros, counters and everything. I asked the question because I did not know how to use arrays, counters and for loops. Now that I know, my question seems irrelevant.

  • Ah, I remember when that first happened to me. The first bit of TeX programming I learned was \expandafter. Then I asked for the TeXbook as a birthday present...
    – Ryan Reich
    Dec 2 '12 at 7:02

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.