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 was wondering if it is possible to take control of the exact position of the tab in an align environment.

Like so:

\begin{align}[2cm]
A &= x^3 + 14789\\
B &= f^6
\end{align}

Which should then place both '=' signs at exactly 2cm from the left margin. No matter how long the expressions before and after '=' are.

Does anyone know how to do something like that?

share|improve this question
1  
What happens if the expression before '=' is 5cm long? then your requirement is impossible to be met I am not sure if I understand your requirement correctly. I think you probably looking for \hspace*{2cm}\begin{alignment}` –  Yiannis Lazarides Feb 20 '12 at 15:27
    
I would only use it in places where it does not cause trouble. –  Matthias Feb 20 '12 at 15:28
    
Try \hspace*{2cm}\begin{alignment}. If it works let me know and I will post an explanation. There are also other ways. –  Yiannis Lazarides Feb 20 '12 at 15:29

1 Answer 1

up vote 3 down vote accepted

In the following minimal example, the LHS ends at exactly 2cm from the left margin. The use of the flalign environment (from amsmath) with an additional alignment operator & pushes everything flush to the left margin, while a box of width 2cm leaves the LHS at the correct position.

enter image description here

\documentclass{article}
\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{flalign}
\makebox[2cm][r]{$\displaystyle A$} &= x^3 + 14789 & \\
B &= f^6
\end{flalign}
\noindent\rule{2cm}{1pt}
\end{document}

Only A is set in a 2cm block, since B is "short enough". Otherwise, you can set whatever in a 2cm box, regardless of the size.

showframe was used to identify the text block border.

share|improve this answer
1  
I've added a \displaystyle that can be relevant if the left hand side has exponents and in other cases. –  egreg Feb 20 '12 at 15:36

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.