2

I want to use a list-like environment, but I need to put some short items on the same line. The user interface will be something like:

\begin{enumerate}
\item First very long element
\item* shrot 
\item short
\itme Last very long element
\end{enumerate}

The output should look like this:

  1. First very long element
  2. short 3. short
  3. Last very long element

I marked the item with a *, but it can be other macro name; or an environment that contains the short elements.

  • Is there a reason you want to do specifically this? Having the items bunch in this way will violate the expectations of almost all people reading it, about how lists should be formatted. --- Have you considered making your entire list inline? This could be achieved using custom list environments, which would allow you to switch quickly to a traditional list format if you wished to compare the results. – Niel de Beaudrap Jul 15 '15 at 7:30
  • @NieldeBeaudrap I now, but I am duplicating a layout done in a graphical program. This problem arises in a bunch of solutions to some math exercises. It is not my preferred way to layout it, but I have to use as less space as reasonable. – TeXtnik Jul 15 '15 at 7:47
  • Perhaps you'd be interested in the tasks package, that is originally designed for the layout of solutions to exercices in horizontally enumerated lists. It has a \task* command that allows for the specific item to use the remaining space on the line. – Bernard Jul 15 '15 at 16:03
2

enumitem has always met my needs for lists. However, I'm not sure it is the best option here.

multienum seems designed to do just what you want.

It provides an environment multienumerate within which you can use commands such as \mitemx{} to define a line with a single item, \mitemxx{}{} for a line with 2 and so on. You can also say something like \mitemxxxo{}{}{} if you have 3 items and want them to be spaced as if there was a phantom fourth item rather than spacing them evenly. This can be used to get things aligned nicely if required.

Here is an example which is based on the idea of a 4 column layout:

4 columns aligned

Although hardly wise, you can even create enumerations in which things are not nicely aligned, if that happens to tickle your fancy. Don't try this at home:

non-aligned appearances

The code:

\documentclass{article}
\usepackage{kantlipsum}
\usepackage{multienum}
\begin{document}
\kant[1]
Now we turn to a listing of things in themselves.
\begin{multienumerate}
  \mitemx{Our conceptual understanding of space which must shape the way in which we understand spatial relationships.}
  \mitemxxxo{Being 1}{Being 2}{Being 3}
  \mitemxxxx{First Being}{Second}{Third}{Fourth}
  \mitemxx{This is a ponderous one.}{This less so.}
  \mitemx{Our concept of time gives rise to a number of extremely perplexing antimonies.}
\end{multienumerate}
Now we turn to a listing of appearances.
\begin{multienumerate}
  \mitemx{\kant[2]}
  \mitemxxx{Appearance 1}{Appearance 2}{Appearance 3}
  \mitemxxxx{First Appearance}{Second}{Third}{Fourth}
  \mitemxxxxx{a}{b}{c}{d}{e}
  \mitemx{The phenomena give rise to a number of extremely perplexing antimonies concerning the noumena.}
  \mitemxx{This is a somewhat ponderous appearance.}{This is not really any less so.}
  \mitemxxxxx{a}{b}{c}{d}{e}
\end{multienumerate}
\end{document}

The package appears to support rows of up to 5 items, although the documentation says it supports fewer than this.

1

The enumitem package version 3.0 provide inline lists (horizontal lists), for their use just add inline in the options when calling the package, this provides the environments
enumerate*, itemize* and description* they can be used as follows

\documentclass{article}
\usepackage[inline]{enumitem}

\newcommand{\inline}[1]{\stepcounter{enumi}
\def\c{\theenumi}
\begin{enumerate*}[label=\arabic*. ,start=\c]
\item #1
\end{enumerate*}}

\begin{document}

\begin{enumerate}
\item First very long element
\item short \inline{short} \inline{short}
\item Last very long element
\end{enumerate}

\end{document}

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.