I would like to create a new tabular environment that allows me to add n (1-10) arguments without adding extra columns (such that both examples below work).
Here is my code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[sfdefault]{AlegreyaSans}
\RequirePackage{booktabs}
\usepackage[table,x11names,dvipsnames,table]{xcolor}
\usepackage{tabularx}
\definecolor{mygreen}{RGB}{126,169,105}
\definecolor{myblue}{RGB}{9,28,87}
\begin{document}
\newenvironment{tabulargreen}[3]
{
% \renewcommand{\tempcaption}{#3}
\rowcolors{1}{mygreen!20}{mygreen!10}
\begin{tabular}{lcr}
\rowcolor{mygreen}
\textcolor{white}{\bfseries #1} & \textcolor{white}{\bfseries #2} & \textcolor{white}{\bfseries #3} \\
}
{
% \caption{\tempcaption}
\end{tabular}
}
\begin{tabulargreen}{Name}{Zahl}{Nummer}
Modul eins & 2 & 3 \\
Modul zwei & 5 & 6 \\
Modul drei & 8 & 9 \\
Modul vier & 2 & 3 \\
Modul fünf & 5 & 6 \\
Modul sechs & 8 & 9 \\
\end{tabulargreen}
\vspace{5mm}
\begin{tabulargreen}{Name}{Zahl}
Modul eins & 3 \\
Modul zwei & 4 \\
Modul drei & 7 \\
\end{tabulargreen}
\end{document}
The tables still look like this:
Where does the "M" come from and how can I get rid of it?
Greetings and thanks a lot!
S.Millie



Mleaving justodulas the text in the first cell. Did you intend to define the environment to just have two arguments? – David Carlisle Jul 07 '18 at 17:07\begin{tabulargreen}{Name}{Zahl}Mso the third argument isMI can not guess what you want to happen in that case. – David Carlisle Jul 07 '18 at 17:18[]delimited rather than{}but why that syntax rather than making them be&separated like the rest of the table? – David Carlisle Jul 07 '18 at 17:32