Sunday, May 13, 2012

How to get rid of extra line spaces in LATEX: itemize, list, enumerate

Hi all,

Sometimes, the default line spacing in enumerate or itemize is too large.
This is how you can reduce it:
  1. Create your own command and use it instead of {itemize} or {enumerate}
\documentclass[letterpaper,11pt]{report}

\newenvironment{packed_enum}{
\begin{enumerate}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{\end{enumerate}}

\newenvironment{packed_item}{
\begin{itemize}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{\end{itemize}}


\newenvironment{compactlist}{
 \begin{list}{{$\bullet$}}{
  \setlength{\partopsep}{5pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
  \setlength{\topsep}{0pt}
  \setlength{\itemsep}{0pt}
  \setlength{\itemindent}{0pt}
  \setlength{\leftmargin}{10pt}
 }
}{
 \end{list}
}

\begin{document}

\chapter{My List}

Here is my list.

\begin{packed_enum}
   \item Item 1
   \item Item 2
   \item Item 3
\end{packed_enum}

\begin{packed_item}
   \item Item 1
   \item Item 2
   \item Item 3
\end{packed_item}

\begin{compactlist}
\item Item 1
\item Item 2
\item Item 3
\end{compactlist}

\end{document}

--------------------------
By changing the size of {pt} in
\setlength{\itemindent}{0pt}
\setlength{\leftmargin}{10pt}
you can change the indent of the bullets.

Credit should go to the original post: http://www.devdaily.com/blog/post/latex/control-line-spacing-in-itemize-enumerate-tags

No comments:

Post a Comment