[Tex/LaTex] Add an asterisk left of an enumerate

enumitemlists

I am looking for a simple way of adding an asterisk or some small image to the left of an enumerate such that the indentation of the enumeration is not affected by the latter. I have read Add asterisk after labels in enumerate and Add an asterisk in front of section label in TOC in which the latter has the effect am looking for.

Update: egreg's solution below is nice and does answer the problem. But I want the possible newcommand to be used without introducing an newenvironment like just having \moditem inside the enumerate and working with enumitem.

Best Answer

Just modify accordingly the modenumerate environment defined in Add asterisk after labels in enumerate

\documentclass[a4paper]{article}
\newenvironment{modenumerate}
  {\enumerate\setupmodenumerate}
  {\endenumerate}

\newif\ifmoditem
\newcommand{\setupmodenumerate}{%
  \global\moditemfalse
  \let\origmakelabel\makelabel
  \def\moditem##1{\global\moditemtrue\def\mesymbol{##1}\item}%
  \def\makelabel##1{%
    \origmakelabel{\ifmoditem\llap{\mesymbol\enspace}\fi##1}%
    \global\moditemfalse}%
}

\begin{document}
\begin{modenumerate}
\item uno
\item due
\moditem{*} tre
\item quattro
\end{modenumerate}
\begin{enumerate}
\item uno
\item due
\item tre
\item quattro
\end{enumerate}
\end{document}

Instead of * you can use anything you want, as long as it can be set into an \mbox. The following enumerate is just to show that the result is the same.


If you are using the enumitem package, the following code allows the use of \moditem in any enumerate environment:

\usepackage{enumitem}
\setlist[enumerate]{before=\setupmodenumerate}

\newif\ifmoditem
\newcommand{\setupmodenumerate}{%
  \global\moditemfalse
  \let\origmakelabel\makelabel
  \def\moditem##1{\global\moditemtrue\def\mesymbol{##1}\item}%
  \def\makelabel##1{%
    \origmakelabel{\ifmoditem\llap{\mesymbol\enspace}\fi##1}%
    \global\moditemfalse}%
}

If you don't use enumitem, then change the first two lines into

\usepackage{etoolbox}
\appto{\enumerate}{\setupmodenumerate}
Related Question