# Help with generalized list

I want to create an environment which contains a list to typeset auto-numbered thesis (just like one does with math formulae). I would like the spacing to be something like this:

This is the code I've managed to create:

\newenvironment*{Tesis}
{\begin{list}
{\hspace{14pt}(T\arabic{tesisc})}
{\setlength{\rightmargin}{0cm}%
\refstepcounter{tesisc}%
\setlength{\leftmargin}{2\parindent}}
\item
}
{\end{list}}


which unfortunately renders thus:

I've fiddled with every list parameter I know of (\labelwidth etc.), but with no avail.

How can I tweak the list environment to accomplish the desired effect?

-

enumitem is king of lists and provides a flexible interface:

\documentclass{article}
\usepackage{enumitem,lipsum}% http://ctan.org/pkg/{enumitem,lipsum}
\begin{document}
\lipsum[1]
\begin{enumerate}[label={(T\arabic*)},leftmargin=4em]
\item \lipsum[2]
\item \lipsum[3]
\end{enumerate}
\lipsum[4]
\end{document}


There are numerous examples on this site using , but the go-source would be the enumitem documentation. It also includes some examples.

-
It works brilliantly, cheers! – NVaughan Jan 3 '13 at 18:20

I would definitely use the enumitem package for this, but just in case you want a working version of your snippet, you can use the following

\documentclass{article}
\usepackage{lipsum}

\newcounter{tesisc}
\newenvironment*{Tesis}
{\begin{list}
{(T\arabic{tesisc})}
{\setlength{\rightmargin}{0cm}%
\refstepcounter{tesisc}%
\setlength{\leftmargin}{1cm}}
\item
}
{\end{list}}

% for references
\renewcommand{\thetesisc}{(T\arabic{tesisc})}

\begin{document}

\lipsum[1]
\begin{Tesis}
\lipsum[2]
\end{Tesis}
\begin{Tesis}\label{test}
\lipsum[2]
\end{Tesis}

Reference: \ref{test}

\end{document}


For further reading, have a look at Section 56 of source2e. Some examples are discussed in Definitive guide to trivlists

-
Thanks, @cmhughes. I'll have a look at the references you provide. – NVaughan Jan 3 '13 at 19:10

Using Werner's and cmhughes' answer, I came up with this code, which works fine for my purposes:

\newcounter{tesisc)
\newenvironment*{Tesis}
{\begin{enumerate}%
[label={(T\arabic{tesisc})},%
leftmargin=4em]
\refstepcounter{tesisc}\item
}
{\end{enumerate}}

-
You can clone the basic lists to create your own - probably very similar to what you're doing. See section 7 Cloning the basic lists in the enumitem documentation. Not sure why you're using \refstepcounter though, since \item should \refstepcounter{tesisc}... – Werner Jan 3 '13 at 19:04
If I don't specify \refstepcounter{tesisc} my count remains in 0. – NVaughan Jan 3 '13 at 19:12
Then your use is probably \begin{Tesis} something \end{Tesis} rather than \begin{Tesis} \item something \end{Tesis}? – Werner Jan 3 '13 at 19:17
Indeed, but I still require the \refstepcounter{tesisc} command. – NVaughan Jan 3 '13 at 19:46