Skip to content

Instantly share code, notes, and snippets.

@Liam0205
Last active April 8, 2016 14:34
Show Gist options
  • Select an option

  • Save Liam0205/660a4d5dae5683903b70b98887752e11 to your computer and use it in GitHub Desktop.

Select an option

Save Liam0205/660a4d5dae5683903b70b98887752e11 to your computer and use it in GitHub Desktop.
multi aligned cases environ template
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\MHInternalSyntaxOn
\def\MT_start_cases:nnnnn #1#2#3#4#5{%
\RIfM@\else
\nonmatherr@{\begin{\@currenvir}}
\fi
\MH_group_align_safe_begin:
\left#5
\vcenter \bgroup
\Let@ \chardef\dspbrk@context\@ne \restore@math@cr
\let \math@cr@@\AMS@math@cr@@
\spread@equation
\ialign\bgroup
\strut@#2 &#1\strut@
#3 &#1\strut@
#4
\crcr
}
\def\MH_end_cases:{\crcr\egroup
\restorecolumn@
\egroup
\MH_group_align_safe_end:
}
\newcommand*\mynewcases[7]{%
\newenvironment{#1}
{\MT_start_cases:nnnnn {#2}{#3}{#4}{#5}{#6}}
{\MH_end_cases:\right#7}
}
\mynewcases{mydcases}{\relax}
{$\m@th{##}$\hfil}{$\m@th{##}$\hfil}{$\m@th{##}$\hfil}
{.}{\rbrace}
\MHInternalSyntaxOff
\begin{document}
\[
\begin{mydcases}
a &{} = b &{} = c \\
a &{} = b &{} = c \\
a &{} = b &{} = c
\end{mydcases}
\]
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment