In xsim I would like to combine a question environment with a solution environment. I am getting an error:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! LaTeX error: "xparse/environment-already-defined" ! ! Environment 'solution' already defined! ! ! See the LaTeX3 documentation for further information. ! ! For immediate help type H .
I used to name my environments question/answer, but I'd like to use the name solution instead of answer --- everything else unchanged. Is it possible?
This is what works:
\documentclass{article}
\usepackage{xsim}
\DeclareExerciseType{question}{
exercise-env = question,
solution-env = answer, % would like to rename answer -> solution
exercise-name = Question,
solution-name = Answer,
exercise-template = default,
solution-template = default
}
\xsimsetup{answer/print=true} % would like to rename answer -> solution
\begin{document}
\begin{question}
My Question
\end{question}
\begin{answer}% would like to rename answer -> solution
My Answer
\end{answer}% would like to rename answer -> solution
\end{document}
This is what doesn't work, after renaming answer to solution:
\documentclass{article}
\usepackage{xsim}
\DeclareExerciseType{question}{
exercise-env = question,
solution-env = solution, % IF NAMED 'solution' throws an error!
exercise-name = Question,
solution-name = Answer,
exercise-template = default,
solution-template = default
}
\xsimsetup{solution/print=true}
\begin{document}
\begin{question}
My Question
\end{question}
\begin{solution}
My Answer
\end{solution}
\end{document}
EDIT short answer: solution is a reserved keyword of the xsim package. Can't use it. Thanks egreg.

questionandsolutionenvironments together, as inbegin{question}, etc.andbegin{solution}, etc.. Not about the name of the environment as it gets printed. Sorry about the confusion. My workaround was to use a name other thansolution(my first choice word). Examples of alternativeshint,key,solutionX,mcSolutionandsolutions(with ans). You may want to add this to your answer or if you can hackxsimto allow settingsolution-env=solutionthat would be best. Thanks again. – PatrickT Apr 24 '18 at 09:10solution, but it doesn't work. Why isanswernot good? – egreg Apr 24 '18 at 09:26answerfor an environment that could not easily map to thexsimsyntax. I was basically looking for a synonym toanswerand I thoughtsolutionwas the simplest, but hadn't realize that it's a reserved keyword of thexsimpackage (does the manual mention that?). I'm now usingmc/hintwithxsimand keeping my oldanswerfor my other environment. I have hundreds of questions/answers, so it would be time consuming to rewrite it all to fitxsim. It was basically a stupid question with a simple workaround. Thanks! – PatrickT Apr 24 '18 at 12:51