3

What's the easiest way to have a line not indented and with a break before and after?

Example:

Following the list of ingredients:

  • carrots
  • ...

The Latex-Code would be:

Following the list of ingredients:

\begin{enumerate}
    \item carrots
    \item ...
\end{enumerate}

By default the line would be indented and without preceeding line break.

Any suggestions for a short-macro to have single lines?

I sometimes use

\ \\ Following the list of ingredients:
5
  • Not sure I understand exactly what you want. Oct 2, 2011 at 20:18
  • The line "Following.." is being indented as a usual paragraph's first line. I don't want this line to be indentes as it is only a single line introducing the following list.
    – Sebastian
    Oct 2, 2011 at 20:36
  • Does \noindent before Following... solve your issue? Oct 2, 2011 at 20:40
  • @PeterGrill: Yes, but it doesn't cause a line break before and after Following. So far I used \ \\ Following but don't know if this is a nice way/solution.
    – Sebastian
    Oct 2, 2011 at 20:42
  • Ok, not that it is clearer, I have updated my solution. Oct 2, 2011 at 21:21

3 Answers 3

3

Update Based on comments

I'd suggest using \bigskip, \medskip or \smallskip along with \noindent. This will allow you to control the amount of spacing you want. Since you were looking for a \shortmacro I have added that as well. Using a macro is a good ideas as that help to ensure that your spacing in these kinds of situations is consistent, and allows you to adjust all the sapcing in one spot.

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}
\newcommand{\shortmacro}{\bigskip\noindent}%
\begin{document}
\lipsum[1]
%
\shortmacro Following the list of ingredients:
%
\begin{itemize}[align=left]
    \item carrots
    \item ...
\end{itemize}
\end{document}

enter image description here

The \lipsum package as added just to include some dummy text so that we could see the spacing.

3
  • I don't want to change the space between the items.
    – Sebastian
    Oct 2, 2011 at 20:38
  • Solution has been totally re-written. Let me know if that solves your problem. Oct 2, 2011 at 22:46
  • Thanks for the re-written solution! Solves my problem largely. I just wonder how to get a spacing of the height of a text line.
    – Sebastian
    Oct 3, 2011 at 11:29
3

If you're referring to the line Following the list of ingredients: that you want to have

  • no indent; and
  • a break before

you can do the following:

  • Prefix the line with \noindent. This avoids the paragraph indent \parindent for that specific paragraph.
  • Add a blank line before the sentence so TeX will see it as a new paragraph. This inserts a vertical skip between the two paragraphs of size \parskip. Depending on your document class, this may be virtually unnoticeable. You can modify this value using \setlength{\parskip}{<len> where <len> is any recognized length unit.

The (very small) parskip package actually provides all of these requirements. Or, if you're interested, view the package parskip.sty file.

2

I suspect your problem is that you don't want a paragraph break between your text and list. TeX treats a blank line as a 'new paragraph' mark. So try

Following the list of ingredients:
\begin{enumerate}
    \item carrots
    \item ...
\end{enumerate}

or 'comment out' the extra line

Following the list of ingredients:
%
\begin{enumerate}
    \item carrots
    \item ...
\end{enumerate}

as TeX will then treat it as 'not there'.

3
  • Then the line "Following ..." is still being indented as it is handled like a new paragraph's first line.
    – Sebastian
    Oct 2, 2011 at 20:37
  • @Sebastian If it starts a paragraph, and the rest of the document uses an indent for paragraph first lines, then traditionally it should still be indented. As Peter has said, you can use \noindent to prevent this, but do consider your overall document design.
    – Joseph Wright
    Oct 2, 2011 at 20:41
  • Well, I think a line with only a few words which is indented and stands before a list looks odd.. But for a long text it's right and nice to have the first line of a paragraph indented and without line breaks.
    – Sebastian
    Oct 2, 2011 at 20:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .