# Proof tree as argument to function, with tight-fitting box

I would like to define a function over proof trees, using mathpartir to layout the proofs. For example: 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:

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

# 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*}
\end{equation*}
\end{document}


# 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