I'm trying to display the answers to the different Questions in an Exercise in a single line, since answers to questions are often short. Here a workaround was provided but for subQuestions, not Questions. I've naively tried to replace every 'subQuestion' with 'Question' but (not surprisingly) it didn´t work. But in addition, I'd also like to have all the answers in the same line as the number of the exercise: my desired output would be:
1.1 (a) 1st ans. (b) 2nd ans. (c) 3rd ans.
MWE:
\documentclass[]{book}
\usepackage[lastexercise, answerdelayed]{exercise}
\renewcommand{\ExerciseHeader}{\vspace{-0.3cm} \hrule \vspace{0.2cm} \noindent \bfseries \thesection.\arabic{Exercise} }
\renewcommand{\AnswerHeader}{\vspace{-0.4cm} \hrule \vspace{0.1cm} \noindent \bfseries \thesection.\arabic{Exercise} \ }
\renewcommand{\QuestionNB}{(\bfseries \alph{Question})}
\counterwithout{section}{chapter}
\counterwithin*{Exercise}{section}
\begin{document}
\section{First Section}
\begin{Exercise}
Guideline
\Question First question blabla
\Question Second question blabla
\Question Third question blabla
\end{Exercise}
\vspace{3pt} $\vdots$ \vspace{10pt}
\begin{Answer}
\Question 1st ans.
\Question 2nd ans.
\Question 3rd ans.
\end{Answer}
\shipoutAnswer
\end{document}
The output for that is four lines: one for 1.1, another for (a), (b), and (c).
Here is my failed attempt at doing it myself:
\makeatletter
\let \@QuestionHeader@original=\@QuestionHeader
\newcommand{\@QuestionHeader@noItem}{%
\hspace{1cm}%
\begingroup
\@getQuestionInfo
\QuestionHeaderDifficulty
\QuestionNB
\endgroup
\begingroup
\@getQuestionInfo
\QuestionHeaderTitle
\endgroup%
\ignorespaces
}%
\newcommand{\QuestionOnSameLine}{%
\let \@QuestionHeader=\@QuestionHeader@noItem
\subQuestion
}
\newcommand{\QuestionOnNewLine}{%
\let \@QuestionHeader=\@QuestionHeader@original
\Question
}
\makeatother