I would like to format equations in a very particular way, the desired result would be:
f(x) = 42 (1)
g_something(x) = 0 (2)
- the function names are left aligned (but the entire equations remain floating, and there is no extensive stretch)
- the equations are numbered (reason against
arrayas there is no easy way to add the numbers* - the numbers are right aligned to align decimal places (Bonus since currently not an issue)
Below you find a MWE with the basic equation and me trying to achieve my alignment by adding additional &
MWE:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
f(x) &= 42 \\
g_{\text{something}}(x) &= 1
\end{align}
%incorrect alignment of parts
\begin{align}
&f(x) &= 42& \\
&g_{\text{something}}(x) &= 1&
\end{align}
%too much spacing
\begin{align}
&f(x) &=&& 42& \\
&g_{\text{something}}(x) &=&& 1&
\end{align}
\end{document}
I believe neither fleqn nor nccmath solve my issue. I came across nccmath in this answer however, the = signs are missaligned in that answer.
* (if I understand the answer correctly)


\textshould never be used to make something upright like you are doing here. It will be italic under the right circumstances, use something like\textupinstead. This is a very common mistake. – daleif Aug 30 '18 at 19:05\textit{gggg $\text{A} $ bbb}, here A comes out italic. For something like this you want a solution that always works, that is always upright. – daleif Aug 30 '18 at 20:06\textcan be fine but one has to be aware of the drawback you pointed out. – ted Aug 31 '18 at 13:27\text{Var}(X), again this is not a textual comment. it is a math operator and should be treated as such. – daleif Aug 31 '18 at 13:46