June 1, 2017

Inline Enumerations in LaTeX

Normally you use the \enumerate command in LaTeX to create enumerated lists like this:

  1. I
  2. use
  3. lots
  4. of
  5. space!

If you prefer your enumeration “inline”, you could do that:

...

\newcommand{\inlineEnum}[1]{
  \ifcsname c@#1\endcsname
  	\addtocounter{#1}{1}
  	\textbf{\arabic{#1})~}
  \else
  	\newcounter{#1}
  	\setcounter{#1}{1}
  	\textbf{\arabic{#1})~}
  \fi
}

...

\begin{document}

\inlineEnum{counter} Here is some text.
\inlineEnum{counter} Here is some more text.
\inlineEnum{counter} And another sentence!

...

\end{document}

Much better:

  1. Here is some text. 2) Here is some more text. 3) And another sentence!

© ho1ger 2015 - 2022