I would like to insert some explanatory text between two items of a numbered list.
Is there a command that can do this in the same way as the \intertext command in an align environment?
I would like to insert some explanatory text between two items of a numbered list.
Is there a command that can do this in the same way as the \intertext command in an align environment?
Use the enumitem package and two separate enumerate environments, adding resume as option to the second environment.
\documentclass{article}
\usepackage{enumitem}
\begin{document}
Some text.
\begin{enumerate}
\item First item of enumerated list.
\item Second item.
\end{enumerate}
Some explanatory text.
\begin{enumerate}[resume]
\item Third item.
\end{enumerate}
\end{document}

\newcommand{\myintertext}[1]{\end{enumerate} #1\begin{enumerate}[resume]}.
–
Sep 30 '13 at 08:58
\usepackage[shortlabels]{enumitem}with more sophisticated labels the possibility to use multiple arguments is very helpful: \begin{enumerate}[step 1):, resume]
– Jakob
Aug 10 '19 at 13:34
Here is a custom command, \enumeratext, which works like \intertext, it does not require enumitem:
\newcounter{saveenumerate}
\makeatletter
\newcommand{\enumeratext}[1]{%
\setcounter{saveenumerate}{\value{enum\romannumeral\the\@enumdepth}}
\end{enumerate}
#1
\begin{enumerate}
\setcounter{enum\romannumeral\the\@enumdepth}{\value{saveenumerate}}%
}
\makeatother
Example:
\documentclass{article}
\newcounter{saveenumerate}
\makeatletter
\newcommand{\enumeratext}[1]{%
\setcounter{saveenumerate}{\value{enum\romannumeral\the\@enumdepth}}
\end{enumerate}
#1
\begin{enumerate}
\setcounter{enum\romannumeral\the\@enumdepth}{\value{saveenumerate}}%
}
\makeatother
\begin{document}
Here is a list:
\begin{enumerate}
\item Something,
\item some other thing,
\item and more;
\enumeratext{Some intertext}
\item let's continue,
\begin{enumerate}
\item here is a sublist,
\item some stuff,
\enumeratext{more intertext}
\item yet another stuff.
\end{enumerate}
\item last thing.
\end{enumerate}
\end{document}

Update: Now works for lower level list.
I achieved the task by just putting
\item[] instead of \item in front of the inter text
Here is an analogue for \intertext called \listintertext:
\documentclass{article}
\makeatletter
\newcommand{\listintertext}{\@ifstar\listintertext@\listintertext@@}
\newcommand{\listintertext@}[1]{% \listintertext*{#1}
\hspace*{-\@totalleftmargin}#1}
\newcommand{\listintertext@@}[1]{% \listintertext{#1}
\hspace{-\leftmargin}#1}
\makeatother
\begin{document}
\noindent
Some text.
\begin{enumerate}
\item First item of enumerated list.
\begin{itemize}
\item First bullet.
\listintertext*{Some explanatory text.}
\item Second bullet.
\listintertext{Some explanatory text.}
\item Third bullet.
\end{itemize}
\item Second item.
\listintertext{Some explanatory text.}
\item Third item.
\end{enumerate}
\end{document}
The starred version \listintertext* always sets the text flush with the left margin, regardless of the nesting depth, while the unstarred version \listintertext sets the text with only the current list depth left margin removed.
\parbox with some \struts. That would allow multiple lines.
– Werner
May 16 '19 at 03:36
This is not necessarily better but I have used the following, due to Michel Bovani, for many years:
\makeatletter
\newcommand{\interitemtext}[1]{%
\begin{list}{}
{\itemindent=0mm\labelsep=0mm
\labelwidth=0mm\leftmargin=0mm
\addtolength{\leftmargin}{-\@totalleftmargin}}
\item #1
\end{list}}
\makeatother
The only improvement I have ever wished is to be able to control the vertical space above and below the interitemtext.
Here is an overkill solution using a math environment $ ... $:
\begin{itemize}
\item Pre-text
$ \text{middle text} $
\item Post-text
\end{itemize}
If you want the text to be centered, use $$ instead of $
$$ would do that, but $ will just keep typing in the same line. You'd need to force a new line (perhaps with \\, but then the $ is really doing nothing).
– Teepeemm
Oct 02 '20 at 00:15