0

I have the following 'table':

\begin{align}
1.&\gamma   &\text{Hyp}\nonumber\\
2.&\neg \gamma &\text{Hyp}\nonumber\\
3.&(\gamma\implies(\neg\alpha\implies \gamma))&\text{AX1}\nonumber\\
4.&(\neg\alpha\implies\gamma)&\text{MP (1,3)}\nonumber\\
5.&(\neg \gamma \implies (\neg \alpha \implies \neg \gamma))&\text{AX1}\nonumber\\
6.&(\neg \alpha \implies \neg \gamma)&\text{MP(2,5)}\nonumber\\
7.&((\neg \alpha \implies\neg \gamma) \implies ((\neg \alpha \implies \gamma)\implies \alpha))&\text{AX3}\nonumber\\
8.&((\neg \alpha \implies \gamma) \implies \alpha)) &\text{MP(6,7)}\nonumber\\
9.& \alpha.&\text{MP(4,8)}\nonumber
\end{align}

Which looks like this:

enter image description here

I want to have a bit more space between the numbers 1. , 2. , etc and the beggining of the formulas, and also want to have the text in the position where it is now, but aligned on the first letter (I want the words AX1 and MP(1,3) to have the "A" and "M" in the same 'column').

Is there any easy way to do this?

1 Answer 1

2

With alignat* (the * version saves you from typing 9 times\nonumber), or with a tabular environment:

\documentclass[12pt]{report}
\usepackage{amsmath}
\usepackage{array}

\begin{document}

\begin{alignat*}{3}
  1. & \quad & & \gamma & & \text{Hyp} \\
  2. & & & \neg \gamma & & \text{Hyp} \\
  3. & & & (\gamma\implies(\neg\alpha\implies \gamma)) & & \text{AX1} \\
  4. & & & (\neg\alpha\implies\gamma) & & \text{MP (1,3)} \\
  5. & & & (\neg \gamma \implies (\neg \alpha \implies \neg \gamma)) & & \text{AX1} \\
  6. & & & (\neg \alpha \implies \neg \gamma) & & \text{MP(2,5)} \\
  7. & & & ((\neg \alpha \implies\neg \gamma) \implies ((\neg \alpha \implies \gamma)\implies \alpha)) & \qquad & \text{AX3} \\
  8. & & & ((\neg \alpha \implies \gamma) \implies \alpha)) & & \text{MP(6,7)} \\
  9. & & & \alpha. & & \text{MP(4,8)}
\end{alignat*}
\vskip1cm

\newcounter{rowcnt}\setcounter{rowcnt}{0}
\begin{tabular}{>{\refstepcounter{rowcnt}\therowcnt.\quad$}l<{$}@{\qquad}l}
      \gamma & Hyp \\
      \neg \gamma & Hyp \\
      (\gamma\implies(\neg\alpha\implies \gamma)) & AX1 \\
      (\neg\alpha\implies\gamma) & MP (1,3) \\
      (\neg \gamma \implies (\neg \alpha \implies \neg \gamma)) & AX1 \\
      (\neg \alpha \implies \neg \gamma) & MP(2,5) \\
      ((\neg \alpha \implies\neg \gamma) \implies ((\neg \alpha \implies \gamma)\implies \alpha)) & AX3 \\
      ((\neg \alpha \implies \gamma) \implies \alpha)) &MP(6,7) \\
      \alpha. & MP(4,8)
\end{tabular}

\end{document} 

enter image description here

5
  • Thanks a lot! Could you explain a bit why you used three '&' in all the lines but the first (where you used a &, a \quad and two more &s)? If I used only two &s in the lines below, it would break the table and I don't understand why. Jan 21, 2016 at 19:57
  • For k alignment groups, you need 2k – 1 &: from the second group, a first & introduces the group, the second & sets the alignment point inside that group. Note it would be as simple to use a tabular environment, with an automatic numbering of rows.
    – Bernard
    Jan 21, 2016 at 20:18
  • I see, thanks Bernard, I had I seen the tabular environment, but I didn't quite get how to do stuff like this. I have a last question, if I change one of the numbers, to a two(or more) digit numbers, they get aligned towards the rightmost digit, is there a way to align them to the left (just as the text)? Jan 21, 2016 at 20:44
  • For the tabular solution, I've updated my answer. For the problem of two-digit numbers, I'll try to see what can be done, but in my opinion, it looks better if right-aligned.
    – Bernard
    Jan 21, 2016 at 20:51
  • Yes, I thought about if for a while and it will look better this way (else I'd have to align all the dots to the position of the dot of the biggest number, and that would look bad), so don't lose any more time with it. Thanks a lot! Jan 21, 2016 at 20:54

You must log in to answer this question.

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