Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same content for exercise and solution #33

Closed
joneppie opened this issue Jun 3, 2018 · 2 comments
Closed

Same content for exercise and solution #33

joneppie opened this issue Jun 3, 2018 · 2 comments
Assignees
Labels
suggestion suggestions and feature requests

Comments

@joneppie
Copy link
Contributor

joneppie commented Jun 3, 2018

I am looking for a solution to use the content of an exercise directly in the solution. With the multiplechoice example from the package Task, the following should be possible:

\begin{mcExercise}
    \begin{multiplechoice}
        \choice First choice
        \choice Second choice
        \choice[\correct] Third choice
    \end{multiplechoice}
\end{mcExercise}

instead of:

\begin{exercise}
    \begin{multiplechoice}
        \choice First choice
        \choice Second choice
        \choice[\correct] Third choice
    \end{multiplechoice}
\end{exercise}
\begin{solution}
    \begin{multiplechoice}
        \choice First choice
        \choice Second choice
        \choice[\correct] Third choice
    \end{multiplechoice}
\end{solution}
@cgnieder cgnieder self-assigned this Jun 9, 2018
@cgnieder cgnieder added the suggestion suggestions and feature requests label Jun 9, 2018
@cgnieder
Copy link
Owner

cgnieder commented Jun 9, 2018

This seems like a good idea. I will try to come up with a solution. This shouldn't be too complicated I hope! :)

cgnieder added a commit that referenced this issue Feb 19, 2020
@cgnieder
Copy link
Owner

I added a property solution to exercises:

\documentclass{article}
\usepackage{xsim}
\xsimsetup{print-solutions/headings=false}

\begin{document}

\begin{exercise}[solution]
  1: exercise
\end{exercise}
\begin{exercise}
  2: exercise
\end{exercise}
\begin{solution}
  2: solution
\end{solution}

\printsolutions

\end{document}

image


This will be part of the next release to CTAN and will need some testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion suggestions and feature requests
Projects
None yet
Development

No branches or pull requests

2 participants