modify enumerate environment to pre-pend characters before the number

i would like to generate an enumerated list that looks like this:

D.4(1) Something (else): plaintext.

D.4(2) Something (else): plaintext.

etc.

in other words, the counter is after some other text, which is constant. i could live without the bold/ital stuff after, as that is easy to do otherwise, but i'd really appreciate any tips on the other stuff.

-

migrated from stackoverflow.comNov 21 '12 at 16:48

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  egreg Nov 21 '12 at 17:02

When considering list manipulation, enumitem is king. Here's a small example duplicating your requested output:

\documentclass{article}
\usepackage{enumitem}% http://ctan.org/pkg/enumitem
\begin{document}
\begin{enumerate}[
leftmargin=*,
label={D.4(\arabic*)\ \textbf{\textit{Something} (else)}:},
ref={D.4(\arabic*)}]
\item plain text 1
\item plain text 2
\end{enumerate}
\end{document}

• label sets the way the label is displayed at each enumeration;
• ref sets the way a reference to an item will be displayed (could be different from label); and
• leftmargin adjust the left margin of the enumeration.

Of course, if D.4 is some other reference (or counter), like a chapter/section number, replace it with \thechapter/\thesection in label and ref.

More on the specifics involved, including making these setting globally active or creating your own lists (and not have to specify the options at each enumeration), see the enumitem documentation.

-