Skip to content

Instantly share code, notes, and snippets.

@y-yu
Last active December 10, 2015 19:28
Show Gist options
  • Save y-yu/4480996 to your computer and use it in GitHub Desktop.
Save y-yu/4480996 to your computer and use it in GitHub Desktop.
\documentclass{jarticle}
\makeatletter
\def\tuple#1{%
\begingroup
\newcount\@fuck@i
\newcount\@fuck@ii
\@fuck@i = -1
\@fuck@ii = 0
\@for\mem:=#1\do{ \advance\@fuck@i by 1\relax }
\left(
\@for\mem:=#1\do{%
\@tempcnta = \@fuck@i
\@tempcntb = \@fuck@ii
\ifnum \@fuck@ii<\@fuck@i\relax%
%|\mem - \the\@fuck@ii|,%
\mem,
\advance\@tempcntb by 1%
\else%
%|\mem - \the\@fuck@ii|%
\mem
\fi%
\@fuck@i = \@tempcnta
\@fuck@ii = \@tempcntb
}
\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