Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Forked from y-yu/taple.tex
Last active December 10, 2015 19:39
Show Gist options
  • Save zr-tex8r/4483159 to your computer and use it in GitHub Desktop.
Save zr-tex8r/4483159 to your computer and use it in GitHub Desktop.
\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