Skip to content

Instantly share code, notes, and snippets.

@lambdageek
Last active February 27, 2023 17:33
Show Gist options
  • Save lambdageek/075ea17f362bc455467a to your computer and use it in GitHub Desktop.
Save lambdageek/075ea17f362bc455467a to your computer and use it in GitHub Desktop.
LaTeX array within inferrule from mathpartir

Sometimes I want to put an array inside of a mathpartir inferrule.

The straightforward thing doesn't work:

\begin{equation*}
\inferrule{Conclusion}{
  Premiss 1 \and
  \begin{array}{ll}
   1 & 2 \\  % note, this is where the problem happens
   3 & 4
  \end{array}
}
\end{equation*}

The problem is that \\ is defined by inferrule in an incompatible way from array.

Fortunately, the \\ inside an array env is just an alias for \@arraycr (see documentation for the array package (PDF)).

So we just need the following in the preamble:

\makeatletter % allow us to mention @-commands
\def\arcr{\@arraycr}
\makeatother

...
\begin{document}
  \begin{equation*}
  \inferrule{Conclusion}{
    Premiss 1 \and
    \begin{array}{ll}
      1 & 2 \arcr
      3 & 4
    \end{array}
  }
  \end{equation*}
\end{document}

That's all!

@ice1000
Copy link

ice1000 commented Feb 28, 2021

Thank you, saved my life.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment