1

I have the following piece of code:

\documentclass{article}
\oddsidemargin 43pt
\textheight 20.4 cm
\textwidth 14.0 cm
\parskip 6.8 pt
\parindent 12 pt
\usepackage{mathtools}
\begin{document}

\begin{table}[h]
\hrule
\begin{align}
\label{E}
\tag{E}
&\text{Axioms:} &&s =t  &&&\text{for all equations $s=t$ in $E$}\\[0mm]
\label{Ref}
\tag{Reflexivity}
&\text{ }
&&s=s  &&&\text{for every term $s$}
\\[0mm]
\label{Sym}
\tag{Symmetry}
&\text{Rules:}
&& \frac{s=t}{t=s}
&&&\text{ }
 \\[0mm]
\label{Trans}
\tag{Transitivity}
&\text{ }
&&\frac{s=t,t=v}{s=v}
&&&\text{ }
 \\[0mm]
\label{Cong}
\tag{Congruence}
&\text{ }
&&\frac{s_1=t_1, \ldots, s_n = t_n}{f(s_1,\ldots,s_n) = f(t_1,\ldots t_n)}
&&&\text{for every $n$-ary $f$}
\\[0mm]
\label{Subs}
\tag{Substitution}
&\text{ }
&&\frac{s=t}{\sigma(s) = \sigma(t)}
&&&\text{for $\sigma$ a substitution}
\end{align}
\hrule
\caption{Axioms and rules for an equational logic with axiom set $E$}
\label{tab: equational logic}
\end{table}

\end{document}

With the following output: Output of the code

As can be seen the first two columns are aligned to the left, and the second two to the right. Now I want the third and fourth column also to be aligned to the left (fourth not necessarily).

I tried a tabular, but then I can't refer to the lines (using \eqref{E} for instance). I also like the vertical spacing between the lines (which fails in a tabular environment)

I hope anyone knows how to do this

2
  • did you look at this question: tex.stackexchange.com/q/112576/15036 ? Does the upvoted answer there do what you want?
    – Thruston
    May 11, 2019 at 7:55
  • align aligns odd columns to the right and even to the left so you can use && to skip a column, in your image columns 1 and 2 are left aligned and 3 right aligned. May 11, 2019 at 7:57

1 Answer 1

4

As far as I can tell you want something like

enter image description here

Just remove a & from each row so the \text in the last column are left aligned rather than right.

\documentclass{article}
\oddsidemargin 43pt
\textheight 20.4 cm
\textwidth 14.0 cm
\parskip 6.8 pt
\parindent 12 pt
\usepackage{mathtools}
\begin{document}

\begin{table}[htp]
\hrule
\begin{align}
\label{E}
\tag{E}
&\text{Axioms:} &&s =t  &&\text{for all equations $s=t$ in $E$}\\[0mm]
\label{Ref}
\tag{Reflexivity}
&\text{ }
&&s=s  &&\text{for every term $s$}
\\[0mm]
\label{Sym}
\tag{Symmetry}
&\text{Rules:}
&& \frac{s=t}{t=s}
&&\text{ }
 \\[0mm]
\label{Trans}
\tag{Transitivity}
&\text{ }
&&\frac{s=t,t=v}{s=v}
&&\text{ }
 \\[0mm]
\label{Cong}
\tag{Congruence}
&\text{ }
&&\frac{s_1=t_1, \ldots, s_n = t_n}{f(s_1,\ldots,s_n) = f(t_1,\ldots t_n)}
&&\text{for every $n$-ary $f$}
\\[0mm]
\label{Subs}
\tag{Substitution}
&\text{ }
&&\frac{s=t}{\sigma(s) = \sigma(t)}
&&\text{for $\sigma$ a substitution}
\end{align}
\hrule
\caption{Axioms and rules for an equational logic with axiom set $E$}
\label{tab: equational logic}
\end{table}

\end{document}
2
  • Wow, that's a very simple solution! I always struggle with the &'s, what is the intuition between putting one or two or three &'s?
    – Sven
    May 11, 2019 at 8:41
  • 1
    @Sven your description had left and right reversed which confused things. I think you are thinking of the syntax the wrong way it is not that there is a special && separator it is simply that columns 1,3,5,... are right aligned and columns 2,4,6... are left aligned, so the usual case of a&=b & c&=d then you end up with two equations with a and b aligning to the first = and c and d aligning to the second, but if you want all columns right aligned just leave the even columns blank so a & & b & & c which you can of course write as a && b && c May 11, 2019 at 9:07

You must log in to answer this question.

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