2

I try to come up with a couple of formulas which should be aligned according to a relation symbol but also to the left. Have a look at the following example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
T &= x + y \\
T_{\text{total}} &= y
\end{align}
%
\[
\begin{array}{lcl}
T &=& x + y \\
T_{\text{total}} &=& y
\end{array}
\]
\end{document}

While using the align environment each line is tagged with a number but the terms on the left hand side are aligned to the right. I tried to solve that by using an array environment where I can easily control how the left and right hand side of an equation should be aligned, but know I cannot tag the lines anymore.

Does someone has an idea how to align equations to a symbol and at the same time control the alignment of the left and right hand side of the equations?

2 Answers 2

3

A solution that uses alignat:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{2}
&T &&= x + y \\
&T_{\text{total}} &&= y
\end{alignat}
\end{document}

Result with alignat

1
  • Very nice! Exactly what I needed. Thanks for your answer! Commented Sep 17, 2012 at 14:55
1

I think the IEEEtrantools package might help you in this regard.

    \documentclass{article}
    \usepackage{IEEEtrantools}
    \usepackage{amsmath}
    \begin{document}
    \begin{align}
    T &= x + y \\
    T_{\text{total}} &= y
    \end{align}
    %
    \[
    \begin{array}{lcl}
    T &=& x + y \\ 
    T_{\text{total}} &=& y
    \end{array}
    \]

    \begin{IEEEeqnarray}{lCl}
    T &=& x + y \\ 
    T_{\text{total}} &=& y
    \end{IEEEeqnarray}

    \end{document}

output form

3
  • Ahh nice package. I have not heared of that before. I will have a look at that. But for simplicity I will accept Heiko Oberdiek's solution, because, then I do not have to check my document against side effects by including a new package. Nevertheless, thanks for your answer! Commented Sep 17, 2012 at 14:54
  • Btw. how do you create these nice images? I would like to include images of my latex-code in my questions, too. Commented Sep 17, 2012 at 14:58
  • @PeterMuller -- i asked a question about posting an image and it got a very nice answer. that assumes the image exists. to create a suitable image, i find that using \Large and \thispagestyle{empty} are effective (omit from posted code), process with pdflatex and use pdfcrop to get rid of extra white space around the edges. Commented Sep 21, 2012 at 21:16

You must log in to answer this question.

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