3

I am using alignat environment to align a set of equations which practically describe the same thing, but for different quantities. Therefore I decided to skip the common things and replace them with \cdots, however I don't seem to be able to align them in the center.

enter image description here

Any idea to center the dots?

A sample code follows

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{4}
  &\sigma(E) &=& \vec{\sigma(E)} = \big\{\sigma(E_1), \sigma(E_2), \cdots, \sigma(E_n)\big\} &=&  \big\{\sigma_1, \sigma_2, \cdots, \sigma_n\big\}&\\
 &C(E) &=&{\cdots}&=&  \big\{C_1, C_2, \cdots, C_n\big\}&\\
\end{alignat*}

\end{document}
5
  • not directly releated, but don't use &=& in AMS environments, just &= Mar 9, 2019 at 15:55
  • @DavidCarlisle : Thank you very much for your comment and advice! But why not?
    – Thanos
    Mar 9, 2019 at 15:57
  • it doesn't work, as you see in the image you posted the = has lost its relation spacing as the &=& has made it lose the expression on the right. Mar 9, 2019 at 16:00
  • @DavidCarlisle Oh, I see! Thank you very much for the explanation!
    – Thanos
    Mar 9, 2019 at 16:08
  • Are you sure about \vec{\sigma(E)}?
    – egreg
    Mar 9, 2019 at 16:12

3 Answers 3

2

You can result to low level TeX with the \omit to break out of the current formatting:

Sample output

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2}
  \sigma(E) &={}& \vec{\sigma(E)}
  = \bigl\{\sigma(E_1), \sigma(E_2), \dots, \sigma(E_n)\bigr\}
  &= \bigl\{\sigma_1, \sigma_2, \dots, \sigma_n\bigr\}\\
  C(E) &={}&\omit\hfill$\cdots$\hfill
  &= \bigl\{C_1, C_2, \dots, C_n\bigr\}
\end{alignat*}

\end{document}

Note I have also added groups {} to get correct spacing at the equals signs, and use \bigl...\bigr instead of \big. Also between commas you should just use \dots (or \dotsc).

Be careful here with the use of the ampersands &. In alignat, the alignment is implicitly rlrl... with the first group right aligned, the second left aligned, etc.

0
3

A solution with the eqparbox package. Note that 2 alignment columns are enough.

\documentclass{article}
\usepackage{amsmath}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[2][M]{\eqmakebox[#1]{$\displaystyle#2$}}

\begin{document}

\begin{alignat*}{2}
  \sigma(E) &= {}& \eqmathbox{\vec{\sigma(E)} = \big\{\sigma(E_1), \sigma(E_2), \cdots, \sigma(E_n)\big\}} &= \big\{\sigma_1, \sigma_2, \cdots, \sigma_n\big\}\\
 C(E) &= {}& \eqmathbox{\cdots\cdots}&= \big\{C_1, C_2, \cdots, C_n\big\}\\
\end{alignat*}

\end{document} 

enter image description here

3

array is not made for aligning equations, but in this case, with a couple of tricks (@{} and {} where we want a correct spacing after/before the first/last equal sign), it may be convenient.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
\[
\begin{array}{r@{}c@{}l}
  \sigma(E) ={} & \vec{\sigma(E)} = \big\{\sigma(E_1), \sigma(E_2), \cdots, \sigma(E_n)\big\} & {}= \big\{\sigma_1, \sigma_2, \cdots, \sigma_n\big\}\\
 C(E) ={} &\cdots& {}=  \big\{C_1, C_2, \cdots, C_n\big\}\\
\end{array}
\]
\end{document}

enter image description here

You must log in to answer this question.

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