5

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?

3
  • 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}`
    – yannisl
    Feb 20, 2012 at 15:27
  • I would only use it in places where it does not cause trouble.
    – Matthias
    Feb 20, 2012 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.
    – yannisl
    Feb 20, 2012 at 15:29

1 Answer 1

3

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.

1
  • 1
    I've added a \displaystyle that can be relevant if the left hand side has exponents and in other cases.
    – egreg
    Feb 20, 2012 at 15:36

You must log in to answer this question.

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