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
% 第一引数:識別子
% 第二引数:コンマ区切りのやつ
\def\taple#1#2{%
\expandafter\newcount\csname #1@xx@i\endcsname
\expandafter\newcount\csname #1@xx@ii\endcsname
\@nameuse{#1@xx@i} = -1
\@nameuse{#1@xx@ii} = 0
\@for\mem:=#2\do{ \advance\@nameuse{#1@xx@i} by 1 }
\left(%
\@for\mem:=#2\do{%
\ifnum \@nameuse{#1@xx@ii}<\@nameuse{#1@xx@i}\relax%
\mem,%
\advance\@nameuse{#1@xx@ii} by 1%
\else%
\mem%
\fi%
}
\right)%
}
\makeatother
\begin{document}
$\taple{a}{ \taple{A}{0, 9}, \taple{b}{1, 2}, \taple{c}{3, 4} }$
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment