1

I am trying to create enter image description here

but when I do I get this:

enter image description here

Here is my code:

\begin{align*}&\begin{matrix*}[l]%
x_8 = 93  &  y_8 = 64  &  z_8 = 61\\  
x_7 = 186  &  y_7 = 32 &  z_7 = 61\\
x_6 = 231  &  y_6 = 32  &  z_6 = 29\\
x_5 = 462 & y_5 = 16 & z_5 = 29\\
x_4 = 483 & y_4 = 16 & z_4 = 13\\
x_3 = 966 & y_3 = 8 & z_3 = 13\\
x_2 = 975 & y_2 = 8 & z_2 = 5\\
x_1 = 1950 & y_1 = 4 & z_1 = 5\\
x_0 = 1953 & y_0 = 4 & z_1 = 1
\end{matrix*}
\quad
&\begin{matrix*}[l]% 
x_5 = 65 & y_5 = 128 & z_5 = 1\\
x_4 = 130 & y_4 = 64 & z_4 = 1\\
x_3 = 260 & y_3 = 32 & z_3 = 1\\
x_2 = 520 & y_2 = 16 & z_2 = 1\\
x_1 = 1040 & y_1 = 8 & z_1 = 1\\
x_0 = 2080 & y_0 = 4 & z_0 = 1
\end{matrix*}
\end{align*}
  • Off-topic: It's bad practice to use an align* environment to generate (de facto) a single unnumbered display-math structure. Use \[ ... \] instead. – Mico Sep 2 '16 at 18:36
  • 1
    does the index (subscript) ever have a value >9 ? if so, how do you want the various pieces to be aligned? – barbara beeton Sep 2 '16 at 18:41
1

Here's a solution that uses two array environments. Observe that I've set the numbers to the right of each = symbol to be right-aligned; if you prefer left-alignment, just change

\begin{array}[t]{*{2}{r@{{}={}}r @{\quad}} r@{{}={}}r}

to

\begin{array}[t]{*{2}{r@{{}={}}l @{\quad}} r@{{}={}}l}

Or, if you prefer, use two aligned environments side-by-side, using [t] positioning specifiers. This approach entails making fewer modifications to the code you've posted in your query. However, it doesn't afford the option to right-align the numbers to the right of the = symbols.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\[  % Solution 1: Use two side-by-side 'array' environments
\renewcommand\arraystretch{1.25}
\begin{array}[t]{*{2}{r@{{}={}}r @{\quad}} r@{{}={}}r}
x_8 &   93 & y_8 & 64 & z_8 & 61\\  
x_7 &  186 & y_7 & 32 & z_7 & 61\\
x_6 &  231 & y_6 & 32 & z_6 & 29\\
x_5 &  462 & y_5 & 16 & z_5 & 29\\
x_4 &  483 & y_4 & 16 & z_4 & 13\\
x_3 &  966 & y_3 &  8 & z_3 & 13\\
x_2 &  975 & y_2 &  8 & z_2 &  5\\
x_1 & 1950 & y_1 &  4 & z_1 &  5\\
x_0 & 1953 & y_0 &  4 & z_1 &  1
\end{array}
\quad
\begin{array}[t]{*{2}{r@{{}={}}r @{\quad}} r@{{}={}}r}
x_5 &   65 & y_5 & 128 & z_5 & 1\\
x_4 &  130 & y_4 &  64 & z_4 & 1\\
x_3 &  260 & y_3 &  32 & z_3 & 1\\
x_2 &  520 & y_2 &  16 & z_2 & 1\\
x_1 & 1040 & y_1 &   8 & z_1 & 1\\
x_0 & 2080 & y_0 &   4 & z_0 & 1
\end{array}
\]

\[ % Solution 2: Use two side-by-side 'aligned' environments
\begin{aligned}[t]
x_8 &= 93  &  y_8 &= 64  &  z_8 &= 61\\  
x_7 &= 186  &  y_7 &= 32 &  z_7 &= 61\\
x_6 &= 231  &  y_6 &= 32  &  z_6 &= 29\\
x_5 &= 462 & y_5 &= 16 & z_5 &= 29\\
x_4 &= 483 & y_4 &= 16 & z_4 &= 13\\
x_3 &= 966 & y_3 &= 8 & z_3 &= 13\\
x_2 &= 975 & y_2 &= 8 & z_2 &= 5\\
x_1 &= 1950 & y_1 &= 4 & z_1 &= 5\\
x_0 &= 1953 & y_0 &= 4 & z_1 &= 1
\end{aligned}
\qquad
\begin{aligned}[t]
x_5 &= 65 & y_5 &= 128 & z_5 &= 1\\
x_4 &= 130 & y_4 &= 64 & z_4 &= 1\\
x_3 &= 260 & y_3 &= 32 & z_3 &= 1\\
x_2 &= 520 & y_2 &= 16 & z_2 &= 1\\
x_1 &= 1040 & y_1 &= 8 & z_1 &= 1\\
x_0 &= 2080 & y_0 &= 4 & z_0 &= 1
\end{aligned}
\]
\end{document}
0

Here are two possible codes:

\documentclass[12pt]{article}
\usepackage{fourier, erewhon} 
\usepackage{mathtools}

\begin{document}
\[ \begin{array}{lll@{\hskip 3em}lll}%
x_8 = 93  &  y_8 = 64  &  z_8 = 61  & x_5 = 65 & y_5 = 128 & z_5 = 1 \\
x_7 = 186  &  y_7 = 32 &  z_7 = 61 & x_4 = 130 & y_4 = 64 & z_4 = 1  \\
x_6 = 231  &  y_6 = 32  &  z_6 = 29  & x_3 = 260 & y_3 = 32 & z_3 = 1 \\
x_5 = 462 & y_5 = 16 & z_5 = 29  & x_2 = 520 & y_2 = 16 & z_2 = 1 \\
x_4 = 483 & y_4 = 16 & z_4 = 13 &x_1 = 1040 & y_1 = 8 & z_1 = 1  \\
x_3 = 966 & y_3 = 8 & z_3 = 13  & x_0 = 2080 & y_0 = 4 & z_0 = 1\\
x_2 = 975 & y_2 = 8 & z_2 = 5 \\
x_1 = 1950 & y_1 = 4 & z_1 = 5 \\
x_0 = 1953 & y_0 = 4 & z_0 = 1
\end{array}\]%


\begin{alignat*}{6}
x_8  &=  93  &\hskip 1.2em  y_8 & = 64  &\hskip 1.2em    z_8  &=  61  &\hskip 3em x_5  &=  65 &\hskip 1.2em   y_5  &=  128 & \hskip 1.2em  d z_5  &=  1 \\
x_7  &=  186  &  y_7 &=  32 &  z_7  &=  61 & x_4  &=  130 & y_4  &=  64 & z_4  &=  1  \\
x_6  &=  231  &  y_6  &=  32  &  z_6  &=  29  &  x_3  &=  260 & y_3  &=  32 & z_3  &=  1  \\
x_5 &=   462 & y_5 &=   16 & z_5 &=   29  & x_2 &=   520 & y_2 &=   16 & z_2 &=   1 \\
x_4 &=   483 & y_4 &=   16 & z_4 &=   13 &x_1 &=   1040 & y_1 &=   8 & z_1 &=   1  \\
x_3 &=   966 & y_3 &=   8 & z_3 &=   13  & x_0 &=   2080 & y_0 &=   4 & z_0 &=   1\\
x_2 &=   975 & y_2 &=   8 & z_2 &=   5 \\
x_1 &=   1950 & y_1 &=   4 & z_1 &=   5 \\
x_0 &=   1953 & y_0 &=   4 & z_0 &=   1
\end{alignat*}

\end{document} 

enter image description here

To have top alignment starting from you code, you can either add emty rows to the smaller matrix, or change matrix* into array and use the [t] optional argument:

\begin{align*}
&\begin{matrix*}[l]%
x_8 = 93  &  y_8 = 64  &  z_8 = 61\\
x_7 = 186  &  y_7 = 32 &  z_7 = 61\\
x_6 = 231  &  y_6 = 32  &  z_6 = 29\\
x_5 = 462 & y_5 = 16 & z_5 = 29\\
x_4 = 483 & y_4 = 16 & z_4 = 13\\
x_3 = 966 & y_3 = 8 & z_3 = 13\\
x_2 = 975 & y_2 = 8 & z_2 = 5\\
x_1 = 1950 & y_1 = 4 & z_1 = 5\\
x_0 = 1953 & y_0 = 4 & z_1 = 1
\end{matrix*}
&\begin{matrix*}[l]%
x_5 = 65 & y_5 = 128 & z_5 = 1\\
x_4 = 130 & y_4 = 64 & z_4 = 1\\
x_3 = 260 & y_3 = 32 & z_3 = 1\\
x_2 = 520 & y_2 = 16 & z_2 = 1\\
x_1 = 1040 & y_1 = 8 & z_1 = 1\\
x_0 = 2080 & y_0 = 4 & z_0 = 1\\
\\
\\
\\
\end{matrix*}
\end{align*}\\

\[ %
\begin{array}[t]{lll}%
x_8 = 93  &  y_8 = 64  &  z_8 = 61\\
x_7 = 186  &  y_7 = 32 &  z_7 = 61\\
x_6 = 231  &  y_6 = 32  &  z_6 = 29\\
x_5 = 462 & y_5 = 16 & z_5 = 29\\
x_4 = 483 & y_4 = 16 & z_4 = 13\\
x_3 = 966 & y_3 = 8 & z_3 = 13\\
x_2 = 975 & y_2 = 8 & z_2 = 5\\
x_1 = 1950 & y_1 = 4 & z_1 = 5\\
x_0 = 1953 & y_0 = 4 & z_1 = 1
\end{array}
\qquad%
\begin{array}[t]{lll}
x_5 = 65 & y_5 = 128 & z_5 = 1\\
x_4 = 130 & y_4 = 64 & z_4 = 1\\
x_3 = 260 & y_3 = 32 & z_3 = 1\\
x_2 = 520 & y_2 = 16 & z_2 = 1\\
x_1 = 1040 & y_1 = 8 & z_1 = 1\\
x_0 = 2080 & y_0 = 4 & z_0 = 1
\end{array}
 \]

enter image description here

  • I don't want to use alignat. Is there a way to do it by fixing my code? – user19405892 Sep 2 '16 at 18:16
  • I've added two variants with slight modifications of your code. – Bernard Sep 2 '16 at 18:46

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.