Goal
I want to align some equations separated by enumerate items, with :s lined up. The picture below is an example.
Since there are enumerate items between those equations, it might not be easy to adapt solutions using \intertext or breqn to solve my problem.
My attempt
I tried to define a command using \llap and \rlap, and it worked almost perfect:
\documentclass{article}
%\usepackage{lua-visual-debug}
\newcommand{\centersymbolalign}[2]{
\llap{$\displaystyle{#1}$}\rlap{$\displaystyle{#2}$}
}
\begin{document}
The set $G$, endowed with the binary operation $\circ$ (briefly, $(G,\circ)$, or simply $G$ if the operation can be understood) is a \textbf{group} if
\begin{enumerate}
\item the operation $\circ$ is \textbf{associative},
[
\centersymbolalign{(\forall,g,,h,,k \in G):}{\quad(g \circ h) \circ k = g \circ (h \circ k);}
]
\item there exists an \textbf{identity element} $e_G$ for $\circ$, that is,
[
\centersymbolalign{(\exists e_G \in G)(\forall g \in G):}{\quad g \circ e_G = g = e_G \circ g;}
]
\item every element in $G$ has an \textbf{inverse} with respect to $\circ$, that is,
[
\centersymbolalign{(\forall g \in G)(\exists h \in G):}{\quad g \circ h = e_G = h \circ g.}
]
\end{enumerate}
\end{document}
However, this caused a bug when the line above the equation is shorter than half of \textwidth: the extra space between texts and "displayed equations" disappeared.
\documentclass{article}
\usepackage{lua-visual-debug}
\newcommand{\centersymbolalign}[2]{
\llap{$\displaystyle{#1}$}\rlap{$\displaystyle{#2}$}
}
\begin{document}
\begin{itemize}
\item \textbf{normal equations}
\begin{enumerate}
\item short short short short short
[
(\forall,g,,h,,k \in G):\quad(\forall,g,,h,,k \in G);
]
\item long long long long long long long long
[
(\forall,g,,h,,k \in G):\quad(\forall,g,,h,,k \in G);
]
\end{enumerate}
\item \textbf{equations using} \verb|\llap|s
\begin{enumerate}
\item short short short short short
[
\centersymbolalign{(\forall,g,,h,,k \in G):}{\quad(\forall,g,,h,,k \in G);}
]
\item long long long long long long long long
[
\centersymbolalign{(\forall,g,,h,,k \in G):}{\quad(\forall,g,,h,,k \in G);}
]
\end{enumerate}
\end{itemize}
\end{document}
I assume that it was caused by two reasons:
- LaTeX smartly manages that extra space. When the left end of the displayed equation box is on the right of the end of the line above, there is no need to have that extra space.
- As the definition of
\llapsuggests, the equations using\llaps are only0ptwide.
Is there any way to fix this bug? Or is there another way to achieve my initial goal?




