I'm writing a book which includes exercises spreaded through its chapters. To typeset the exercises I'm using the exsheets package. I want to make an appendix with all the solutions listed per chapter (and I've been aware this wasn't possible, according to Exsheets: how do I print the 'solutions' on the same line?).

I've seen that the newest version of exsheets has a chapter-hook option that, according to the manual (found at http://ctan.mirrors.hoobly.com/macros/latex/contrib/exsheets/exsheets_en.pdf.):

[chapter-hook = {code}] Adds "code" to the list of solutions every time solutions from a new chapter are printed (before the solutions of the corresponding chapter are printed).

The problem is that it's the only mention of chapter-hook the author makes, with no particular examples, so I don't even know where to put the option.

I've tried with the following:

\chapter{Grouped Exercises I}
    Integrate $\int \cos{x}\ \mathrm{d}x$
    $\sin{x} + C$
% ...
% more code here
% ...
\chapter{Solutions to exercises}

but when compiling with pdfLaTeX, it throws the error:

! LaTeX error: "kernel/key-choice-unknown"
! Key 'exsheets/exsheets_print_solutions/chapter-hook' accepts only a fixed
! set of choices.
! See the LaTeX3 documentation for further information.
! For immediate help type H <return>.

l.6 \printsolutions[all,chapter-hook={Chapter}]

What to do? How's the correct way of using chapter-hook option under these circumstances?

Thanks in advance!

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jun 1 '14 at 8:33
  • There is no exercise environment in exsheets, as far as I know and understood the manual, it should rather read \begin{question}...\end{question}. Furthermore you do not use any mathematical mode for your math question – user31729 Jun 1 '14 at 9:02
  • exsheets uses LaTeX3 syntax, I am not familiar with that, but looking into the code and using the error message, there is possibly a bug, where chapter-hook is treated as a choice-key whereas it is intended to be a command-key. – user31729 Jun 1 '14 at 9:04
  • @cgnieder: Perhaps you can provide some help? – user31729 Jun 1 '14 at 9:17
  • I updated the linked question with an example for section-hook @ChristianHupfer users only get notified in comments if they already have commented on a question/answer. It's easier to ping me in chat. – cgnieder Jun 1 '14 at 10:39

Are you using TeX Live? The new options were introduced in version 0.13 (2014/05/11) which is not part of TL2013 (it was published after the freeze I believe). You either have to update exsheets manually or wait for TL2014 (or use the pretest version).

Either way: below is an example how the option could be used.

enter image description here

  counter-within = chapter



\chapter{Some Chapter}\label{ch:foo}
\section{Grouped Exercises I}
  Integrate $\int \cos x \diff{x}$.
    $\sin x + C$

\chapter{Some Other Chapter}\label{ch:bar}
\section{Grouped Exercises II}
  Integrate $\int \sin x \diff{x}$.
    $-\cos x + C$

  chapter-hook =
    \section*{Exercises from chapter~\GetQuestionProperty{chapter-number}{\CurrentQuestionID}}

\chapter{Solutions to exercises}

| improve this answer | |
  • No, I'm using MiKTeX 2.9, and I've just installed the package lately. What's the procedure for installing a package manually? – logo_writer Jun 1 '14 at 18:07
  • Oh, I've just checked the version of exsheets I have installed and it's 0.12. – logo_writer Jun 1 '14 at 18:14
  • @logo_writer I believe MiKTeX has something like a package manager. There is a question about this somewhere on the page. It should be easy to find. – cgnieder Jun 1 '14 at 18:14
  • @logo_writer so does my answer answer your question or not? – cgnieder Jun 1 '14 at 19:35
  • Did you manage to update? – cgnieder Jun 1 '14 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.