1

I want to have a section at the end of each chapter with the solutions of only odd-numbered questions.

  • It seems to me the O.P. raised a quite sensible question. – Bernard Dec 13 '15 at 14:49
  • Done. I had missed that answer... – Leonardo Castro Feb 10 '16 at 5:15
2

If you want \printsolution[section] to only print the solutions of odd numbered questions you can add

\usepackage{exsheets}[2016/01/26]% make sure you have v0.21 available

\ExplSyntaxOn
\cs_set_protected:Npn \__exsheets_print_solutions_section:nnn #1#2#3
  {
    \exsheets_print_solutions_if:nnn
      {
        \int_if_odd_p:n  { \l_exsheets_counter_qu_int } &&
        \int_compare_p:n { \l__exsheets_counter_sec_int = #3 }
      }
      {#1}
      {#2}
  }
\ExplSyntaxOff

to you document. Since this redefines an internal function this is not entirely safe, though.

\documentclass[twocolumn]{article}
\usepackage{exsheets}[2016/01/26]

\ExplSyntaxOn
\cs_set_protected:Npn \__exsheets_print_solutions_section:nnn #1#2#3
  {
    \exsheets_print_solutions_if:nnn
      {
        \int_if_odd_p:n  { \l_exsheets_counter_qu_int } &&
        \int_compare_p:n { \l__exsheets_counter_sec_int = #3 }
      }
      {#1}
      {#2}
  }
\ExplSyntaxOff

\begin{document}

\section{One}
\subsection{Exercises}
\begin{question}
  qu one
\end{question}
\begin{solution}
  sol one
\end{solution}

\begin{question}
  qu two
\end{question}
\begin{solution}
  sol two
\end{solution}

\begin{question}
  qu three
\end{question}
\begin{solution}
  sol three
\end{solution}

\begin{question}
  qu four
\end{question}
\begin{solution}
  sol four
\end{solution}

\begin{question}
  qu five
\end{question}
\begin{solution}
  sol five
\end{solution}

\subsection{Solutions}
\printsolutions[section]

\newpage

\section{Two}
\subsection{Exercises}
\begin{question}
  qu one
\end{question}
\begin{solution}
  sol one
\end{solution}

\begin{question}
  qu two
\end{question}
\begin{solution}
  sol two
\end{solution}

\begin{question}
  qu three
\end{question}
\begin{solution}
  sol three
\end{solution}

\begin{question}
  qu four
\end{question}
\begin{solution}
  sol four
\end{solution}

\begin{question}
  qu five
\end{question}
\begin{solution}
  sol five
\end{solution}

\subsection{Solutions}
\printsolutions[section]

\end{document}

enter image description here

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.