How to do a conditional line break

I want to know how to do a conditional line break. Whenever the error message "There is no line to end here" comes, I want to disable the line break, otherwise to enable it, with a \\ command or \newline command.

As suggested, I am now explaining below my problem, with a minimal sample tex file.

I am using two macros that allow me to "eat" a question or an answer, while allowing me to keep both of them together in the source. When I conduct an exam, I eat the answers and give only the questions, for example.

This example results in the following error message:

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


The reason is that I have the \\ [1ex] command at the beginning of the macro, \ans.

If I remove the \\ [1ex] command from the macro \ans, the error goes away. Unfortunately, however, the answer does not begin on a new line for the first question.

I would also like to disable the \\ [1ex] command when it is not required. For example, the behaviour is the same in the second question, whether or not this command is present. In fact, in some situations, this command could create unnecessary additional space.

\documentclass[12pt,a4paper]{article}
\newcommand{\quest}[1]{#1}
\begin{document}
%\eatquest
%\eatans
\begin{enumerate}
\item
\quest{What is the effect of bad zeros?  How can it be overcome?
}
\ans{
This results in poor performance of the system.  The bad zeros
cannot be changed by feedback.  The only way to change them is to
redesign the system (not controller) itself.
}
\item
\quest{This question is on 2-DOF pole placement controller
\begin{enumerate}
\item In the class, a method was proposed to handle unstable 2-DOF
controllers.  This method also has unstable pole-zero cancellation.
\end{enumerate}
}
\ans{A short answer is given now:
\begin{enumerate}
\item The pole and zero come for the same, identical'', source.  In
fact, one can even say that this is NOT a case of pole-zero
cancellation.
\end{enumerate}
}
\end{enumerate}
\end{document}

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 24 '14 at 6:00
• By "line break" you mean \\, right? This command should be used very rarely, basically only in tabular-like environment and in multi-line displayed equations. New paragraph is started by an empty line in the code. – yo' Apr 24 '14 at 6:06
• Use \par\addvspace{1ex} instead of \\[1ex] – egreg Apr 24 '14 at 7:33
• Outside of tabular, try to avoid ever using \\ . – David Carlisle Apr 24 '14 at 8:40

Use \par\addvspace{1ex} instead of \\[1ex]

\documentclass[12pt,a4paper]{article}
\newcommand{\quest}[1]{#1}
\begin{document}
%\eatquest
%\eatans
\begin{enumerate}
\item
\quest{What is the effect of bad zeros?  How can it be overcome?
}
\ans{
This results in poor performance of the system.  The bad zeros
cannot be changed by feedback.  The only way to change them is to
redesign the system (not controller) itself.
}
\item
\quest{This question is on 2-DOF pole placement controller
\begin{enumerate}
\item In the class, a method was proposed to handle unstable 2-DOF
controllers.  This method also has unstable pole-zero cancellation.
\item The pole and zero come for the same, identical'', source.  In