0

I have nested enumerate levels. I wish to know "where I am". I mean, in part II.1. or in I.3.a) etc.

I tried to explore the information I can get with '**\labelenumi-\labelenumii-\labelenumiii **'. The values returned are bizarre; MNWE :

\documentclass{article}
\usepackage{enumitem}
%
\begin{document}

\begin{enumerate}
    \\**\labelenumi-\labelenumii-\labelenumiii **\\
    \item list 1
    ** \labelenumi-\labelenumii-\labelenumiii **
    \begin{enumerate}
        \item \textbf{Item1}. Item 1.\index{Item1}
        **\labelenumi-\labelenumii-\labelenumiii **
        \item \textbf{Item2}. Item 2.\index{Item2}
        **\labelenumi-\labelenumii-\labelenumiii **
    \end{enumerate}
    **\labelenumi-\labelenumii-\labelenumiii **\\
    \item list 2
    ** \labelenumi-\labelenumii-\labelenumiii **
    \begin{enumerate}
        \item \textbf{Item3}. Item 3.\index{Item3}
        **\labelenumi-\labelenumii-\labelenumiii **
        \item \textbf{Item4}. Item 4.\index{Item4}
        **\labelenumi-\labelenumii-\labelenumiii **
        \item \textbf{Item5}. Item 5.\index{Item5}
        **\labelenumi-\labelenumii-\labelenumiii **
    \end{enumerate}
    \item list 3
    ** \labelenumi-\labelenumii-\labelenumiii **
    \begin{enumerate}
        \item \textbf{Item2}. Item 2.\index{Item2}
    ** \labelenumi-\labelenumii-\labelenumiii **
        \item \textbf{Item4}. Item 4.\index{Item4}
    ** \labelenumi-\labelenumii-\labelenumiii **
        \item \textbf{Item6}. Item 6.\index{Item6}
    ** \labelenumi-\labelenumii-\labelenumiii **
    \end{enumerate}
    ** \labelenumi-\labelenumii-\labelenumiii **
\end{enumerate}
    ** \labelenumi-\labelenumii-\labelenumiii **
%
\end{document}

MNWE

The problems :

  • when I just opened the item 2 on the first level, I get "2-(c)" instead of "2-()" I should have
  • I wish I can get rid of the () in 3-(a) to have 3-a
  • what happens if I modifiy some levels with let's say Question instead of enumerate, can I still use labelenumi and alike ?
5
  • 3
    You surely get an error with this code because \item must follow \begin{enumerate} directly. You can't have e.g. \\**... at that point.
    – cfr
    Commented Jul 10 at 11:44
  • 3
    Replace \labelenumii by \alph{enumii} to eliminate the brackets only in the labelling lines and not in the item labels. The value of the counter is correct as this will be reset only when it is needed for a new list. If you zero the counter at the end of the list, for instance, you will break resume. In general, this feels like an XY problem and I wonder what your ultimate goal is. Why do you want to typeset the current levels in this way? What's the use you have in mind?
    – cfr
    Commented Jul 10 at 11:56
  • @cfr I need the reference of the place in the hierarchy to put additionnal information in the LaTeX source (points, answer, etc.). This will go in a worksheet to help correction of copies. Commented Jul 10 at 12:19
  • I wouldn't worry about retrieving the level in that case. I'd use a custom environment (if you might also want a regular enumerate) and enumitem config and/or custom macros to add extra information as appropriate. (Actually, not just 'I would do this', but 'I do do this' although the info and purpose is a little different.)
    – cfr
    Commented Jul 10 at 15:16
  • Or you could use one of the existing packages for this. Especially if you want to print answer keys and worksheets from a single source.
    – cfr
    Commented Jul 10 at 15:38

0

You must log in to answer this question.

Browse other questions tagged .