Skip to content

Instantly share code, notes, and snippets.

@wenkokke
Last active January 3, 2016 11:39
Show Gist options
  • Save wenkokke/8457580 to your computer and use it in GitHub Desktop.
Save wenkokke/8457580 to your computer and use it in GitHub Desktop.
A few macros for Barker & Shan-style Tower notation in LaTeX.
\usepackage{array}
\usepackage{stmaryrd}
% display a one-level tower
\newcommand{\tower}[4][]{%
\begin{array}{c|c}
#4 & #3
\\ \hline
\multicolumn{2}{c}{#2}
\\
\multicolumn{2}{c}{#1}
\end{array}
}
% display a two-level tower
\newcommand{\multitower}[6][]{%
\begin{array}{c|c}
#6 & #5
\\ \hline
#4 & #3
\\ \hline
\multicolumn{2}{c}{#2}
\\
\multicolumn{2}{c}{#1}
\end{array}
}
% fat slash type notation for a towers---you can keep
% the arguments the same, just add an "un" in front :)
\newcommand{\untower}[4][]{%
#4 \fatslash (#2 \fatbslash #3)
}
\newcommand{\unmultitower}[6][]{%
#6 \fatslash ((\untower{#2}{#3}{#4}) \fatbslash #5)
}
% same idea as above, except that it now shows the cps
% translation of the tower (note that you'll have to
% translate all constituents manually, though).
\newcommand{\cps}[4][]{%
(#2 \impl #3) \impl #4
}
\newcommand{\multicps}[6][]{%
((\cps{#2}{#3}{#4}) \impl #5) \impl #6
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment