# centering / aligning arbitrary amsmath objects

See how the little ^\frown symbols are aligned (on the last 3 lines) ?
That's what I want.

But see how it's just a concatenation symbol for (C_\alpha) (Cα) and (C_\beta) (Cβ) ?
I want to make that obvious, so I want to push both halves out to the sides (see the second image).

\documentclass[preview,border=2mm]{standalone}
\usepackage{amsmath}
\providecommand{\abs}[1]{\lvert#1\rvert}

\begin{document}

$$C=E_k(m)$$
\begin{align*}
C_\alpha = & (E_k(m) \oplus m) & C_\beta = & (E_k(m) \oplus 1^{\abs{C}}) \\
C_\alpha = & (C      \oplus m) & C_\beta = & (C      \oplus 1^{\abs{C}}) %%
\end{align*}

$$C_\omega = (C_\alpha) ^\frown (C_\beta)\ \$$
\begin{align*}
C_\omega = (E_k(m) \oplus m) & ^\frown (E_k(m) \oplus 1^{|C|}) \\
C_\omega = (C      \oplus m) & ^\frown (C      \oplus 1^{|C|}) %%
\end{align*}

\end{document}


Like this, but with the symbol back in it's original spot in the middle.

\documentclass[preview,border=2mm]{standalone}
\usepackage{amsmath}
\providecommand{\abs}[1]{\lvert#1\rvert}

\begin{document}

$$C=E_k(m)$$
\begin{align*}
C_\alpha = & (E_k(m) \oplus m) & C_\beta = & (E_k(m) \oplus 1^{\abs{C}}) \\
C_\alpha = & (C      \oplus m) & C_\beta = & (C      \oplus 1^{\abs{C}}) %%
\end{align*}

$$C_\Omega = (C_\alpha) ^\frown (C_\beta)\ \$$
\begin{align*}
C_\Omega = & (E_k(m) \oplus m) & ^\frown & (E_k(m) \oplus 1^{|C|}) \\
C_\Omega = & (C      \oplus m) & ^\frown & (C      \oplus 1^{|C|}) %%
\end{align*}

\end{document}


If I could keep it all in the same environment that would also be good, rather than calling \begin{align*} ... \end{align*} and $$...$$ twice separately.

Although I would not recommend the desired output, one way to do this is to use alignat. A slightly better (IMO) is the second version and third version:

## Notes

• Don't use $$ for display math. See Why is $…$ preferable to$$ … ?.
• I think it is a good idea to define \FrownOp (perhaps with a more meaningful name) as a binary operator

## Code

\documentclass[preview,border=2mm]{standalone}
\usepackage{mathtools}% <-- includes amsmath
\providecommand{\abs}[1]{\lvert#1\rvert}
\newcommand*{\FrownOp}{\mathbin{^\frown}}%

\begin{document}
\begin{alignat*}{4}
&       &      C &= E_k(m) \\
C_\alpha &=  (E_k(m) \oplus m) &\qquad &          &C_\beta &=  (E_k(m) \oplus 1^{\abs{C}}) \\
C_\alpha &=  (C      \oplus m) &\qquad &          &C_\beta &=  (C      \oplus 1^{\abs{C}}) \\
&     &C_\Omega = (C_\alpha)  &\FrownOp (C_\beta) \\
C_\Omega &=  (E_k(m) \oplus m) &\qquad &\FrownOp  &&(E_k(m) \oplus 1^{|C|}) \\
C_\Omega &=  (C      \oplus m) &\qquad &\FrownOp  &&(C      \oplus 1^{|C|}) %%
\end{alignat*}
\textbf{Alternative suggestion 1:}
\begin{alignat*}{4}
&                     & \mathllap{C} &= E_k(m) \\
C_\alpha &=  (E_k(m) \oplus m) & & &  C_\beta &= (E_k(m) \oplus 1^{\abs{C}}) \\
&=  (C      \oplus m) & & &          &= (C      \oplus 1^{\abs{C}}) \\
\shortintertext{Thus,}
C_\Omega &= (C_\alpha)        &&\FrownOp (C_\beta) \\
&= (E_k(m) \oplus m) &&\FrownOp (E_k(m) \oplus 1^{|C|}) \\
&= (C      \oplus m) &&\FrownOp (C      \oplus 1^{|C|}) %%
\end{alignat*}
\textbf{Alternative suggestion 2:}
\begin{alignat*}{4}
C &= E_k(m) \\
\shortintertext{Thus,}
C_\Omega &= (C_\alpha) \FrownOp (C_\beta), \\
\shortintertext{where}
C_\alpha &= (E_k(m) \oplus m)           &&=  (C \oplus m) \\
C_\beta  &= (E_k(m) \oplus 1^{\abs{C}}) &&=  (C \oplus 1^{\abs{C}}).
\end{alignat*}
\end{document}

• Thanks. Why do you recommend against the desired output? Can you show a better alternative? I wasn't 100% sure on it either, but thought it would be easier for the reader to follow. But maybe your preference is more suitable. – voices May 16 '19 at 1:21
• @tjt263: See revised version with what I think is a slightly better alternative display. – Peter Grill May 16 '19 at 1:41
• @tjt263: Without understanding the actual context it is hard to give alternatives. I added one more option. Hopefully one of those work for you. – Peter Grill May 16 '19 at 3:30
• Multiple variations make for an effective answer – voices Aug 5 '19 at 8:08