4

@egreg answered beautifully my question on adding an asterisk to an item locally by introducing the command \moditem. I am wondering if this is possible with specific items in the multienum package. This is what I have so far:

\documentclass[letterpaper]{article}

\usepackage{multienum}

\begin{document}
    \begin{multienumerate}
    {\renewcommand{\labelname}{\llap{*}\csname
labelenum\romannumeral\themultienumdepth\endcsname}
        \mitemx{one}
        \mitemxx{two}{three}}
        \mitemxx{four}{five}
    \end{multienumerate}
\end{document} 

enter image description here

The problem I see is that the multienum does not define each item independently, e.g. \mitemxx{<content>}{<content>}. So for example, if I want to put an asterisk to item 3 it would be a little difficult, at least for me. Essentially, I want to be able to put an asterisk in possibly two different ways:

  1. A command like \mitemax{<content with asterisk>}{<content without asterisk>} so that wherever the a is found then there is where the asterisk is found. So that \mitemxa would define a different scenario. Of course, I believe this is tough as you would possibly need to create several custom commands for all scenarios of \mitemx, \mitemxx, \mitemxxx, \mitemxxxx,\mitemxxxxx.
  2. Simply a command, say \astmitem that redefines locally the label. For example, \mitemxx{\astitem <content>}{<content>} will put an asterisk at the front of the first item. This is easier but I can't figure it out.

UPDATE

The answer @cgnieder provided was excellent but when I do something like:

\newcommand*\doexercise[1][\includegraphics[scale=0.125]{g3016}]{%
  \gdef\labelname{%
    \llap{#1}%
    \csname labelenum\romannumeral\themultienumdepth\endcsname
    \gdef\labelname{%
      \csname labelenum\romannumeral\themultienumdepth\endcsname}%
  }}

it does not work. Why? The graphics file could be replaced with any symbol. Works well if you replace \includegraphics[scale=0.125]{g3016} with *.


Solved by replacing \includegraphics[scale=0.125]{g3016} with {\includegraphics[scale=0.125]{g3016}}. You can read ] inside an optional argument for further info as to the fix.

azetina
  • 28,884

1 Answers1

2

Here's an idea for a \starnext command that redefines \labelname in a way that it will restore itself when called. This gives you nearly the syntax that you outlined in your question:

\documentclass{article}

\usepackage{multienum}
\newcommand*\starnext{%
  \gdef\labelname{%
    \llap{*}%
    \csname labelenum\romannumeral\themultienumdepth\endcsname
    \gdef\labelname{%
      \csname labelenum\romannumeral\themultienumdepth\endcsname}%
  }}

\begin{document}

\begin{multienumerate}
  \mitemx{one\starnext}
  \mitemxx{two}{three}
  \mitemxx{four\starnext}{five}
\end{multienumerate}

\begin{multienumerate}\starnext
  \mitemx{one}
  \mitemxx{two}{three\starnext}
  \mitemxx{four}{five}
\end{multienumerate}

\end{document}

enter image description here

cgnieder
  • 66,645