Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

No empty line before an item list

109 views
Skip to first unread message

Cecil Westerhof

unread,
Oct 4, 2022, 6:28:08 AM10/4/22
to
In a LaTex document I defined:
\newenvironment{myitemize} {
\begin{itemize}
\setlength{\itemsep}{0pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
} {\end{itemize}}

In my document part I have something like:
To do this you need:
\begin{myitemize}
\item A plan
\item Steps to implement the plan
\item The will to take the steps
\end{myitemize}

But I then get an empty line between
To do this you need:
and:
A plan

How can I remove this empty line?

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Peter Flynn

unread,
Oct 4, 2022, 7:46:58 AM10/4/22
to
On 04/10/2022 11:25, Cecil Westerhof wrote:
> In a LaTex document I defined:
> \newenvironment{myitemize} {
> \begin{itemize}
> \setlength{\itemsep}{0pt}
> \setlength{\parskip}{0pt}
> \setlength{\parsep}{0pt}
> } {\end{itemize}}
>
> In my document part I have something like:
> To do this you need:
> \begin{myitemize}
> \item A plan
> \item Steps to implement the plan
> \item The will to take the steps
> \end{myitemize}
>
> But I then get an empty line between
> To do this you need:
> and:
> A plan
>
> How can I remove this empty line?

Use the enumitem package (it handles itemized as well as enumerated
lists), and say

\begin{itemize}[nosep]
...
\end{itemize}

Peter

Cecil Westerhof

unread,
Oct 4, 2022, 11:44:08 AM10/4/22
to
That works. It also removes the empty line after, but that I can
easily restore with:
\vspace{\baselineskip}

Peter Flynn

unread,
Oct 5, 2022, 6:33:58 AM10/5/22
to
On 04/10/2022 16:20, Cecil Westerhof wrote:
[snip enumitem]
> That works. It also removes the empty line after, but that I can
> easily restore with:
> \vspace{\baselineskip}

That's an interesting use case: your short lists always come at the end
of a paragraph, so you need no space above but normal space below?

This sounds like a good idea for a [noaftersep] option :-)

Peter

Cecil Westerhof

unread,
Oct 5, 2022, 7:44:14 AM10/5/22
to
Peter Flynn <pe...@silmaril.ie> writes:

> On 04/10/2022 16:20, Cecil Westerhof wrote:
> [snip enumitem]
>> That works. It also removes the empty line after, but that I can
>> easily restore with:
>> \vspace{\baselineskip}
>
> That's an interesting use case: your short lists always come at the end
> of a paragraph, so you need no space above but normal space below?

Well I am not sure always, I just started with using LaTeX. But at the
moment I use them for something like:
The things you learn are:
- First
- Second
- …

And I do not want:
The things you learn are:

- First
- Second
- …


> This sounds like a good idea for a [noaftersep] option :-)

I look into it.
No sleep for the wicked. ;-P
(In the secular meaning, not the biblical.)

Peter Flynn

unread,
Oct 5, 2022, 9:30:13 AM10/5/22
to
On 05/10/2022 12:23, Cecil Westerhof wrote:
[...]
> Well I am not sure always, I just started with using LaTeX. But at the
> moment I use them for something like:
> The things you learn are:
> - First
> - Second
> - …
>
> And I do not want:
> The things you learn are:
>
> - First
> - Second
> - …

That's a very common requirement. But if a compact list occurs WITHIN a
paragraph (as your example), then if the text of the same paragraph
continues after the list, there should be no spacing after the list, eg

>> But at the moment I use them for something like this:
>> the things you learn are:
>> - First
>> - Second
>> - Third
>> provided you paid attention in class.

However, if it comes at the END of a paragraph, anything following it
must by definition be a new paragraph, so you may want to decide if
there should be space or not, depending on your rules for indentation
and your normal inter-paragraph space.

Peter

Axel Berger

unread,
Oct 5, 2022, 5:04:41 PM10/5/22
to
Peter Flynn wrote:
> > The things you learn are:
> > - First
>
> That's a very common requirement.

I use paralist so I'm not sure whether the following is transferable. In
my personal addons package, that is always loaded for anything, I have:

\newcommand\parafterlist{\@noparlisttrue}
\newcommand\noparafterlist{\@noparlistfalse}

The shortcut for a list in my editor yields e.g.

\begin{compactitem}

% \parafterlist % nur mit Skip
\end{compactitem}

If the use case occurs, and I agree it's common, I just uncomment the
penultimate line. It only works with skip, not with indented paragraphs.
\noparafterlist is in there for completeness' sake, I never ever used or
needed it.


--
/¯\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
\ / HTML | Roald-Amundsen-Straße 2a Fax: +49/ 221/ 7771 8069
 X in | D-50829 Köln-Ossendorf http://berger-odenthal.de
/ \ Mail | -- No unannounced, large, binary attachments, please! --
0 new messages