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'm trying to have a list with no labels and no indentation - aligned at the same left margin as the preceding text. Why doesn't this work? :

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\noindent No indentation --- before the \verb|list|.
\begin{list}{}{}
\setlength{\leftmargin}{0pt}
\setlength{\labelwidth}{0pt}
\setlength{\labelsep}{0pt}
\item \lipsum[2]
\end{list}
\end{document}
share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

It works if you set the length parameters within the second argument of \begin{list}:

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\noindent No indentation --- before the \verb|list|.
\begin{list}{}{%
  \setlength{\leftmargin}{0pt}%
  \setlength{\labelwidth}{0pt}%
  \setlength{\labelsep}{0pt}%
}
\item \lipsum[2]
\end{list}
\end{document}

You may also use a trivlist environment. Quoting Lamport, LaTeX: A document preparation system, p. 115:

The trivlist environment is a restricted form of the list environment in which margins are not indented and an \item command with no optional argument produces no text. The environment has no arguments and is very much like a list environment whose second argument sets \leftmargin, \rightmargin, \labelwidth, and \itemindent to a length of zero.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\noindent No indentation --- before the \verb|list|.
\begin{trivlist}
\item \lipsum[2]
\end{trivlist}
\end{document}
share|improve this answer
add comment

This is a supplement to lockstep's answer.

When you perform the length modifications, the list parameters are already set up using the TeX \parshape primitive. For shaping properties, you need to use the second argument in \begin{list}{#1}{#2} since it is inserted before setting the list shape:

\def\list#1#2{%
  \ifnum \@listdepth >5\relax
    \@toodeep
  \else
    \global\advance\@listdepth\@ne
  \fi
  \rightmargin\z@
  \listparindent\z@
  \itemindent\z@
  \csname @list\romannumeral\the\@listdepth\endcsname
  \def\@itemlabel{#1}%
  \let\makelabel\@mklab
  \@nmbrlistfalse
  #2\relax %                       <---- #2 is inserted here
  \@trivlist
  \parskip\parsep
  \parindent\listparindent
  \advance\linewidth -\rightmargin
  \advance\linewidth -\leftmargin
  \advance\@totalleftmargin \leftmargin
  \parshape \@ne \@totalleftmargin \linewidth % <---- this sets the paragraph shape
  \ignorespaces}

Knowing the list has an indent of \@totalleftmargin, which is \advanced by \leftmargin, it also works to set \@totalleftmargin to -\leftmargin:

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\noindent No indentation --- before the \verb|list|.
\begin{list}{}{}
  \makeatletter
  \setlength{\leftskip}{-\@totalleftmargin}
  \makeatother
  \item \lipsum[2]
  \item \lipsum[1]
\end{list}
\end{document}​
share|improve this answer
add comment

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.