3

I'm trying to display the solutions to questions in a footnote. So far I have tried two approaches. The easy one is to simply wrap the solution environment in a \footnotetext, which works reasonably well (i still have to find a good footnote command which won't typeset any marks, but that's another story). But i'd rather have a nicer approach, which works using the pre-/post-hooks for the solution environment. Here's a minimal example of what i've tried so far:

\documentclass[paper=a4, BCOR=1cm, DIV=11]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[headings=runin]{exsheets}

\SetupExSheets{
  solution/print=true,
  solution/headings=inline,
  solution/pre-hook=\footnotetext[1]\begingroup,
  solution/post-hook=\endgroup
}
\begin{document}

\begin{question}
  The question
\end{question}

\begin{solution}
  The solution
\end{solution}

\end{document}

This will kind of work, but spits out the following errors:

! Extra }, or forgotten \endgroup.
\scr@saved@footnotetext ...tbox }\color@endgroup }

l.43 \end{solution}

My guess is, i don't have a correct understanding of how the hooks or the begin/endgroup macros work? Does anyone have an elegant solution to this?

Edit:

Clarification of what I'm currently using:

\newcommand{\solutions}[1]{
  \begingroup
  \renewcommand{\thefootnote}{}
  \newcommand{\task}{\item}
  \footnotetext{
    Solutions for Exercise \thequestion:
    \begin{inparaenum}[\itshape a)\upshape]
      #1
    \end{inparaenum}
  }
  \endgroup
}

This uses the question counter to automatically place an appropriate footnote, but I'd rather have an approach with the actual exsheet solution environment.

3

Update: with version 0.18:

Since version 0.18 (2015/02/09) which has been uploaded to CTAN on 2015/02/10 and will be available in TeX Live and MiKTeX in a few days the solution is as follows:

  • Set the heading style for solutions to inline or inline-nr or a equivalent instance.
  • Redefine \exsheetsprintsolution. This macro is used for every solution. It has two mandatory arguments, the first for the heading, the second for the solution body. Its default definition is equivalent to

    \newcommand\exsheetsprintsolution[2]{#1#2}
    
  • In order to get footnotes without numbers I use the bigfoot package and declare a new footnote type and then redefine the corresponding »\thefootnote« to print nothing.

A complete example:

\documentclass[paper=a4, BCOR=1cm, DIV=11]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[headings=runin]{exsheets}[2015/02/09]
\usepackage{bigfoot}

% \DeclareNewFootnote{default} % if `normal' footnotes should be printed first
\DeclareNewFootnote{solution}
\renewcommand\thefootnotesolution{}

\renewcommand\exsheetsprintsolution[2]{\footnotesolution{#1#2}}

\SetupExSheets{
  headings-format   = \bfseries ,% no \normalsize!
  solution/print    = true,
  solution/headings = inline
}
\begin{document}

\begin{question}
  The question
\end{question}
\begin{solution}
  The solution
\end{solution}

\begin{question}
  Another question
\end{question}
\begin{solution}
  Another solution
\end{solution}

\end{document}

Original answer (with version 0.17):

This is a hack because it uses knowledge about usage and definition of an internal command from exsheets (\__exsheets_print_solution:nnnn) which cannot be relied upon. (On my todo list now: provide an interface for tasks like this...)

In order to get footnotes without numbers I use the bigfoot package and declare a new footnote type and then redefine the corresponding »\thefootnote« to print nothing.

\documentclass[paper=a4, BCOR=1cm, DIV=11]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[headings=runin]{exsheets}
\usepackage{bigfoot}

% \DeclareNewFootnote{default} % if `normal' footnotes should be printed first
\DeclareNewFootnote{solution}
\renewcommand\thefootnotesolution{}

\ExplSyntaxOn
\cs_new:Npn \solutionnote #1 \exsheets_h_or_vspace:N
  {
    \footnotesolution{#1}
    \use_none:n
  }
\ExplSyntaxOff

\SetupExSheets{
  headings-format     = \bfseries ,% no \normalsize!
  solution/print      = true,
  solution/headings   = inline,
  solution/pre-hook   = \solutionnote ,
  question/skip-below = -.5\baselineskip % skip back a little
}
\begin{document}

\begin{question}
  The question
\end{question}
\begin{solution}
  The solution
\end{solution}

\begin{question}
  Another question
\end{question}
\begin{solution}
  Another solution
\end{solution}

\end{document}

enter image description here


enter image description here

  • 1
    In the next version there will be a more convenient way to achieve the desired result. I'll update the answer once the new version is available – clemens Feb 8 '15 at 16:36
  • Awesome. This type of display appears to be the norm in some schools for math exercises, since the results are usually something small like x=2 and meant as a control for the pupil. – Richard Feb 8 '15 at 16:49
  • 1
    @Richard in this case you might even want to have a closer look at bigfoot and maybe use \DeclareNewFootnote[para]{solution} – clemens Feb 8 '15 at 16:50
  • 1
    Also inline-nr seems to be a good choice for the solutions IMHO. – clemens Feb 8 '15 at 16:54
  • I updated the answer with the solution for v0.18 – clemens Feb 10 '15 at 11:36

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.