I'm trying to both start and end a table with \newcommand. I'd like to switch to using \EndTableSetupFourColumns (as it removes several warnings and is easier to understand for other readers) but for some reason LaTeX does not seem to recognize the \end{tabu} found within, so I have to insert it manually as seen below.
This problem seems to be limited to tabu - when I was using tabulars I did not have this issue. I looked through the tabu documentation and could not find anything that would indicate this wouldn't work.
Looking at \end{tabu} in \newcommand shows that it won't work, however, it is something I'd like to work around for code readability, if nothing else.
MWE:
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{longtable,tabu}
\newcommand{\TableSetupFourColumns}{%
\rowcolors{2}{gray!25}{white}
\begin{tabu} to \textwidth {lccX}
\rowcolor{gray!50}}
\newcommand{\EndTableSetupFourColumns}{%
\end{tabu}}
\begin{document}
\section{Test 1}
This is text.\par \noindent
\TableSetupFourColumns
Test & test & test & test\\
\end{tabu}
%\EndTableSetupFourColumns
\end{document}

I'll see if I can get a MNWE of that up.
– JuniorIncanter Apr 23 '13 at 20:43longtabuis a different matter. – egreg Apr 23 '13 at 20:44\newcommandwork for longtabu, or could I get it working with\newenvironment? – JuniorIncanter Apr 23 '13 at 20:49tabu4tolongtabu4andtabuin the definition tolongtabu, I don't have any problem. – egreg Apr 23 '13 at 20:51fancyhdr's\fancyheadand\fancyfootwhen the table is big enough to span more than one page. I've got a MNWE that I'll post if I can't figure out how to fix it myself. – JuniorIncanter Apr 24 '13 at 13:54