[Tex/LaTex] 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 \\
text again

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

random text 
\\ \item text

is causing the error but not

random text

\item text

random text\begin{itemize}
\item text

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.

Best Answer

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: