1

I need to make my Enumerate look like this:

REQ/Text/001
REQ/Text/002
...

What i can do is this:

REQ/Text/1
...

But how can i add leading Zeros? I tried the answer in: Enumerate list - numbers with prefix but it doesnt work. It brings me something like:

REQ/Text/1!100 01!10 001

but the exclamation mark is turned around.
Sorry for my bad English, im from Germany.

Thanks.

Edit: A minimal Code example is:

    \documentclass[12pt, a4paper]{article}

    \usepackage{german,epsfig,longtable,graphicx,fullpage,float}%

    \usepackage[ansinew]{inputenc} % Umlaute (Windows)

    \usepackage{enumitem}

    \def\threedigits#1{% 
    \ifnum#1<100 0\fi 
    \ifnum#1<10 0\fi 
    \number#1}

    \begin{document}

    \begin{enumerate}[label=\textbf{RQ/Gru/\threedigits{\theenumi}}, leftmargin = *]
        \item \label{anfo:norm:S1}  
            \item \label{anfo:norm:S2}  
            \item \label{anfo:norm:S3}  
            \item \label{anfo:norm:S4}
    \end{enumerate}

    \end{document}

This minimal example produces the Error.

Error Messages are:

Missing number, threated as zero

Missing = inserted for \ifnum

  • Post your code. Using the answer in the question you linked works for me.. Maybe you forget the \usepackage{enumitem} in your preamble. – Red Sep 10 '13 at 8:12
  • I used the enumitem Package before, i get Error Messages like ! Missing Number threathed as zero. ...\threedigits{\theenumi} and Missing = inserted for \ifnum. In my preamble i have '\usepackage{enumitem} \def\threedigits#1{% \ifnum#1<100 0\fi \ifnum#1<10 0\fi \number#1}' – Dominic Sep 10 '13 at 8:17
  • Sorry for the bad Format, its my first Question on StackExchange – Dominic Sep 10 '13 at 8:22
  • 1
    not only these lines, provide a Minimal Working Example starting with \documentclass and ending with \end{document}. Edit your question not add the code in a comment, thnaks – Red Sep 10 '13 at 8:22
  • You may want to have a look at How to incorporate counter in list label. (This question may be a duplicate?) – clemens Sep 10 '13 at 8:38
2

You miss the \protect command before using the \threedigits one.

\documentclass[12pt, a4paper]{article}

\usepackage{german,epsfig,longtable,graphicx,fullpage,float}%

\usepackage[ansinew]{inputenc} % Umlaute (Windows)

\usepackage{enumitem}

\def\threedigits#1{% 
\ifnum#1<100 0\fi 
\ifnum#1<10 0\fi 
\number#1}

\begin{document}

\begin{enumerate}[label={\textbf{RQ/Gru/\protect\threedigits{\theenumi}}}, leftmargin = *]
    \item \label{anfo:norm:S1}  
        \item \label{anfo:norm:S2}  
        \item \label{anfo:norm:S3}  
        \item \label{anfo:norm:S4}
\end{enumerate}

\end{document}

enter image description here

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.