# Exsheets print subsection counter?

When defining a counter format in exsheets I can use ch for chapter, se for section orqu for question. But how can I reference to the subsection counter?

I can do:

\SetupExSheets{counter-within={subsection},counter-format=se.qu}


but I want something like

\SetupExSheets{counter-within={subsection},counter-format=se.sub.qu}


where sub referes to the subsection counter.

• It would be super awesome to help, but I don't know exsheets... and with the code snippet, I can't really get anything up-and-running to test it out. Would you be able to supply a minimal example? – Werner Mar 20 '16 at 6:04
• did you try counter-format=subsection.qu – touhami Mar 20 '16 at 6:05
• or my be counter-format={subsection}.qu? – touhami Mar 20 '16 at 6:08
• @touhami: Doesn't work, it just enters the word "subsection". – student Mar 20 '16 at 7:41
• @student sorry it took me so long: I just sent the update to CTAN. The new version should be available in TL and MiKTeX in a few days – cgnieder Aug 14 '16 at 9:25

This question led me to some long overdue changes in exsheets. The new version v0.21c (not yet on CTAN but available here for the impatient) gives you three possibilities (including the one proposed by @touhami):

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{exsheets}[2016/03/21]
\SetupExSheets{
counter-within = subsection ,
counter-format = \thesubsection.qu
}

% or:
% \renewcommand*\thequestion{\thesubsection.\arabic{question}}
% \SetupExSheets{
%   counter-within = subsection ,
%   counter-format = \thequestion
% }

% or:
% \SetupExSheets{
%   counter-within = subsection ,
%   counter-format = se.sbs.qu
% }

\begin{document}

\section{First}
\subsection{bla}
\begin{question}
Yes?
\end{question}
\begin{solution}
No!
\end{solution}

\subsection{bla}
\begin{question}
Yes?
\end{question}
\begin{solution}
No!
\end{solution}

\begin{question}
Yes?
\end{question}
\begin{solution}
No!
\end{solution}

\section{Last}
\subsection{bla}
\begin{question}
Yes?
\end{question}
\begin{solution}
No!
\end{solution}

\section{Solutions}
\printsolutions

\end{document}


Here is a solution. with

\SetupExSheets{counter-within={subsection},counter-format=\thesubsection.qu}


\documentclass{article}
\usepackage{exsheets}
\SetupExSheets{counter-within={subsection},counter-format=\thesubsection.qu}
\begin{document}
\section{First}
\subsection{bla}
\begin{question}
Yes?
\end{question}
\subsection{bla}
\begin{question}
Yes?
\end{question}
\begin{question}
Yes?
\end{question}
\section{Last}
\subsection{bla}
\begin{question}
Yes?
\end{question}
\end{document}

• Thanks, but that doesn't work if you print the solutions in another section. Then the numbers of solutions and questions doesn't match anymore. – student Mar 20 '16 at 8:12
• @student I will see. – touhami Mar 20 '16 at 8:22