4

For starters this question might have already been asked and answered, but as I do not know how to properly call what I want, I cannot find an answer.

So I was wondering how can you do enumeration inside paragraphs? the \begin{enumerate}...\end{enumerate} is nice, but it is not quite what I want. I want to insert same enumeration in my paragraphs without the enumeration part having its own newline (if that makes sense). So something like: "[...] Note that (1.) .... By (1.), we conclude that...".

Is there a way to do with LaTeX, or does everyone just insert the enumeration by hand?

2 Answers 2

5

You can use the enumitem package with the inline option. Starred enumerate environments will look like what you are asking for.

\documentclass{article}
\usepackage[inline]{enumitem}
\begin{document}
This is an example paragraph meant to demonstrate
\begin{enumerate}[label=(\arabic*)]
    \item how enumitem works
    \item with the inline option
    \item compared to the unstarred version
\end{enumerate}

This is an example paragraph meant to demonstrate
\begin{enumerate*}[label=(\arabic*)]
    \item how enumitem works
    \item with the inline option
    \item compared to the unstarred version
\end{enumerate*}
\end{document}

enter image description here

3
  • 1
    We posted the same answer a the same time. Yours has an additional typo, the package is enumitem not enumerate. :)) Commented Sep 6, 2020 at 17:43
  • Thanks for catching that! Commented Sep 6, 2020 at 17:44
  • 1
    In addition to this (perfect) answer, I find the options itemjoin and itemjoin* pretty useful for inline enums. You can try this environment: \newenvironment{inlineenum}[1][and]{\begin{enumerate*}[label={{\rm(\roman*)}}, itemjoin={{; }}, itemjoin*={{; #1 }},]}{\end{enumerate*}} which adds semicolons between items and ends with "... foo; and (n.) bar", which I find more readable :-)
    – Bromind
    Commented Sep 7, 2020 at 13:34
6

You can load the enumitem package with the option inline. It defines the environment enumerate* which does exactly what you want.

If you also want to change the default numbering from 1. to (1.) you can also do that within enumitem. The following MWE does what you want.

\documentclass{article}

\usepackage[inline]{enumitem}

\begin{document}
    Note that
    \begin{enumerate*}[label=(\arabic*.)]
        \item  \label{1} this is an answer. 
        \item  By \ref{1}, we conclude that the answer works.
    \end{enumerate*}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .