0

Edit: Only after I researched and posed the question, another question answering most of my issue was recommended to me. The cdot-alignment issue is still one I'd like to find a solution to though.

I am using amsmaths alignat enviroment to align two seperate eqaul signs per line. In my example the result looks like this:

align enviroment with two aligned signs and leftbound unequally long equations inbetween them

As visible, everything inbetween the equal signs is aligned to the left. The code is as follows:

\documentclass{article}
\usepackage{siunitx}
\sisetup{
    locale = DE,
    mode=match
} 
\usepackage{amsmath}
\begin{document}
\begin{alignat}{2}
        \overline{R_{Al_{4P}}}  &=  \overline{\left[\frac{U_{Al_{4P}}}{I_{Al_{4P}}}\right]} &&=\SI{9,345E+00}{\ohm}\\
    \intertext{bzw.}
        \overline{R_{Al_{2P}}}  &=  \overline{\left[\frac{U_{Al_{2P}}}{I_{Al_{2P}}}\right]} &&=\SI{2,407E+01}{\ohm}\\
    \intertext{Somit errechnen sich $R_S$ und $\rho$ zu}
        R_{S_{Al_{4P}}}         &=  \overline{R_{Al_{4P}}} \cdot \frac{b}{l_s}              &&=\SI{2,804E-06}{\ohm}\\
        \rho_{Al_{4P}}          &=  R_{S_{Al_{4P}}} \cdot d                                 &&=\SI{4,205E-13}{\ohm\meter}\\
    \intertext{bzw.}
        R_{S_{Al_{2P}}}         &=  \overline{R_{Al_{2P}}} \cdot \frac{b}{l_m}              &&=\SI{1,107E-05}{\ohm}\\
        \rho_{Al_{2P}}          &=  R_{S_{Al_{4P}}} \cdot d                                 &&=\SI{1,661E-12}{\ohm\meter}
    \intertext{longtext}
        Q_{2P4P_{Al}}           &=\frac{R_{S_{Al_{2P}}}}{R_{S_{Al_{4P}}}}                   &&=\SI{3,949}{}
\end{alignat}
\end{document}

Is there a way to make the terms inbetween the aligned = signs centered inbetween them, so that spacing to both = signs is equal? Especially the spacing for the fractions in the first two and the last equation look off aligned to the left.

Not part of the main question and less relevant, but is it also possible to align the cdots of only the equations that use them, while keeping all the = signs aligned?

2
  • Welcome to TeX.SE.
    – Mico
    Commented Jul 14, 2023 at 18:12
  • Off-topic: \SI{3,949}{} may be expressed more compactly as \num{3,949}.
    – Mico
    Commented Jul 14, 2023 at 18:12

1 Answer 1

1

You can use IEEEeqnarray, with a couple of tweaks that make it possible to use \shortintertext and \intertext inside it.

We want an alignment like rCcCl (right aligned, relation center aligned, center aligned, relation centeraligned, left aligned).

\documentclass{article}
\usepackage{siunitx}
\usepackage{mathtools}
\usepackage{IEEEtrantools}

\sisetup{
  locale = DE,
  mode=match
}

% allow using \intertext and \shortintertext in IEEEeqnarray
\makeatletter
\AtBeginEnvironment{IEEEeqnarray}{%
  \csname MT_intertext:\endcsname
  \let\shortintertext\shortintertext@
}
\makeatother

\begin{document}
\begin{IEEEeqnarray}{rCcCl}
  \overline{R_{Al_{4P}}}  &=& \overline{\left[\frac{U_{Al_{4P}}}{I_{Al_{4P}}}\right]} 
    &=& \qty{9,345E+00}{\ohm}
\shortintertext{bzw.}
  \overline{R_{Al_{2P}}}  &=& \overline{\left[\frac{U_{Al_{2P}}}{I_{Al_{2P}}}\right]}
    &=& \qty{2,407E+01}{\ohm} \\
\intertext{Somit errechnen sich $R_S$ und $\rho$ zu}
  R_{S_{Al_{4P}}}         &=& \overline{R_{Al_{4P}}} \cdot \frac{b}{l_s}
    &=& \qty{2,804E-06}{\ohm} \\
  \rho_{Al_{4P}}          &=& R_{S_{Al_{4P}}} \cdot d
    &=& \qty{4,205E-13}{\ohm\meter} \\
\shortintertext{bzw.}
  R_{S_{Al_{2P}}}         &=& \overline{R_{Al_{2P}}} \cdot \frac{b}{l_m}
    &=& \qty{1,107E-05}{\ohm} \\
  \rho_{Al_{2P}}          &=& R_{S_{Al_{4P}}} \cdot d
    &=& \qty{1,661E-12}{\ohm\meter} \\
\intertext{longtext}
  Q_{2P4P_{Al}}           &=& \frac{R_{S_{Al_{2P}}}}{R_{S_{Al_{4P}}}}
    &=& \num{3,949}
\end{IEEEeqnarray}

\end{document}

For the “bzw.” lines it's better to use \shortintertext, not for the longer lines.

enter image description here

Note that \SI is to be considered obsolete and that \qty should be used, unless you're also loading physics. For dimensionless numbers \qty{<number>}{} is wrong and should be \num{<number>}.

You must log in to answer this question.

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