Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
    
Very nice! Exactly what I needed. Thanks for your answer! –  Peter Müller Sep 17 '12 at 14:55
add comment

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

share|improve this answer
    
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! –  Peter Müller Sep 17 '12 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. –  Peter Müller Sep 17 '12 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. –  barbara beeton Sep 21 '12 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.