You most likely will succeed when switching to package xsim
, which is the continuation of exsheets
by the same author: https://ctan.org/pkg/xsim . It seems to be the most suited one from https://ctan.org/topic/exam .
Though the documentation is overwhelming, I suggest to go through it front to back, skipping all the details and getting the overall ideas. It's intended to provide exercise-solution pairs (if needed), including tagging. It's also a good idea to download the github code and have a look ad /doc/examples.
A few remarks before I comment the code below:
- if you want to rename "Exercise" into "Question", refer to ch. 6 "New Exercise Types"; you can probably skip many code presented there
- don't be afraid of "Templates", which is just a different way to create your own layout and content; as shown in the manual they use a lot of basic Latex commands
- it provides some looping-commands, which lets you access each exercise-object you created, and extract infromation as neede (see my first example below)
In the code below I rephrased your questions into xsim-speak, where the first one shows some features you may or may not want to use. I end showing an exercise-solution pair from xsim.
The first \gradingtable
statement prints horizontally, while the easier one prints vertically. This is something you may want to modify, i.e. rewrite as an xsim-template to fit your needs.
The final lines show you my so far failing attempts to approach your desired output. Mainly the information in the manual was insufficient to me, the examples did not really cover it and an internet search didn't help much so far. But perhaps some member more experienced in using xsim can help.
So, to me it sounds like xsim does provide all you need to create your result step by step ... only I wasn't used enough to this package ;-)
\documentclass[12pt]{article}
\usepackage{xsim}
\xsimsetup{
solution/print = true
}
\begin{document}
% your examples
\begin{exercise}[ subtitle={About algebra}, % showing some features
points=1,
bonus-points=1,
tags={Algebra}]
This is Question 1. This is tagged against Algebra.
Tag set is: \GetExerciseProperty{tags}
\end{exercise}
%
\begin{exercise}[points=2]%,tags={Equations}]
This is Question 2. This is tagged against Equations.
\end{exercise}
%
\begin{exercise}[points=2, tags={Data}]
This is Question 3. This is tagged against Data.
\end{exercise}
%
\begin{exercise}[points=1, tags={Algebra}]
This is Question 4. This is tagged against Algebra.
\end{exercise}
%
\begin{exercise}[points=2, tags={Algebra}]
This is Question 5. This is tagged against Algebra.
\end{exercise}
%
\begin{exercise}[points=2, tags={Data}]
This is Question 6. This is tagged against Data.
\end{exercise}
% ~~~ an exercise with solution
\begin{exercise}
A first example for an exercise.
\end{exercise}
%
\begin{solution}
A first example for a solution.
\end{solution}
% this is standard (hor)
\gradingtable[template=default*]
% this is simpler (vert)
\gradingtable
> > > >
% here I failed so far
% \begin{tabular}
\ForEachExerciseTag{Data}{\ListExerciseTags{Data}{,}}
%\ListExerciseTags{Data}{&}
% \end{tabular}
> > > >
\end{document}
Result:

P.S.: Here I'll append new insights which may arise e.g. from further comments.
A. Suggestion: read in parallel the pdf-manual and xsim-source code; code to find relevant parts, manual to look up all those xsim-commands. On my system 4 source files can be found in C:..\AppData\Local\Programs\MiKTeX\tex\latex\xsim. Use an Editor like Notepad++, open these 4 and find search terms of you rinterest in all open files (makes it quick and easy). // Make sure not to modify these files (!)
B. \gradingtable: It's defined as a \NewDocumentCommand
in xsim.sty
. This place is only to have a look. To modify see ch. 12 "Grading Tables". It's intended to write your own template and specify it to this command, like \gradingtable[type=myTable]
. How to create and insert your own template myTable
(your desired summary table) consult ch. 13 "Styling the Exercise Templates".
C. Template "mechanics": Referring to Notepad++ or similar search for DeclareExerciseEnvironmentTemplate
. You can find all templates mentioned in the manual in xsim.sty
, xsim.style.layouts.code.tex
and xsim-manual.cls
. Again, it's just to see how all those xsim-commands are or can be applied. Refer to A. above. This should give you ideas, how to design your intended myTable
, see B..
D. xsim as a toolbox: Just like Latex xsim is intended to be a toolbox. I.e. it provides these Exercise- and Solution-objects, with all their internal information. You access their content via xsim-commands ... AND draft your table with this information, as you would do in your example. And it's quite powerful.
E. Varying the examples: It's a good idea to copy and vary examples, found in /doc/examples from github (see above), like changing order of exercise-solution pairs, deleting parts, adding silly text-markers, introducing tags or xsim-commands. This way you get a better idea, how things work, and what requirements are to be met.
\protected@write{\@auxout}{}{...}
\begin{document}
.