i try to make some kind of table, where i create a number of rows automatically.
\documentclass{scrartcl}
\usepackage{polyglossia}
\setdefaultlanguage{german}
\usepackage{fontspec}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{tabularray}
\usepackage{tabularx}
\usepackage{scrlayer-scrpage} % Paket für Kopf- und Fußzeilen
\usepackage{pgffor} % Paket für Schleifen
%\ohead{\includegraphics[scale=0.05]{c:/Schule/logo_rot_3.jpg}}
\ifoot{08.02.2024}
%\renewcommand{\arraystretch}{2.1}
\newcommand{\createTable}[1]{
\begin{tblr}{
colspec = {|Q[5,l]|Q[3,c]|Q[2,c]|Q[2,c]|}, % Gleichmäßige Verteilung der Spalten
row{1} = {font=\bfseries, c}, % Formatierung der ersten Zeile
hlines, % Horizontale Linien
vlines, % Vertikale Linien
width=\textwidth % Breite der Tabelle auf Textbreite setzen
}
Kurs / Klasse & Raum & Anzahl & Vollständig? (abhaken) \\
Beispiel: Physik Q3 & Starck & P1 & 17 & \checkmark \\
\foreach \i in {1,...,#1} { & & & \\ }
\end{tblr}
}
\begin{document}
\section{Schulhof Altbau}
\begin{tabularx}{0.9\textwidth}{l X}
Räume & 005, 007, 008, 106, 107, 108, 109, 111, 113, 206, 207, 208, 209, 211, 214, 304, 305, 306, 307, 311\\
\end{tabularx}\\
\createTable{5}
\end{document}
Leads to "undefined control sequence". The documentation says something like that, i do not have enough experience to integrate it. Can you help me?
\IgnoreSpacesOn
\prgNewFunction \makeEmptyTable {mm} {
\tlSet \lTmpaTl {\intReplicate {\intEval{#2-1}} {&}}
\tlPutRight \lTmpaTl {\\}
\intReplicate {#1} {\tlUse \lTmpaTl}
}
\IgnoreSpacesOff
\begin{tblr}[evaluate=\makeEmptyTable]{hlines,vlines}
\makeEmptyTable{3}{7}
\end{tblr}