1

Hello I want to do an explanation between the items of a enumerate environment, I found this:

\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

And I thought it work, but the problem is that if I change the numbers of enumerate with letters, it fails, as in the following example:

\documentclass{article}
\usepackage{enumerate}
\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}
A list:
\begin{enumerate}[a)]
\item number 1
\item things note usefull,
\item hello mom, I am famous;
\enumeratext{Some intertext}
\item not really, so sad.

\end{enumerate}

\end{document}

Any idea would help, I know the use of [resume] in enumitem, but using that package I don't know how to change the numbers for letters. Thanks.

4

The underlying assumption is that you insist on using enumerate rather than enumitem. There are valid reasons for that, but the inability of enumitem to provide lists that are numbered by roman numerals is not one of them because enumitem can do that.

\documentclass{article}
\usepackage{enumitem}
\begin{document}
A list:
\begin{enumerate}[label=\alph*)]
  \item number 1
 \item things note useful,
 \item hello mom, I am famous;
\end{enumerate} 
Some intertext
\begin{enumerate}[resume*]
 \item not really, so sad.
\end{enumerate}
\end{document}

enter image description here

Anyway, we assume that there is such another reason like that you did everything else with enumerate or some incompatibility. Then you could do

\documentclass{article}
\usepackage{enumerate}
\newcounter{saveenumerate}
\makeatletter
\def\enumerate{%
  \xdef\@last@enumerate@arg{none}%
  \ifnum \@enumdepth >3 \@toodeep\else
      \advance\@enumdepth \@ne
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}\fi
  \@ifnextchar[{\@@enum@}{\@enum@}}
\def\@@enum@[#1]{%
  \xdef\@last@enumerate@arg{#1}%
  \@enLab{}\let\@enThe\@enQmark
  \@enloop#1\@enum@
  \ifx\@enThe\@enQmark\@warning{The counter will not be printed.%
   ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi
  \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}%
  \expandafter\let\csname the\@enumctr\endcsname\@enThe
  \csname c@\@enumctr\endcsname7
  \expandafter\settowidth
            \csname leftmargin\romannumeral\@enumdepth\endcsname
            {\the\@enLab\hspace{\labelsep}}%
  \@enum@}
\newcommand{\enumeratext}[1]{%
\setcounter{saveenumerate}{\value{enum\romannumeral\the\@enumdepth}}
\end{enumerate}
#1
\def\@none{none}
\ifx\@last@enumerate@arg\@none%
\edef\temp{\noexpand\begin{enumerate}}%
\else
\edef\temp{\noexpand\begin{enumerate}[\@last@enumerate@arg]}%
\fi
\temp%
\setcounter{enum\romannumeral\the\@enumdepth}{\value{saveenumerate}}%
}
\makeatother

\begin{document}
A list:
\begin{enumerate}[a)]
\item number 1
\item things note useful,
\item hello mom, I am famous;
\enumeratext{Some intertext}
\item not really, so sad.

\end{enumerate}

A list:
\begin{enumerate}
\item number 1
\item things note useful,
\item hello mom, I am famous;
\enumeratext{Some intertext}
\item not really, so sad.

\end{enumerate}


\end{document}

enter image description here

@DavidCarlisle: this may be bad, but is certainly not as bad as BREXIT.

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.