[Tex/LaTex] There’s no line here to end

environmentserrors

I'd just defined a command, as below:

\newcommand{\Question}[1]{\textbf{?: #1}\\[5pt]}

Here is the snippet, in that I want to use an itemzie environment:

\documentclass[letter, 11pt]{article}

\newcommand{\Question}[1]{\textbf{?: #1}\\[5pt]}

\begin{document}

\section*{Question \#2}
\Question{Here is the question
\begin{itemize}
    \item[2.1] first part
    \item[2.2] second part
\end{itemize}
}

\end{document}

The compilation raises an error, as:

There's no line here to end.

So, as I add a character just at the end of the itemize environment, the error will be disappeared:

\Question{Here is the question
\begin{itemize}
    \item[2.1] first part
    \item[2.2] second part
\end{itemize}
.
}

Seemingly, the definition of Question command should be changed, but I don't know how I should do that.

Best Answer

The whole construct would certainly be better as an environment. \textbf does not allow blank lines (which relates to an earlier version of the question) and use of \\ is almost never wanted outside tables. here if #1 does not end mid-paragraph then you will get an error from \\ saying that there is no line to end, you should use \par\vspace{5pt} or better use a display environment based on list so that space from adjacent displays is better handled.

But a simple redefinition would be

\newcommand{\Question}[1]{{\bfseries?: #1\par\vspace{5pt}}}