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.

  • 1
    Have you tried \newcommand*\doexercise[1][{\includegraphics[scale=0.125]{g3016}}]{...} (notice the extra pair of braces around \includegraphics[...)? – clemens Dec 11 '13 at 21:38
  • @cgnieder Why does that work and not as I have it? – azetina Dec 11 '13 at 21:39
  • because of the square brackets, see tex.stackexchange.com/q/99495/5049 – clemens Dec 11 '13 at 21:43
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

  • Seems to do the job. I had redefined the entire multinenum package but I guess I prefer your code sample. Thanks. – azetina Jul 1 '13 at 20:39
  • Can this be done so that the asterisk occurs on the item its placed? I was thinking with an if else statement but hmmmmm not sure. – azetina Dec 10 '13 at 17:21
  • @azetina probably not without redefining all the \mitem<x> macros – clemens Dec 10 '13 at 18:36
  • Why can't I include a graphics. See my question edit. – azetina Dec 11 '13 at 21:30

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.