6

Problem

The entry shows three matrices, one atop the other. Each matrix is made of three row vectors. Each row vector has three entries.

Question

How to present the problem so that the three columns of entries are right aligned?

Sample

The rightmost column is trivial. The center column is close. The first column is a disaster.

Code

\documentclass[]{article}
\usepackage{amsmath}

\newcommand{\mat}[2] {\left[\begin{array} {#1}#2 \end{array}\right]}
\newcommand{\ps}[0]  {\phantom{-}}

\begin{document}
%
\begin{equation*}
    \begin{array}{r}
            %
        \mat{r}{ 
        \frac{1}{\sqrt{30}} \mat{rrr}{\ps1 & \ps\ps2 & \ps5} \\ 
        \frac{1}{2\sqrt{6}} \mat{rrr}{\ps5 & \ps\ps0 & -1} \\ 
        \frac{1}{\sqrt{195}}\mat{rrr}{-1 & \ps13 & -5} }  \\[35pt]
            %
        \mat{r}{ 
        \frac{1}{\sqrt{30}} \mat{rrr}{-1 & \ps-2 & -5} \\ 
        \frac{1}{2\sqrt{6}} \mat{rrr}{-5 & \ps\ps0 & \ps1} \\ 
        \frac{1}{\sqrt{195}}\mat{rrr}{1 & -13 & \ps2} } \\[35pt]
            %
        \mat{r}{ 
        \frac{1}{\sqrt{30}} \mat{rrr}{i & \ps2i & 5i} \\ 
        \frac{1}{2\sqrt{6}} \mat{rrr}{5i & \ps0 & -i} \\ 
        \frac{1}{\sqrt{195}}\mat{rrr}{1 & -13 & \ps5} } 
            %
    \end{array}
%
\end{equation*}


\end{document}  

Output

enter image description here

Efforts so far

Efforts have involved failed experiments with phantom characters. One such iteration is shown above.

Related posts

Helpful, but could not glean solution.

Array within Align*

Alignment accross multiple arrays/vectors

Array alignment within align environment

3 Answers 3

3

Experiment with the various values: for the sake of the example, I set different ones for \extrarowheight in the three matrices.

\documentclass[]{article}
\usepackage{mathtools,array}

\newcommand{\rowvec}[2][]{%
  #1\big[ & #2 & \big]
}
\newenvironment{rowarray}[2][0pt]
 {%
  \setlength{\extrarowheight}{#1}%
  \array{@{} r @{} *{#2}{r} @{} l @{}}%
 }
 {\crcr\noalign{\kern\extrarowheight}\endarray}

\begin{document}

\begin{gather*}
\begin{bmatrix}
  \begin{rowarray}[3pt]{3}
  \rowvec[\frac{1}{\sqrt{30}}]{1 & 2 & 5} \\[\medskipamount]
  \rowvec[\frac{1}{2\sqrt{6}}]{5 & 0 & -1} \\[\medskipamount]
  \rowvec[\frac{1}{\sqrt{195}}]{-1 & 13 & -5}
  \end{rowarray}
\end{bmatrix}
\\
\begin{bmatrix}
  \begin{rowarray}[4pt]{3}
  \rowvec[\frac{1}{\sqrt{30}}]{-1 & -2 & -5} \\[\medskipamount]
  \rowvec[\frac{1}{2\sqrt{6}}]{-5 & 0 & 1} \\[\medskipamount]
  \rowvec[\frac{1}{\sqrt{195}}]{1 & -13 & 2}
  \end{rowarray}
\end{bmatrix}
\\
\begin{bmatrix}
  \begin{rowarray}[5pt]{3}
  \rowvec[\frac{1}{\sqrt{30}}]{i & 2i & 5i} \\[\medskipamount]
  \rowvec[\frac{1}{2\sqrt{6}}]{5i & 0 & -i} \\[\medskipamount]
  \rowvec[\frac{1}{\sqrt{195}}]{i & -13 & 5}
  \end{rowarray}
\end{bmatrix}
\end{gather*}

\end{document}  

enter image description here

5

Maybe like this?

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

\begin{document}
%
\begin{equation*}
    \begin{array}{r}
            %
        \begin{bmatrix*}[r]
        \frac{1}{\sqrt{30}} \bigl[\!\! & 1 & 2 & 5&\!\!\bigr] \\ 
        \frac{1}{2\sqrt{6}} \bigl[\!\! &5 & 0 & -1&\!\!\bigr] \\ 
        \frac{1}{\sqrt{195}}\bigl[\!\! &-1 & 13 & -5&\!\!\bigr] 
        \end{bmatrix*}  \\[35pt]
            %
        \begin{bmatrix*}[r] 
        \frac{1}{\sqrt{30}} \bigl[\!\! &-1 & -2 & -5&\!\!\bigr] \\ 
        \frac{1}{2\sqrt{6}} \bigl[\!\! &-5 & 0 & 1&\!\!\bigr] \\ 
        \frac{1}{\sqrt{195}}\bigl[\!\! &1 & -13 & 2&\!\!\bigr] 
        \end{bmatrix*}\\[35pt]
            %
        \begin{bmatrix*}[r]
        \frac{1}{\sqrt{30}} \bigl[\!\! &\mathrm{i} & 2\mathrm{i} & 5\mathrm{i}&\!\!\bigr] \\ 
        \frac{1}{2\sqrt{6}} \bigl[\!\! &5\mathrm{i} & 0 & -\mathrm{i}&\!\!\bigr] \\ 
        \frac{1}{\sqrt{195}}\bigl[\!\! &\mathrm{i} & -13 & 5&\!\!\bigr] 
        \end{bmatrix*} 
            %
    \end{array}
%
\end{equation*}


\end{document}  

enter image description here

4

A solution based on mathtools and bigdelim, which comes with multirow:

\documentclass[]{article}
\usepackage{mathtools}
\usepackage{array, bigdelim}


\begin{document}

\begin{gather*}
     \begin{bmatrix*}[r]
        \begin{array}{@{}r@{}rrr@{\,}r@{}}\\[-2ex]
         \ldelim[{1}{*}[$\smash{\frac{1}{\sqrt{30}}}$] & 1 & 2 & 5 & \rdelim]{1}{*} \\[1.5ex]
    %
      \ldelim[{1}{*}[$\smash{\frac{1}{2\sqrt{6}}}$] & 5 & 0 & -1 & \rdelim]{1}{*}\\[1.5ex]
    %
      \ldelim[{1}{*}[$\smash{\frac{1}{195}}$] & -1 & 13 & -5 & \rdelim]{1}{*}\\
     \end{array} \\[-2ex] \mbox{}
     \end{bmatrix*}
\\[3ex]
     \begin{bmatrix*}[r]
        \begin{array}{@{}r@{}rrr@{\,}r@{}}\\[-2ex]
         \ldelim[{1}{*}[$\smash{\frac{1}{\sqrt{30}}}$] & -1 & -2 & -5 & \rdelim]{1}{*} \\[1.5ex]
    %
      \ldelim[{1}{*}[$\smash{\frac{1}{2\sqrt{6}}}$] & -5 & 0 & 1 & \rdelim]{1}{*}\\[1.5ex]
    %
      \ldelim[{1}{*}[$\smash{\frac{1}{195}}$] & 1 & -13 & 5 & \rdelim]{1}{*}\\
     \end{array} \\[-2ex] \mbox{}
     \end{bmatrix*}
\\[3ex]
    \begin{bmatrix*}[r]
        \begin{array}{@{}r@{}rrr@{\,}r@{}}\\[-2ex]
         \ldelim[{1}{*}[$\smash{\frac{1}{\sqrt{30}}}$] & i & 2i & 5i & \rdelim]{1}{*} \\[1.5ex]
    %
      \ldelim[{1}{*}[$\smash{\frac{1}{2\sqrt{6}}}$] & 5i & 0 & -i & \rdelim]{1}{*}\\[1.5ex]
    %
      \ldelim[{1}{*}[$\smash{\frac{1}{195}}$] & 1 & -13 & 5 & \rdelim]{1}{*}\\
     \end{array} \\[-2ex] \mbox{}
     \end{bmatrix*}
\end{gather*}

\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 .