2

I would like to define a function over proof trees, using mathpartir to layout the proofs. For example: enter image description here However, I would like the function parentheses to fit snugly around the inference rule.

I'm using \mbox, but that doesn't seem to work; I experimented with \fbox to see if \setlength\fboxsep{0pt} had any effect, but it didn't (and I don't want a visible border anyway).

I can get better results with \makebox:

enter image description here

but that involves having to set the size manually for each case of the function.

A second constraint (illustrated by neither of my images) is that the proof tree argument should be vertically centered inside the parentheses.

Here's my code:

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathpartir}

\begin{document}
\begin{align*}
   f\left(
      \mbox{
         \begin{mathpar}
            \inferrule*
            {
               T \\
               U
            }
            {
               \rho, (e_1, e_2) \Rightarrow v
            }
         \end{mathpar}
      }
   \right)
   &=
   (f(T), f(U))
   \\
   f\left(
      \makebox[0.9in]{
         \begin{mathpar}
            \inferrule*
            {
               T \\
               U
            }
            {
               \rho, (e_1, e_2) \Rightarrow v
            }
         \end{mathpar}
      }
   \right)
   &=
   (f(T), f(U))
\end{align*}
\end{document}
  • @yo' Just added, sorry - forgot to include it! – Roly Feb 28 '18 at 8:58
1

Solution 1.

Why don't you just simply use \frac in the parentheses? It seems to have the layout which you want to achieve.

\documentclass{article}

\usepackage{amsmath}
\begin{document}

\begin{equation*}
    f\left(\frac{T\qquad U}{\rho,(e_1,e_2)\Rightarrow v}\right) = (f(T),f(U))
\end{equation*}
\end{document}

enter image description here

Solution 2.

If you are willing to manually play with lengths, you can try

\documentclass{article}

\usepackage{amsmath,mathpartir}
\begin{document}

\begin{equation*}
   f\left(\raisebox{-0.25cm}{\makebox[0.9in]{
    \begin{mathpar}
    \inferrule*
    {
        T \\
        U
    }
    {
        \rho, (e_1, e_2) \Rightarrow v
    }
    \end{mathpar}}}
\right)
\end{equation*}
\end{document}
  • Ideally I would like to copy and paste from inference rules written using mathpartir. But this may be a useful alternative if I can't make progress otherwise - thanks. – Roly Feb 28 '18 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.