# Insert a linebreak only if there was none before

I am looking for a way to tell TeX:

Please break that line if and only if you are not on new line already.

I need this for a new environment which should always start in a new line. But I don't (how could I?) know, whether the author has typed a linebreak in front of that manually. I tried \linebreak, \\, and \newline, all of them caused the

LaTeX Error: There's no line here to end.

error, which I expected to show up, when trying

\newenvironment{mynewenvironment}{\\ \emph{Header:} }{}
[...]
random text \\
\begin{mynewenvironment}
text again
\end{mynewenvironment}


One can observe the same behavior with predefined environments, for instance

random text
\begin{itemize}
\\ \item text
\end{itemize}


is causing the error but not

random text

\begin{itemize}
\item text
\end{itemize}

random text\begin{itemize}
\item text
\end{itemize}


Both are doing exactly how I want my environment to react, therefore I expect my problem to be solvable fairly easy, but I don't know how.

-
Welcome to TeX.SE! There should be no reason to use a manual line break at all. Maybe if you put \par or an empty line there? –  tohecz Mar 4 '13 at 17:03

You should almost never use \\ in a document other than ending tabular rows. Just use \par with an appropriate setting of \parskip and \parindent. Or for more general display environments copy the definition of the latex environments such as center or quote which are all defined in terms of list or trivlist which enables them to detect whether the following text needs to start a new paragraph or not. quote for example is simply defined as:
\newenvironment{quote}

Thank you very much! \par does the trick I was looking for, and with the hints from the quote environment I am very happy now =) –  Dominikus K. Mar 4 '13 at 17:17