# Within a single paragraph, hang a wrapped line, but do not hang new lines

I'm writing a list, and would like the line hanging to work like this

I do not want to use separate paragraphs for each item in the list, and I do not want to use the list environments; I will be using the entire text of the list as an input argument to a new command that I hope will, in addition to placing the list where I want it, be able to make it hang properly--so the kind of list that I want would look something like this (I'm using the minipage environment here so that the lines will break just as in the image):

\documentclass{article}
\usepackage{units}
\begin{document}

\begin{minipage}{4.5cm}
\setlength{\parindent}{0cm}
\nicefrac{1}{2} lb.\ (about 1\nicefrac{1}{2} cups) thinly sliced yellow onions\\
2 (about 1 cup) sliced green bell peppers\\
2 to 3 Tb olive oil, if necessary\\
2 cloves mashed garlic\\
Salt and pepper to taste
\end{minipage}

\end{document}


But, of course, that produces output that looks like this:

I understand that \hangindent will do the trick for paragraphs, but I do not want to use separate paragraphs for each item (and even if I did, \hangindent is local, so it'd have to go at the beginning of each item--also no good). When I try this anyway, hoping that it'll somehow know what I want (works surprisingly often with many other things LaTeX . . .), I get that this:

\documentclass{article}
\usepackage{units}
\begin{document}

\begin{minipage}{4.5cm}
\setlength{\parindent}{0cm}
\hangindent=1em
\nicefrac{1}{2} lb.\ (about 1\nicefrac{1}{2} cups) thinly sliced yellow onions\\
2 (about 1 cup) sliced green bell peppers\\
2 to 3 Tb olive oil, if necessary\\
2 cloves mashed garlic\\
Salt and pepper to taste
\end{minipage}

\end{document}


produces this:

So no real surprise, but that means I'm officially out of ideas. Does someone know whether it's possible to, within a single paragraph, hang a wrapped line, but not hang new lines?

-
What you're describing looks like the way stanzas of poetry are set. Is there perhaps a verse environment that might work for you? – user16032 Jun 27 '12 at 17:20

It makes no sense to me not to use paragraphs:

\documentclass{article}
\usepackage{units}
\begin{document}

\begin{minipage}{4.5cm}
\everypar{\setlength\hangindent{1em}}
\nicefrac{1}{2} lb.\ (about 1\nicefrac{1}{2} cups) thinly sliced yellow onions

2 (about 1 cup) sliced green bell peppers
2 to 3 Tb olive oil, if necessary

2 cloves mashed garlic

Salt and pepper to taste
\end{minipage}

\end{document}

-
Thank you for your answer; this does work in the small example I gave, but as I'll eventually be using the entire text of the list as an input argument to a command, I don't want to break it up into paragraphs. – Erin Kiley Jun 27 '12 at 7:53

Since using \hangindent is the obvious solution it is probably also the best one. Nonetheless, if you want your text to look as though it is a single paragraph, you always have the option of messing with the syntax:

\documentclass{article}
\begin{document}
\newenvironment{hanginglines}[1][1em]
{%
\renewcommand\\{\par\hangindent#1}%
\parindent0pt %
\hangindent#1 %
}
{\par}

\begin{hanginglines}
This is a very long line that I hope will wrap many times.  This is a very long line that I hope will wrap many times.
\\
This is a very long line that I hope will wrap many times.  This is a very long line that I hope will wrap many times.
\\
This is a very long line that I hope will wrap many times.  This is a very long line that I hope will wrap many times.
\end{hanginglines}
\end{document}

-
This could also have worked well for me. Thank you for the suggestion! – Erin Kiley Jun 27 '12 at 19:16

This is an addendum to Herbert's answer, which shows, how to re-use the text as an argument to a command, what @user16001 is looking for:

\documentclass{article}
\usepackage{units}
\newenvironment{hangingpars}[1][1.2em]{%
\parindent=0pt
\everypar{\hangafter=1\hangindent=#1}}{\par}

\begin{document}
\newcommand{\SavedStuff}{
\begin{hangingpars}[1em]
\nicefrac{1}{2}\,lb.\ (about 1\nicefrac{1}{2} cups) thinly sliced yellow
onions

2 (about 1 cup) green bell peppers

2 to 3 Tb olive oil, if necessary

2 cloves mashed garlic

Salt an pepper to taste
\end{hangingpars}
}

\SavedStuff\bigskip

\noindent\begin{minipage}{4.5cm}
\SavedStuff
\end{minipage}

\end{document}

-
Thank you for your answer; indeed, something like this will work if I can't find a simpler solution, as I'd hoped to do. – Erin Kiley Jun 27 '12 at 17:58

Thanks for the many answers I got here. The one I ended up using followed the suggestion of @LauraS to use the verse environment, which lent itself very well to what I was trying to do. I ended up using this file:

\documentclass{article}
\usepackage{units}

\newcommand\step[2]{
\centerline{\rule{0.45\linewidth}{0.1pt}}
\vskip0.3em
\begin{minipage}[t]{0.55\linewidth}
\begin{verse}
\hangindent=1em
{\textbf{#1}}
\end{verse}
\end{minipage}
\hskip1em
\begin{minipage}[t]{0.55\linewidth}
#2
\end{minipage}
}

\begin{document}

\step{\nicefrac{1}{2} lb.\ (about 1\nicefrac{1}{2} cups) thinly sliced yellow onions\\
2 (about 1 cup) sliced green bell peppers\\
2 to 3 Tb olive oil, if necessary\\
2 cloves mashed garlic\\
Salt and pepper to taste
}{
In the same skillet, cook the onions and peppers slowly in olive oil for about 10 minutes, or until tender but not browned. Stir in the garlic and season to taste.
}

\end{document}


to produce this result:

which is just what I had in mind: a command where I could enter a minimally-formatted list and have it not only placed where I wanted it, but also have the lines hang properly.

Thank you again to all!

-