21

I would like to add an asterisk after certain labels in the enumerate environment. So for example

\documentclass{article}
\begin{document}

\begin{enumerate}
    \item Kuttel
    \item* Daddeldu
\end{enumerate}

\end{document}

but without the space between 2. und *.

mosaic
  • 313

5 Answers5

12
\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{##1\ifmoditem\rlap{\mesymbol}\fi\enspace}%
    \global\moditemfalse}%
}

\begin{document}
\begin{modenumerate}
\item uno
\item due
\moditem{*} tre
\item\label{four} quattro
\moditem{*}[\hfill\ref{four}.] quattro
\end{modenumerate}
\end{document}

enter image description here

For an enumitem complying version:

\documentclass[a4paper]{article}
\usepackage{enumitem}

\newenvironment{modenumerate}[1][] {\enumerate[#1]\setupmodenumerate} {\endenumerate}

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

\begin{document}

\begin{modenumerate} \item uno \item due \moditem{} tre \item\label{four} quattro \moditem{}[\hfill\ref{four}.] quattro \end{modenumerate}

Some text.

\begin{modenumerate}[resume] \item cinque \item sei \moditem{} sette \item\label{eight} otto \moditem{}[\hfill\ref{eight}.] otto \end{modenumerate}

\end{document}

enter image description here

egreg
  • 1,121,712
  • Why is resume option not working with this type of list? Could this be fixed? – mavzolej Sep 01 '23 at 06:36
  • @mavzolej There is no resume if you don't load enumitem. Please, open a new question showing the issue you have. – egreg Sep 01 '23 at 08:00
  • Interesting. I do have the package enumitem included in the preamble, and it does work for the usual enumerate environment but not for this new one. – mavzolej Sep 01 '23 at 08:28
  • 1
    @mavzolej Now I see. Added the example. – egreg Sep 01 '23 at 09:10
2
\begin{enumerate}

\item One

\item Two

\item $\!\!\!\!{^*}$ Three

\item Four

\end{enumerate}

does the trick! Easy.

\! moves the next text a tad to the left, use as many or few as to your preference.

Werner
  • 603,163
1

One solution might be to tailor your labels like this:

\documentclass{article}
\begin{document}

\begin{enumerate}
    \item[1. ] Kuttel
    \item[2.*] Daddeldu
\end{enumerate}

\end{document}

Notice the extra space after the 1. in order to align 1 and 2 vertically.

Beware: this solution is pureley an aesthetic one for single levels enumerations. I don't know what will become of the nested items...

It is very simple but not scalable.

Martigan
  • 3,146
1

I have the following solution that puts stars before the labels:

\documentclass{article}

\begin{document}
\begin{enumerate}
\item A first item
  \bgroup
  \let\oldenum\labelenumi
  \renewcommand\labelenumi{*\oldenum}
  \item A starred item
  \egroup
\item A third item
  \bgroup
  \let\oldenum\labelenumi
  \renewcommand\labelenumi{*\oldenum}
  \item Another starred item
  \egroup
\end{enumerate}
\end{document}

Changing \renewcommand\labelenumi{*\oldenum} to \renewcommand\labelenumi{\oldenum *} messes up the alignment of the numbers.

I couldn't get this to work as a macro though.

Seamus
  • 73,242
-1

one can use "description" instead of "enumerate"

\begin{description}
\item $1.^{*}$   Kuttel
    \item $2.^{*}$ Daddeldu
\end{description}
  • While this is a possible solution it might get tedious to use this for each \item line and the alignment of the description text is lost! –  Jan 04 '17 at 12:58