9

I am using latex to type up a logical system that has some equations. The abbreviation for the logical system is DAS. I would like the equations to be numbered DAS.1 DAS.2 ... DAS.n

I expected that

\begin{enumerate}[{DAS.1}]
    \item
    \item
    ...
   \item
\end{enumerate}

would work. However the output I get is:

D1S.1 D2S.2 ... DnS.n

So I suppose the question could be restated as: how does one control which letter the enumerate environment ... enumerates? Any suggestions are greatly appreciated.

1
  • Ah. I just figured out a hackish way to do it. use \begin{enumerate}[\text{DAS}.1] instead.
    – user1246375
    Mar 14, 2012 at 17:27

2 Answers 2

9

The enumerate package provides the optional argument functionality to listing environments like enumerate. However, to make this work as expected, you need to "shield" the unwanted enumeration from the choices. This is done by putting DAS inside braces, and therefore using

\begin{enumerate}[{DAS}.1]

since in

\begin{enumerate}[{DAS.1}]

the first available enumerations (albeit grouped) are specified by A and 1, causing the D1S.1, D2S.2, ... output. That is, enumerate identifies two locations to place the enumeration, and sets the enumeration style as the last one encountered (1/\arabic in this case). Consequently, using

\begin{enumerate}[{DAa1S.1}]

would yield the enumeration D111S.1, D222S.2, ..., as is visible from the following minimal example:

enter image description here

\documentclass{article}
\usepackage{enumerate}% http://ctan.org/pkg/enumerate
\begin{document}
\begin{enumerate}[{DAS}.1]
  \item stuff
  \item stuff
  \item stuff
\end{enumerate}
\begin{enumerate}[{DAa1S.1}]
  \item stuff
  \item stuff
  \item stuff
\end{enumerate}
\end{document}
8

Similar to the answer provided at how to represent cross and tick in itemize bullets, except this is for enumerate.

If you are using the enumitem package you can use \setlist[enumerate,<n>]{label={DAS.\arabic*}} to set the enumeration label for the depth of <n>:

enter image description here

\documentclass{article}
\usepackage{enumitem}

\setlist[enumerate,1]{label={DAS.\arabic*}}
\setlist[enumerate,2]{label={BOOT.\arabic*}}

\begin{document}
\begin{enumerate}
    \item foo 1
    \item foo 2
    \begin{enumerate}
        \item bar 1
        \item bar 2
    \end{enumerate}
\end{enumerate}
\end{document}

Alternatively, you can also do it on a per list basis:

\documentclass{article}
\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label={DAS.\arabic*}]
    \item foo 1
    \item foo 2
    \begin{enumerate}[label={BOOT.\arabic*}]
        \item bar 1
        \item bar 2
    \end{enumerate}
\end{enumerate}
\end{document}

A third option would be to define your own list type:

\documentclass{article}
\usepackage{enumitem}

\newlist{DasList}{enumerate}{1}
\setlist[DasList,1]{label={DAS.\arabic*}}

\newlist{BootList}{enumerate}{1}
\setlist[BootList,1]{label={BOOT.\arabic*}}

\begin{document}
\begin{DasList}
    \item foo 1
    \item foo 2
    \begin{BootList}
        \item bar 1
        \item bar 2
    \end{BootList}
\end{DasList}
\end{document}

Without the enumitem package you use \renewcommand{\labelenum<n>}{DAS.\arabic{enum<n>}} where <n> is a roman numeral (i, i, iii, or iv) representing the nesting depth of enumerate. The following yields a similar result to above:

\documentclass{article}
\usepackage{amsfonts}

\renewcommand{\labelenumi}{DAS.\arabic{enumi}}
\renewcommand{\labelenumii}{BOOT.\arabic{enumii}}

\begin{document}
\begin{enumerate}
    \item foo 1
    \item foo 2
    \begin{enumerate}
        \item bar 1
        \item bar 2
    \end{enumerate}
\end{enumerate}
\end{document}

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.