Skip to content

Instantly share code, notes, and snippets.

@dkim
Forked from lambdageek/Array-In-InferRule.md
Created August 15, 2016 19:42
Show Gist options
  • Select an option

  • Save dkim/69abb77d0d9703c709388b9e1ac75dd3 to your computer and use it in GitHub Desktop.

Select an option

Save dkim/69abb77d0d9703c709388b9e1ac75dd3 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!

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