0

I need some help with making the rule for implication i Latex. My biggest problem is the box.

Rule for implication

4
  • 1
    Welcome to TeX.SX! A little starting code would be nice. Sep 11, 2016 at 10:56
  • 1
    There are packages helping to typeset natural deduction proofs. See LaTeX for Logicians|Natural deduction proofs.
    – gernot
    Sep 11, 2016 at 19:22
  • @gernot Though I don't know any which look like that. If this is from a textbook, it would help to know which one.
    – cfr
    Sep 11, 2016 at 20:12
  • Well, these are the packages logicians in science use for their publications. Some time ago proof.sty was en vogue, but it is a bit outdated now and no longer maintained, so people now prefer busproofs.sty.
    – gernot
    Sep 11, 2016 at 20:32

1 Answer 1

2

An example with \boxed of package amsmath:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
    \frac{
      \boxed{
        \begin{array}{c}
          \phi\\
          \vdots\\
          \psi
        \end{array}
      }
    }{
      \phi \rightarrow \psi
    }
    \rightarrow
    - \mathbf{I}
\]
\end{document}

Result

With a better middle line, removed additional horizontal margins of array, and fine-tuned position of \vdots:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand*{\Frac}[2]{%
  % Even numbered box and register numbers smaller than 10 are
  % for local assignments.
  \begingroup
    % "Numerator" in box 0
    \sbox0{$#1\m@th$}%
    % "Denominator" in box 2
    \sbox2{$#2\m@th$}%
    % Maximum width in \dimen2
    \ifdim\wd0 > \wd2 %
      \dimen0=\wd0 %
    \else
      \dimen0=\wd2 %
    \fi
    % Add overshoot (5pt) of the line
    \advance\dimen0 by 10pt\relax
    % Vertical separation
    \dimen2=3pt\relax
    \setbox4=\vbox{%
      \hbox to \dimen0{\hfill\unhcopy0\hfill}%
      \kern\dimen2
      \hrule % default line thickness: 0.4pt
      \kern\dimen2
      \hbox to \dimen0{\hfill\unhcopy2\hfill}%
      \kern0pt\relax
    }%
    % Box for measuring height of math axis
    \sbox0{$\vcenter{}$}%
    % Set result with the line at the math axis
    \raise\dimexpr\ht0 - \ht2 - \dp2 - \dimen2 - .2pt\relax\copy4 %
  \endgroup
}
\makeatother

\begin{document}
\[
    \Frac{
      \boxed{
        \begin{array}{@{}c@{}}
          \phi\\[-2pt]
          \vdots\\
          \psi
        \end{array}
      }
    }{
      \phi \rightarrow \psi
    }
    \rightarrow
    - \mathbf{I}
\]
\end{document}

Result with better middle line

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .