Consider the following MWE:
\documentclass[12pt]{book}
\usepackage{exsheets}
\SetupExSheets[solution]{print=true}
\begin{document}
\begin{question}
This is a question
\end{question}
\begin{solution}
This is an answer
\end{solution}
\end{document}
I'm trying to beside the solution environment, I have a hint for each question such that those hint printed according to 'chapter number.question number' in the chapter Hints. How it could possible to define such a command or environment? Consider the following MWE:
\documentclass[twoside,a4paper,cleardoublepage=empty,14pt]{book}
\usepackage{environ}
\usepackage{exsheets}
\SetupExSheets[question]{type=exam}
\SetupExSheets{counter-format=ch.qu[1]}
\RenewQuSolPair{question}[headings-format=\large\bfseries,name=Problem]{solution}
\usepackage{environ}
\makeatletter
\NewEnviron{hint}{%
\def@currentlabel{\BODY}\label{hint:\thequestion}%
}
\usepackage{pgffor}
\newcommand\printmyhints{%
\foreach \x in {1,...,\thequestion}{%
\noindent
\thechapter.\x.~\ref{hint:\x}\par
}
}
\makeatother
\begin{document}
\chapter{Analysis of Algorithms}
\begin{question}
Which of the following answers is correct for the given recurrence relation?
\end{question}
\begin{hint}
a hint is here!
\end{hint}
\begin{solution}
this is a solution
\end{solution}
\chapter{answer Sheet}
\printmyhints
\end{document}
The problem of above code is hints must has counter 1.1,1.2 but those get started from chapter 2.