I want to write a book with exercises, solutions to exercises and some hints to those exercises.
I need help with understanding how to work with a new declared property (hint, in this case). I am aware of the example in the repository, but still I got lost with the various commands in the manual.
How do I print the "body" of the hint I just created? That is, I want to print the following:
MWE:
% !TEX TS-program = xelatex
\documentclass{book}
\usepackage{xsim}
%\xsimsetup{solution/print = false,} % false is the default value, not really needed
\xsimsetup{
exercise/name={Question},
exercises/name={Questions},
solution/name={Solution},
exercise/within = chapter,
exercise/template=myTemplate,
solution/template =myTemplate ,
}
\DeclareExerciseProperty{hint}
\newcommand\hint[1]{\SetExerciseProperty{hint}{#1}} %based on the code in the repo
\DeclareExerciseEnvironmentTemplate{myTemplate}
{%
{\normalfont\bfseries\GetExerciseName~\GetExerciseProperty{counter}~\GetExercisePropertyT{subtitle}{{(\PropertyValue)}}\newline}
}
{%
}
\begin{document}
\chapter{Euclidean Geometry}
\section{Weekly Assignment}
Questions for this week:
\begin{exercise}[subtitle={Proof of the Pythagorean Theorem}]
Prove Pythagoras' theorem.
\hint{The sum of the angles in a triangle is equal to 180 degrees.}
\end{exercise}
\begin{solution}
The theorem can be proved algebraically\ldots
\end{solution}
\section*{Hints}
The body of hint number 〈command for the counter of the hint〉is:
〈command for the body of the hint〉
%% what are the commands?
\printsolutions[headings=true]
\end{document}
I tried to insert after \section*{Hints}
the following:
\GetExercisePropertyT{hint}{value if true}{value if false}
But it doesn't print anything. After all, this command appears in the manual under "Commands for Usage in Template Definitions", yet in the example I linked to, this command appears not inside a template definition.
Moreover, the only thing related to the hint in the auto-generated xsim
file is
\XSIM{hint}{exercise-1=={The sum of the angles in a triangle is equal to 180 degrees.}}
So I am confused here.