1

In my document I have quite a few mathematical formulas, which I use the amsmath package to represent.
I would like a representation in which all formulas that are on one page are aligned with the equal sign.
With the use of "align" only successive formals are aligned.
Therefore I found the following possibility in my research:

\documentclass{article}
\usepackage{blindtext}

\usepackage[fleqn]{amsmath}

\setlength{\mathindent}{3em}

\newcommand*{\ml}[1]{%
  \llap{$\displaystyle#1$}%
}

\begin{document}
\section{section}
\blindtext
\begin{gather*}
  \ml{a} = b + c + d\\
  {} + e + f + g
\intertext{\blindtext}
  \ml{k} = l + m + n + m + n + m + n\\
  {} + o + p + q\\
  \ml{r +d s} = t + u
\end{gather*}
\subsection{subsection} 
\blindtext
\end{document}

The result is, at least in the short example, exactly how it should be. But what bothers me is the fact that it is necessary to use "\ intertext {}" for all paragraphs and to change the syntax of the formula. (\ ml {x} = ...)
This makes it difficult for people with little LaTeX experience to understand the structure of the text and the formulas.
Furthermore, I need the possibility to reference individual formulas with numbers (\ label {formula-1})

Is there still a way to align all formulas on one page to the equal sign without changing the text and the formulas?
In principle, it should be sufficient if the equals sign is recognized in formulas and this is then left-aligned with a defined distance.

Many thanks for your help.

Kolja

5
  • 1
    Since you use \llap (you should really be using \mathllap from mathtools), the alignment point is set by \setlength{\mathindent}{3em}. Is this what you want or do you want all equal signs aligned without \llap? If so, you could use eqparbox with the identifier depending on the page.
    – user194703
    Jun 17 '20 at 6:42
  • why do you need to place all paras in \intertext as you are setting everything flush left, but indented, I don't see why you can't start and stop the math displays as normal) Jun 17 '20 at 11:14
  • 1
    why do you want this by the way? It is likely to disturb readers if they see a small a=b on page 1 offset because somewhere on page 20 there is an equation with a large left hand side and you need the = to be aligned Jun 17 '20 at 11:16
  • you are mis-using gather here, as that is for separate equations with no alignment you should be using align (and &=) to mark alignment points if you want alignment and/or multline for your long single expression wrapped over more than one line. Jun 17 '20 at 11:18
  • >why do you want this by the way? You`re right, now it works but i dont like it. But i will still use \mathindent, so that the formulars are not centered, but has a left aligement.
    – kolja
    Jun 18 '20 at 4:41
0

just for the record:

\documentclass{article}
\usepackage{blindtext}


\usepackage[fleqn]{amsmath}
\usepackage{etoolbox}
\setlength\mathindent{3cm}
\makeatletter

\def\align@preamble{%
  &\hfil
    \strut@
    \setboxz@h{\@lign$\m@th\displaystyle{##}$}%
    \ifmeasuring@\savefieldlength@\fi
    \llap{\set@field}%
    \tabskip\z@skip
  &\setboxz@h{\@lign$\m@th\displaystyle{{}##}$}%
    \ifmeasuring@\savefieldlength@\fi
    \rlap{\set@field}
    \hfil
    \tabskip\alignsep@
}

 
\begin{document}

\section{Section1}
\blindtext


\begin{align}
u_{X_{Y}, \, gtr} &= \sqrt{ \sum_{i=1}^{N}{ u_{X_{i}, \, sto}^{ 2 } } }
\end{align} 


\blindtext 


\begin{align}
u_{X_{Y}, \, wer} &=  \sum_{i=1}^{N}{ u_{X_{i}, \, fdf}  } 
\end{align} 


\blindtext


\begin{align}\label{eq:formx}
u_{ Q_{ X }, \, dedxe } &= \sqrt{ u_{ Q_{ fee }, \, sto}^{ 2 } + u_{ Q_{ Summe }, \, fgr}^{ 2 } }
\end{align} 


\blindtext


\begin{align} 
u_{ S_,wer } &= \sqrt{ u_{ X_,sto }^{ 2 } + u_{ Y_,sto }^{ 2 }} \label{eq:form0} \\
u_{ P_,wer } &= \sqrt{ \left( X \cdot u_{ Y_,ggt } \right)^{ 2 } + \left( Y \cdot u_{ X_,frg } \right)^{ 2 }} \label{eq:form1}
\end{align} 


\end{document}

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.