I want to create a table based on a comma separated data as follows:
\documentclass{article}
\usepackage{pgffor}
\usepackage{multirow}
\usepackage{float}
\newcommand{\cases}{a , b}
\newcommand{\repetir}{
\foreach \case in {\cases}{
\case & & & & & & & & & & & & & & & \\\hline
}
}
\begin{document}
\begin{table}[H]
\centering
\scriptsize
\begin{tabular}{ | p{4cm} | p{3cm} |l| l|l|l| l | l | l | l | l| l | l | l | l | p{3cm} | }
\hline
\multirow{3}{*}{Case name} & \multirow{3}{*}{Description} & \multicolumn{14}{c|}{Further Details} \\\cline{3-16}
& & \multicolumn{3}{c|}{O} & \multicolumn{3}{c|}{A} & \multicolumn{2}{c|}{F} & \multicolumn{2}{c|}{B} & & \multirow{2}{*}{G} & \multirow{2}{*}{C} & \multirow{2}{*}{Other} \\ \cline{3-13}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\ \hline
\repetir
\end{tabular}
\end{table}
\end{document}
However I always get an error:
Extra } or forgotten \endgroup \repetir.
How can I do this?
\documentclass
and ending with\end{document}
. – Bobyandbob Apr 27 '17 at 12:58\foreach
command in group ('cell') and want to end it in another group, this can't work this way – user31729 Apr 27 '17 at 13:16\cases
is already a defined macro, you shouldn't use that name.\mycases
would be a lot better. And your code misses at least two packages (float
andmultirow
). – Skillmon Apr 27 '17 at 13:17