-
-
Save zr-tex8r/4483159 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{jarticle} | |
\makeatletter | |
% registers are ALWAYS allocated globally (darn!) | |
\newcount\@fuck@i | |
\newcount\@fuck@ii | |
\def\tuple#1{% | |
\begingroup | |
\@fuck@i = -1 | |
\@fuck@ii = 0 | |
\@for\mem:=#1\do{\advance\@fuck@i by 1\relax } %harmful space chopped | |
\left( | |
\@for\mem:=#1\do{% | |
% no use fiddling around \@tempcnta etc... | |
\ifnum \@fuck@ii<\@fuck@i\relax | |
\mem, | |
\advance\@fuck@ii by 1\relax | |
\else | |
\mem | |
\fi | |
} | |
\right) | |
\endgroup | |
} | |
\makeatother | |
\begin{document} | |
$ \tuple{ \tuple{a, b, 1, 2}, \tuple{d, i, a}, a, 1, 2, \tuple{1, 2}} $ | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment