Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following macro that I found:

\newenvironment{itemizetight}[2]
  {\begin{list}{\labelitemi}{%
     \setlength{\itemsep}{#1}%
     \setlength{\labelwidth}{#2}%
     \setlength{\leftmargin}{\labelwidth}%
     \addtolength{\leftmargin}{\labelsep}%
   }%
  }
  {\end{list}}

However, it does not let me use \item[1.]. How can I change it so that I can use labels like in a typical itemize environment? Or alternatively, what would be the parallel for an enumerate environment?

The way to use it, for example is:

\begin{itemizetight}{-0.2em}{0.5em}
\item item 1
\item item 2
\end{itemizetight}
share|improve this question
1  
You should look up the enumitem package; it would make your life easier for this sort of things. –  Jubobs Jan 13 at 13:19
2  
I can't see any reason why \item should not work as usual (since you show no code that changes it) Please always include a complete document that shows the problem. –  David Carlisle Jan 13 at 13:20

1 Answer 1

Apart from the fact that I'm able to use things like \item[1.] inside your itemizetight environment, the "parallel" for the enumerate environment could be:

\newenvironment{enumtight}[2]
  {\begin{list}{\labelenumi}{%
     \usecounter{enumi}%
     \setlength{\itemsep}{#1}%
     \setlength{\labelwidth}{#2}%
     \setlength{\leftmargin}{\labelwidth}%
     \addtolength{\leftmargin}{\labelsep}%
   }%
  }
  {\end{list}}

You only have to change \labelitemi to \labelenumi and add the line \usecounter{enumi} to let the list use this counter.

MWE:

\documentclass{article}

\newenvironment{itemizetight}[2]
  {\begin{list}{\labelitemi}{%
     \setlength{\itemsep}{#1}%
     \setlength{\labelwidth}{#2}%
     \setlength{\leftmargin}{\labelwidth}%
     \addtolength{\leftmargin}{\labelsep}%
   }%
  }
  {\end{list}}

\newenvironment{enumtight}[2]
  {\begin{list}{\labelenumi}{%
     \usecounter{enumi}%
     \setlength{\itemsep}{#1}%
     \setlength{\labelwidth}{#2}%
     \setlength{\leftmargin}{\labelwidth}%
     \addtolength{\leftmargin}{\labelsep}%
   }%
  }
  {\end{list}}

\begin{document}

\begin{itemizetight}{-0.2em}{0.5em}
\item[1.] item 1
\item[2.] item 2
\end{itemizetight}

\begin{enumtight}{-0.2em}{0.5em}
\item item 1
\item item 2
\end{enumtight}

\end{document}

Output:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.