This question was actually put to me on komascript.de in 2010. It was about creating a list of all students and their parents. In order to create a relation to KOMA-Script, I then developed a solution based on the adr
files of scrlttr2
and scrletter
, but also on the little-noticed package scraddr
.
The \addrentry
commands of scraddr
have 9 arguments, the meaning of most of which is freely selectable. Let's assume the arguments have the following meaning:
It should be noted that for parents, Own abbreviation is duplicated either as the First parent's abbreviation or as the Second parent's abbreviation. This means that the parents (and therefore the student's grandparents) are not entered for parents, but rather the child's parents. Parents can then be recognized simply by the fact that the 9th argument is duplicated as either the 7th or 8th argument. In the case of children, however, all three abbreviations are different.
A disadvantage of the solution can already be seen here. It is only suitable for families with a maximum of two parents or, rather, legal guardians.
The data record for a child could then look like this as an adr
file:
\addrentry{Müller}{Leonard}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{}{Leonard@Müller.invalid}
{MuellerFranka}{MuellerFranz}{MuellerLeonard}
\addrentry{Müller}{Franka}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{0176 458763325}{Franka@Müller.invalid}
{MuellerFranka}{MuellerFranz}{MuellerFranka}
\addrentry{Müller}{Franz}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{0176 458763327}{Franz\_Peter@Müller.invalid}
{MuellerFranka}{MuellerFranz}{MuellerFranz}
The dates show that Leonard Müller is the child, as the 9th argument is not repeated in either the 7th or 8th argument. Franka Müller is the first parent, Franz Müller the second, although this is not intended to be a judgment. If we assume that Leonard has a younger sister who has already skipped a grade due to her eminent intelligence, the data set is merely extended by:
\addrentry{Müller}{Leonie}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{0176 458763326}{Leonie@mensa.invalid}
{MuellerFranka}{MuellerFranz}{MuellerLeonie}
This also shows that we should not rely on the parents always following the child. Another such case would be if Mr. Müller was a real drifter and there was another child of his but with a different mother in the same class. However, his mother does not allow the child to use her cell phone or email:
\addrentry{Mayer}{Kay}{Alte Mayerrei 4\\ 16507 Berlin}
{}{}{}
{MayerSabine}{MuellerFranz}{MayerKay}
\addrentry{Mayer}{Sabine}{Alte Mayerrei 4\\ 16507 Berlin}
{}{0176 4587663220}{Sabine.Mayer@invalid.invalid}
{MayerSabine}{MuellerFranz}{MayerSabine}
However, Mrs. Müller was no angel before her marriage. Her child from that time didn't have it easy and therefore repeated a grade. She doesn't know the father or doesn't want to name away:
\addrentry{Huber}{Chris}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{}{Chris@Müller.invalid}
{MuellerFranka}{}{HuberChris}
We now also know Mrs. Müller's maiden name.
So the family circumstances in the class don't have to be that simple. Incidentally, it doesn't matter whether you leave the 7th or 8th argument empty for single parents.
To be able to access the parents later via the abbreviations in the 7th or 8th argument, we use package scraddr
and load the address file via \InputAddressFile
. We now only need to identify children, as explained above. To compare the 9th argument with the 7th and 8th, we use the KOMA-Script command \Ifstr
. To test for empty arguments, simply use \IfArgIsEmpty
. This results in:
\begin{filecontents*}[overwrite]{elternsprecher.adr}
\addrentry{Müller}{Leonard}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{}{Leonard@Müller.invalid}
{MuellerFranka}{MuellerFranz}{MuellerLeonard}
\addrentry{Müller}{Franka}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{0176 458763325}{Franka@Müller.invalid}
{MuellerFranka}{MuellerFranz}{MuellerFranka}
\addrentry{Müller}{Franz}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{0176 458763327}{Franz\_Peter@Müller.invalid}
{MuellerFranka}{MuellerFranz}{MuellerFranz}
\addrentry{Müller}{Leonie}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{0176 458763326}{Leonie@mensa.invalid}
{MuellerFranka}{MuellerFranz}{MuellerLeonie}
\addrentry{Mayer}{Kay}{Alte Mayerrei 4\\ 16507 Berlin}
{}{}{}
{MayerSabine}{MuellerFranz}{MayerKay}
\addrentry{Mayer}{Sabine}{Alte Mayerrei 4\\ 16507 Berlin}
{}{0176 4587663220}{Sabine.Mayer@invalid.invalid}
{MayerSabine}{MuellerFranz}{MayerSabine}
\addrentry{Huber}{Chris}{Müllerstraße 10\\ 16507 Berlin}
{030~78554685}{}{Chris@Müller.invalid}
{MuellerFranka}{}{HuberChris}
\end{filecontents*}
\documentclass[DIV=18]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{scraddr}
\InputAddressFile{elternsprecher}
\newcommand*{\addrentry}[9]{%
\Ifstr{#7}{#9}{% Own = Parent 1 → ignore
}{%
\Ifstr{#8}{#9}{% Own = Parent 2 → ignore
}{% Own != Parent 1 AND Own != Parent 2 → Child
\minisec{#2\nobreakspace #1}
\begin{minipage}{\linewidth}% keep the family together
\showvalues{#3}{#4}{#5}{#6}% show address, phone, email
\IfArgIsEmpty{#7}{% no Parent 1 → ignore Parent 1
}{%
\medskip\hspace*{1em}\parbox[t]{\dimexpr \linewidth-1em\relax}{%
\FirstName{#7}\nobreakspace\LastName{#7}\par
\showvalues{\Address{#7}}{\Telephone{#7}}{\FreeI{#7}}{\FreeII{#7}}%
}\par
}%
\IfArgIsEmpty{#8}{% no Parent 2 → ignore Parent 2
}{%
\medskip\hspace*{1em}\parbox[t]{\dimexpr \linewidth-1em\relax}{%
\FirstName{#8}\nobreakspace\LastName{#8}\par
\showvalues{\Address{#8}}{\Telephone{#8}}{\FreeI{#8}}{\FreeII{#8}}%
}\par
}%
\end{minipage}\par
}%
}%
}
\newcommand*{\showvalues}[4]{%
\strut{\renewcommand*\\[1][]{, }#1}\par\noindent
\mbox{Phone: \IfArgIsEmpty{#2}{---}{#2}},
\mbox{Cellphone: \IfArgIsEmpty{#3}{---}{#3}},
\mbox{Email: \IfArgIsEmpty{#4}{---}{#4}}\par
}
\begin{document}
\input{elternsprecher.adr}
\end{document}
Note: Even though the example shows that adr
files can be a very powerful tool, the patchwork family example shown should not be taken too seriously or importantly. Nowadays, it would be advisable to work with structures based on l3prop
, for example, instead. However, to show this here would be to miss the point, namely KOMA-Script.
Final note: I have not translated the data records as the specific names, addresses and numbers are irrelevant for the example.