5

I cannot get rid of the vertical space before and behind the lists. I have code like below:

\begin{list}{-}{%
  \setlength{\itemsep}{0pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}    
  \item First item
  \item Second item
\end{list}
kokosing
  • 153
  • I just had a similar problem, and setting various lengths to 0pt didn't help. It turned out that latex was expanding vertical spacing to get a nice page break at the end of a paragraph (which, of course, is a good thing). Something to watch out for if you're trying these answers on something that's not a MWE. – craq Sep 22 '14 at 11:17

2 Answers2

7

Add \setlength{\topsep}{0pt} to the list parameters. You could also use the enumitem package which offers a nolistsep option for the list environments.

0

I answered this at stackexchange where you originally posted (below). I tried the suggested use of `\setlength{tosep}{0pt} but don't know if it's what you want. It seems that that eliminates space in between list items but not before and after lists themselves, but I could be wrong. My solution below may be hackish (or maybe not...), but it leaves no space between a previous paragraph, the itemized list, the items themselves, or the following paragraph.


Itemize without itemizing...

Some text that is here and I want to see what it does. \\
  \indent$\bullet$\,first item \\
  \indent$\bullet$\,second item \\
Some text that is here and I want to see what it does.

Replace $\bullet$ with whatever you want.

\indent- first item\\
\indent$\cdot$\,first item\\
\indent$\circ$\,first item\\
\indent$\ast$\,first item\\

The "-" seems to work fine with the whitespace as shown but the rest need the trailing \, which inserts a space between the math symbol and the next word. Without it there will be no space between the "bullet" and the text that follows.

Hendy
  • 824
  • Yes, it looks nice, but what about the list which has items longer than one line, I need to put continuing line indented as well - I commented the same on stackoverflow – kokosing Nov 18 '10 at 22:11
  • 1
    Think I got it. See http://stackoverflow.com/questions/4210766/latex-vertical-space-before-and-behind-the-lists for the update. – Hendy Nov 18 '10 at 23:17
  • I don't recommend hand-rolling your own lists. Just use enumitem to make a better itemize. – Will Robertson Nov 19 '10 at 04:04
  • 1
    @Will: absolutely. Not ideal. I just provided the best answer I could given my available knowledge. I was unfamiliar with the enumitem package, but perhaps you could provide an example with that method that also accomplishes the above? – Hendy Nov 19 '10 at 17:12