1

I am trying to make a new environment which creates a hanging indent on the first paragraph only but leaves the other paragraphs indented:

enter image description here

My code for the above image is:

    \begin{hang}
        This should hopefully be a hanging line of text. This should hopefully have a hanging line of text.
    \end{hang}

    {\leftskip  0.4 in
    \rightskip  0.4 in
        This should hopefully not have a hanging line of text. \par
    }

where the hang environment I've defined is

\newenvironment{hang}{ % begin def
        \leftskip   0.4 in
        \rightskip  0.4 in
        \parindent  -0.4 in%
    }{ %end def
        \par%
    }

but I need \parindent -0.4 in to act only on the first paragraph.

Thanks in advance!

1
  • Don't set \leftskip and \rightskip directly in latex unless you know there will never be any kind of latex display environment/list within the scope of the definition. May 10, 2015 at 19:43

1 Answer 1

1

enter image description here

\documentclass{article}

\newenvironment{hang}
{\list{}{%
\parindent1cm
\itemindent-1cm
}\item[]}
{\endlist}
\begin{document}

\begin{hang}
This should hopefully be a hanging line of text.
This should hopefully have a hanging line of text.
This should hopefully be a hanging line of text.
This should hopefully have a hanging line of text.

This should hopefully be a hanging line of text.
This should hopefully have a hanging line of text.
This should hopefully be a hanging line of text.
This should hopefully have a hanging line of text.
\end{hang}

\end{document}
2
  • Inventive! Thank you. How could I extend this to mirror the parindent on the right hand side of the paragraph? May 10, 2015 at 20:20
  • @HarrySmith not so inventive: all latex display environments are made this way, center, quote, verbatim etc are all one item lists. You can bring the right margin in just by setting \rightmargin, latex doesn't by default support changing the right margin of just the first line, if that's what you mean. May 10, 2015 at 20:30

You must log in to answer this question.

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