Still soldiering on with trying to learn these macros. Can someone tell me why this isn't working?
The macro \mycline{n-n}
is supposed to expand to \cmidrule{1-1} ... \cmidrule{n-n}
, but in my code below I get multiple errors..
\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\def\mycline(#1-#2){
\xdef\MC{}%
\foreach \a in {#1,...,#2}{%
\toks0=\expandafter{\MC}%
\def\temp{\cmidrule\expandafter{\a\expandafter-\a}}%
\xdef\MC{\the\toks0 \temp}%
}
\MC
}
\begin{document}
\begin{tabular}{llll}
1&2&3&4\\ \mycline{1-3}
5&6&7&8\\
\end{tabular}
\end{document}
\cmidrule{1-3}
?