4

I've struggled to get my alignment look nice for quite a time now. After a lot of googling I have finally achieved almost what I want: long text on left, alignment good

Now the problem is the equation numbers (1 and 3 in the example), which are not vertically centered to the equations. Please help me getting them right! MWE:

\documentclass[12pt,a4paper]{article}
\usepackage{mathtools}
\usepackage{amsmath, amsfonts, amssymb, siunitx}

\begin{document}
\nocite{*}
\begin{alignat}{2}
  &\phantom{U_{\mathrm{HETKELLINEN}}}&f
  &= \frac{1}{T}\notag\\ 
  &\Leftrightarrow
  &T &=\frac{1}{f}=\SI{0,001}{\second}\\
%
  & &\hat{U}
  &= \sqrt{2} \cdot U = \SI{14,1421}{\volt}\\
%
  & &U_{\mathrm{HETKELLINEN}}
  &= \hat{U} \cdot \sqrt{2 \cdot \pi \cdot f \cdot t}\notag\\
  & & &= \SI{14,1421}{\volt} \cdot \sqrt{2 \cdot \pi \cdot \SI{1}{\kilo\hertz} \cdot \SI{0,0011}{\second}}\notag\\
  &&&= \SI{8,3125}{\volt}
\end{alignat}
\end{document}
  • Welcome. It is a rare case that somebody posts a working and minimal example to reproduce a problem. Unfortunately, i am not sure where you expect the numbers to be. Can you elaborate? – Johannes_B Feb 19 '17 at 10:17
  • Maybe this could help? tex.stackexchange.com/questions/13396/… – Philipp Imhof Feb 19 '17 at 10:22
  • @philipp-imhof No, that example doesn't help. Or at least I cannot make it work with that long left side text, it messes up the alignment between the equations. – msimila Feb 19 '17 at 11:01
5

You can use split:

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath, amssymb, siunitx}
\usepackage{mathtools}

\begin{document}

\begin{align}
\begin{split}
f &= \frac{1}{T}\\
\Leftrightarrow\hphantom{U_{\mathrm{HETKELLINEN}}}
 T &= \frac{1}{f}=\SI{0,001}{\second}
\end{split}
\\
%
\hat{U} &= \sqrt{2} \,U = \SI{14,1421}{\volt}\\
%
\begin{split}
U_{\mathrm{HETKELLINEN}}
  &= \hat{U} \sqrt{2\pi ft}\\
  &= \SI{14,1421}{\volt} \cdot \sqrt{2\pi \cdot \SI{1}{\kilo\hertz}
     \cdot \SI{0,0011}{\second}}\\
  &= \SI{8,3125}{\volt}
\end{split}
\end{align}
\end{document}

enter image description here

  • Thank you! Now equation 3 is numbered correctly, but 1 is not. I cannot get the split to work with equation 1. Is there some trick with that \Leftrightarrow? The line that makes problem in my code seems to be &\Leftrightarrow T &= \frac{1}{f} &=\SI{0,001}{\second} The equation number position is defined by my school, cannot change that. – msimila Feb 19 '17 at 10:55
  • @msimila Fixed as you wished – egreg Feb 19 '17 at 11:01
  • Thank you! Perfect! I messed up with the &-signs. So difficult to count to three.. ;) – msimila Feb 19 '17 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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