3

I would like to write some text next to fractions with many floors, but I don't know how to do it right. Here is an example of what I want to do:

what i want to do

In the red circle, I want to write something like what is just below. Here is how I got this :

\cfrac
        {\cfrac
            {A \vee A \vdash A}
            {\vdash \neg (A \vee A), A}}  
        {\vdash \neg (A \vee A) \vee A}
        & \qquad \text{($\vdash \vee$)}

Thank you in advance.

Edit : In fact, I'm looking for something like that : enter image description here

But I want all the brackets to be aligned and out of the fraction

4
  • Welcome to TeX.SE. Just out of curiosity: Why are you using \cfrac (which is short for "continued fraction") even though the fractional expression you're showing does not appear to be a continued-fraction expression? Please advise.
    – Mico
    Commented Apr 7, 2021 at 15:51
  • Thanks. I am using cfrac instead of frac because it is much more readable when stacking 5, 6, or 7 floors (see imgur.com/UTMvQpG for the same code with frac)
    – Jov
    Commented Apr 7, 2021 at 15:57
  • What do you mean "brackets aligned"? Are you referring to the quantities in parentheses on the far right? If so, my answer needs some additional thought. Commented Apr 7, 2021 at 16:45
  • off topic: However this is constructed, you really want the clearance between the rules and the top and baseline of the main content to be uniform. Adding \mathstrut to each line might be helpful. Commented Apr 7, 2021 at 19:15

2 Answers 2

2

First, to achieve what the OP showed:

\documentclass{article}

\usepackage{amsmath}
\newcommand\push{\hfill\mbox{}}
\newcommand\notate[1]{\push\qquad\rlap{$#1$}}
\begin{document}
\[
\cfrac
        {\!\cfrac
            {A \vee A \vdash A\push}
            {\vdash \neg (A \vee A), A}       \notate{(\vdash \vee)}}  
        {\vdash \neg (A \vee A) \vee A\push}  \notate{(\vdash \vee)}
\]
\end{document}

enter image description here

Then, he adds "But I want all the brackets to be aligned and out of the fraction". So here, I change slightly the definition of \notate:

\documentclass{article}

\usepackage{amsmath}
\newcommand\push{\hfill\mbox{}}
\newcommand\notate[1]{\push\rlap{\qquad$#1$}}
\begin{document}
\[
\cfrac
        {\mkern-2mu\cfrac
            {A \vee A \vdash A\push}
            {\vdash \neg (A \vee A), A}  \notate{(\vdash \vee)}}  
        {\vdash \neg (A \vee A) \vee A}  \notate{(\vdash \vee)}
\]
\end{document}

enter image description here

4
  • Thank you very much for your answer !
    – Jov
    Commented Apr 7, 2021 at 17:16
  • @VictorJosso I'm not sure it will properly align the right side if the stack of the fractions grows deeper. You may wish to withhold the check-mark until you verify it works for your application. I am still looking further. Commented Apr 7, 2021 at 17:18
  • It works for me with 4 fractions stacked (5, because I need the last one to have an empty numerator) imgur.com/QoXROJB
    – Jov
    Commented Apr 7, 2021 at 17:23
  • @VictorJosso Awesome! Thanks for the check! Commented Apr 7, 2021 at 17:24
0

I can suggest bussproofs:

\documentclass{article}
\usepackage{bussproofs}

\begin{document}

\begin{prooftree}
\AxiomC{$\overline{A\vdash A}$} \AxiomC{$\overline{A\vdash A}$}
\RightLabel{$(\lor\vdash)$}
\BinaryInfC{$A\lor A\vdash A$}
\RightLabel{$(\vdash\neg)$}
\UnaryInfC{$\vdash\neg(A\lor A),A$}
\RightLabel{$(\vdash\lor)$}
\UnaryInfC{$\vdash\neg(A\lor A)\lor A$}
\end{prooftree}

\end{document}

enter image description here

1
  • Thank you so much !! This was not what I have asked for, but this is what I need ahah
    – Jov
    Commented Apr 8, 2021 at 0:16

You must log in to answer this question.

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