从校样包中对齐校样

从校样包中对齐校样

我正在尝试将生成的几个证明与infer来自的命令对齐证明包裹。

我希望能够生成以下内容: 在此处输入图片描述

但我无法以这种方式对齐。这是一个最小的例子:

\documentclass{article}
\usepackage{proof}
\begin{document}
\[
  \begin{array}{cc}
    \vcenter{\infer[rule~name]{equation}{equation}}
    &
    conditions\ \vcenter{\infer[rule~name]{equation}{equation}}
    \\[1.5em]
    conditions\ \vcenter{\infer[rule~name]{equation}{equation}}
    &
    \vcenter{\infer[rule~name]{equation~maybe~longer}{equation}}
  \end{array}
\]
\end{document}

其结果如下: 在此处输入图片描述

答案1

您可以测量项目,然后设置条件和规则名称部分,假装它们没有宽度:

\documentclass{article}
\usepackage{proof,environ,array}

\newcommand\centerinfer[4]{%
 % #1=condition, #2=rule name, #3=lower, #4=upper
 \ifcenterinfermeasure
   $#1\ \vcenter{\infer{#3}{#4}}\ #2$%
 \else
   \llap{$#1$\ }\vcenter{\infer{#3}{#4}}\rlap{\ $#2$}%
 \fi
}
\newif\ifcenterinfermeasure
\NewEnviron{infertable}
 {\centerinfermeasuretrue
  \setbox0=\vbox{tabskip=0pt
    \renewcommand\\[1][]{\cr}%
    \halign{##&##\cr
    \BODY\crcr}
    \setbox0=\lastbox
    \setbox0=\hbox{\unhbox0 \unskip\setbox2=\lastbox\unskip\setbox4=\lastbox
      \global\dimen1=\wd4 \global\dimen3=\wd2 }
  }%
  \centerinfermeasurefalse
  \begin{tabular}{%
    @{}
    >{\centering$\displaystyle}p{\dimen1}<{$}
    >{\centering\arraybackslash$\displaystyle}p{\dimen3}<{$}
    @{}
  }
  \BODY
  \end{tabular}
}

\begin{document}
\[
\begin{infertable}
\centerinfer{}{rule~name}{equation}{equation} &
  \centerinfer{conditions}{rule~name}{equation}{equation}
\\[1.5em]
\centerinfer{conditions}{rule~name}{equation}{equation} &
  \centerinfer{}{rule~name}{equation~maybe~longer}{equation}
\end{infertable}
\]
\end{document}

在此处输入图片描述

答案2

结盟没有proof包裹通过一些“盒子操作”(幻影和重叠)是可能的:

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
  \begin{array}{c}
    \phantom{\text{conditions}}\ \dfrac{\text{topA}}{\text{bottomA}}\ \rlap{\text{rule nameA}}\phantom{\text{rule name rule B}} \\ \\
    \text{conditions}\ \dfrac{\text{topBtopB}}{\text{bottomB}}\ \text{rule name rule B}
  \end{array}
\]
\end{document}

相关内容