% Tuple typesetting
% Adds triangle brackets and spaces commas.  ie $\tup{1,2,3}$
% Arguments can be enclosed in braces or angle brackets
\def\tup{%
  \def\tupInside\tupStart##1,##2\tupEnd{%
    ##1
    \def\tempa{}\def\tempb{##2}
    \ifx\tempa\tempb\else
    ,\;\tupInside\tupStart##2\tupEnd
    \fi}
  \def\tupBraces##1{\left\langle\tupInside\tupStart##1,\tupEnd\right\rangle}
  \def\tupBrackets<##1>{\tupBraces{##1}}
  \@ifnextchar<\tupBrackets\tupBraces}
