\newcommand 内の \end{tabu}

\newcommand 内の \end{tabu}

\end{tabu}\newcommand

\documentclass{article}

\usepackage{tabu}

\newcommand
{\tableBegin}[1]
{
    \begin{tabu}[#1]
    % some other stuff
}

\newcommand
{\tableEnd}
{\end{tabu}}

\begin{document}

\tableBegin{ccc}
1 & 2 & 3 \\
a & b & c
\tableEnd
%\end{tabu}

\end{document}

しかし、\tableEndの代わりにを使用すると\end{tabu}、次のエラーが発生します。 ! Missing $ inserted.

答え1

tabu(AMS 環境などtabularx) は、その本体を引数として取得し、\end{tabu}ソース内で明示的に検索します。これを回避することも可能ですが、回避せずに、ドキュメント化された環境名を使用する方が簡単です。

\tableBegin/EndLaTeX の規則とはまったく異なるので、新しい環境を定義してみませんか?

関連情報