4

I have the following equation:

\begin{align}
\begin{split}
     &\phantom{{}={}} [ (1,1,1) : (1,1) : (1,2) : (1) : (2,2,2) : (2,2) : (2) :  (3) ] \\
     \textsc{one} &= [ 0 : 3 : 0 : 0 : 0 : 0 : 0 : 0 ] \\
     \textsc{two} &= [ 1 : 0 : 3 : 0 : -1 : 0 : 0 : 0 ] \\
     \textsc{three} &= [ 0  : 0 : 3 : 0 : -1 : 0 : 0 : 0 ] \\
\end{split}
\end{align}
\end{document}

I would like to have the opening [, each :, and closing ] aligned vertically to match the top row.

I have tried various combinations of align, alignat, equation, alignedat, but I am unable to find anything that works.

Any pointer would be appreciated.

I tried the alignedat from other answers:

\begin{equation}
    \begin{alignedat}{9}
     &[ (1,1,1) &: (1,1) &: (1,2) &: (1) &: (2,2,2) &: (2,2) &: (2) &:  (3) & & ] \\
     \textsc{one} = &[ 0 &: 3 &: 0 &: 0 &: 0 &: 0 &: 0 &: 0 & &] \\
     \textsc{two} = &[ 1 &: 0 &: 3 &: 0 &: -1 &: 0 &: 0 &: 0 & & ] \\
     \textsc{three} = &[ 0  &: 0 &: 3 &: 0 &: -1 &: 0 &: 0 &: 0 & &] \\
\end{alignedat}
\end{equation}

but it doesn't actually seem to do the alignment (only aligns some :'s).

enter image description here

  • 1
    Number of & should be 2x9-1 on each line. 9 & to mark alignments and 8 & to mark the separation between alignment columns (and alignment column is two columns with and alignment & between them). See it as a large table where the columns are grouped into pairs. In your case you can probably get by using && in many places as the corresponding left part of those alignment columns are empty – daleif Jan 24 '17 at 17:00
3

You can use autoaligne:

\documentclass{article}
\usepackage{amsmath}
\usepackage{autoaligne}

\begin{document}

\begin{equation}
\definirseparateurs{\\}{}{:||[||]}
\autoaligne[*d]{
                  [\, (1,1,1) : (1,1) : (1,2) : (1) : (2,2,2) : (2,2) : (2) :  (3) \,] \\
\textsc{one}={}   [\, 0 : 3 : 0 : 0 : 0 : 0 : 0 : 0 \,] \\
\textsc{two}={}   [\, 1 : 0 : 3 : 0 : -1 : 0 : 0 : 0 \,] \\
\textsc{three}={} [\, 0  : 0 : 3 : 0 : -1 : 0 : 0 : 0 \,]
}
\end{equation}

\begin{equation}
\definirseparateurs{\\}{}{:||[||]}
\autoaligne[*c]{
                        [\, (1,1,1) : (1,1) : (1,2) : (1) : (2,2,2) : (2,2) : (2) :  (3) \,] \\
\hfill\textsc{one}={}   [\, 0 : 3 : 0 : 0 : 0 : 0 : 0 : 0 \,] \\
\hfill\textsc{two}={}   [\, 1 : 0 : 3 : 0 : -1 : 0 : 0 : 0 \,] \\
\hfill\textsc{three}={} [\, 0  : 0 : 3 : 0 : -1 : 0 : 0 : 0 \,]
}
\end{equation}

\end{document}

enter image description here

  • I like this one the best, but you mention in another question that it is quite a new package. If it cannot be used in arXiv submissions I think that rules it out for me - plus I couldn't find any English documentation. Is there any way to get them centered like in (2) but in a arXiv compatible way? – robince Jan 25 '17 at 9:28
2

I'd use an array

enter image description here

\documentclass{article}

\usepackage{amsmath,array}


\begin{document}

\begin{equation}
    \begin{array}{r<{{}}@{[}r@{:}r@{:}r@{:}r@{:}r@{:}r@{:}r@{:}r@{]}}
     & (1,1,1) & (1,1) & (1,2) & (1) & (2,2,2) & (2,2) & (2) &  (3) \\
     \textsc{one} = & 0 & 3 & 0 & 0 & 0 & 0 & 0 & 0   \\
     \textsc{two} = & 1 & 0 & 3 & 0 & -1 & 0 & 0 & 0   \\
     \textsc{three} = & 0  & 0 & 3 & 0 & -1 & 0 & 0 & 0  \\
\end{array}
\end{equation}
\end{document}
2

Here is a correct code with alignedat:

\documentclass[]{article}
\usepackage{mathtools}
\begin{document}

\begin{equation}
    \begin{alignedat}{9}
     &[ (1,1,1) & & : (1,1) & & : (1,2) & & : (1) & & : (2,2,2) & & : (2,2) & & : (2) & & : (3) & & ] \\
     \textsc{one} = {}&[ 0 & & : 3 & & : 0 & & : 0 & & : 0 & & : 0 & & : 0 & & : 0 & &] \\
     \textsc{two} = {}&[ 1 & & : 0 & & : 3 & & : 0 & & : -1 & & : 0 & & : 0 & & : 0 & & ] \\
     \textsc{three} = {}&[ 0 & & : 0 & & : 3 & & : 0 & &: -1 & & : 0 & & : 0 & & : 0 & &] \\
\end{alignedat}
\end{equation}

\end{document} 

enter image description here

2

Here is a TABstack.

\documentclass[12pt]{article}
\usepackage{tabstackengine,amsmath}
\begin{document}
\begin{equation}
    \setstacktabbedgap{3pt}
    \tabbedCenterstack[r]{
     [& (1,1,1) :& (1,1) :& (1,2) :& (1) :& (2,2,2) :& (2,2) :& (2) :&  (3) & ] \\
     \textsc{one} = [& 0 :& 3 :& 0 :& 0 :& 0 :& 0 :& 0 :& 0 &] \\
     \textsc{two} = [& 1 :& 0 :& 3 :& 0 :& -1 :& 0 :& 0 :& 0 & ] \\
     \textsc{three} = [& 0  :& 0 :& 3 :& 0 :& -1 :& 0 :& 0 :& 0 &]
}
\end{equation}
\end{document}

enter image description here

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.