I found this code in datatool group by?


ClassID; Schueler_Name; Schueler_Vorname; Subject
5a; Stiner; Markus; Big Band
3c; Meier; Stefan; Latein
5b; Muggli; Elena; Instrument
3b; Strang; Flurin; Band
3b; Nomer; Ulrike; Big Band

\usepackage{datatool, etoolbox}



% Taken from https://tex.stackexchange.com/q/108712/5764
  {}% do nothing, already in list
  {% add to list
    {\let\uniqueclass\Class}% first element of list
    {% append to list

  \subsection*{Klasse #1}
    \textbf{Name} & \textbf{Vorname} \\ \hline
      {\class=ClassID, \fn=Schueler_Vorname, \ln=Schueler_Name}
         \eappto\nextrow{\ln \noexpand& \fn \noexpand\\}% Collect rows
      \nextrow % Print table rows
    \hline \hline



I'm now struggling to create a "dynamic command" for this.

What I want would be a command like this:

        Groupheader & Groupheader2...
            \propone & \proptwo

so I could ultimately also use it for item lists like so:

            \item \propone, \proptwo

where databasename is the name of the database I define earlier and keyname is the key to group by.

I'm pretty new to all that macro stuff, I don't even get the static code from above a 100% so I'm struggling creating my own macro for this. Haven't found any solutions, though it seems it would be something needed quite often, no?

  • Command names can't include digits, so \prop1 is actually \prop followed by 1. Try \propi and \propii instead. Apr 14, 2018 at 21:32
  • Well, yes, just wanted to give an example. I edited my post for clarification, thanks. Apr 15, 2018 at 0:52


You must log in to answer this question.

Browse other questions tagged .