0

I have a full document with about 200 questions, set up using the enumerate package.

\begin{enumerate}[Q1.]
% Q1 - Q5
\item
    XXXXXXXXX
\item
    XXXXXXXXX XXXXXXXXX
\item
    XXXXXXXXXXXXXXXXXX
\item
    XXXXXXXXXXXXXXXXXXXXXXXXXXX
\item
    XXXX

% Q6 - Q10
\item
\item
\item
\item
\item

...
...
...
% Q100 - Q105
\end{enumerate}

I am looking at changing it to a question-solution type document. At the moment, I am thinking using the xsim package, or exam package. But I am not sure whether there is a more efficient way to do it.

Some struggles/difficulties:

1 - using any synatex, it's not going to be easy for me to change all the item into

\begin{exercise}
    QQQQQQQQQQQQQQ
\end{exercise}
\begin{solution}
    AAAAAAAAAAAAAAAAA
\end{solution}

Basically, I will have to add at least 4 lines for each question... I hope to avoid that. So I only need to do something like

\item 
    \begin{solution}
    AAAAAAAAAAAAAAAAA
    \end{solution}


\item 
    \begin{solution}
    AAAAA
    \end{solution}  

2 - Ultimately, I want to be able to print only quesitons (no gaps for answers or space), or all questions with all solutions. There is no need for anything more than that...

Something similar to this post here, even simpler that there is no need to stack anything, just a solution environment under the question item, either to show/hide.

Any suggestions for most efficient way to do so?

Thanks.

CasperYC
  • 683
  • 1
    You code fragments can't be tested as is. Please provide a minimal but complete example showing the problem. BTW, you don't need to use the comment package. A simple \if \else \fi structure can handle it. See \newif. – John Kormylo Dec 26 '19 at 16:03

1 Answers1

0

Currently, I am doing something over-complicated using comment and tcolorbox like this:

% adding answers

\usepackage{comment}
\usepackage{tcolorbox}
%\includecomment{sol}
\excludecomment{sol}

\newcommand{\solution}[1]{}
\begin{sol}
\renewcommand{\solution}[1]{
    \begin{tcolorbox}
    {Solution: \quad} #1
    \end{tcolorbox}
}
\end{sol}


% Q1 - Q5
\item
    XXXXXXXXX
\solution{
    XXXXXXXX
}


\item BBBBBBBBBB
\solution{
    XXXXXXXX
}

\item CCCCCCCCCCC
\solution{
    XXXXXXXX
}
\item

\item

To show/hide, I use \excludecomment{sol} and \includecomment{sol}.

CasperYC
  • 683