Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

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}
share|improve this answer
    
I guess it was that hard to figure that one out...:-) Guess its just my lack of understanding your the code above. Is there another way without introducing a new enumerate environment? Like just having \moditem within the normal enumerate. –  azetina Jun 26 '12 at 14:49
    
@azetina You can try \appto{\enumerate}{\setupmodenumerate} (requires the etoolbox package), but it won't work with enumitem –  egreg Jun 26 '12 at 14:54
    
No way of doing it with enumitem, right? –  azetina Jun 26 '12 at 15:16
    
@azetina You could try \setlist[enumerate]{before=\setupmodenumerate} –  egreg Jun 26 '12 at 15:32
    
Congrats on your 100k record. :-) –  azetina Jun 27 '12 at 14:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.