5

Here is the output I need:

Matrix equation

The closest I could get is this:

\begin{equation*}
  \begin{bmatrix}
    & \\
   v & \\
    & \\
  \end{bmatrix}
  \begin{bmatrix}
   w &  \\
  \end{bmatrix}
\end{equation*}

Which outputs this:

bad output

But you can see there are obvious differences that I need:

  1. v and w which are center-aligned inside the brackets.
  2. The first matrix is a column matrix, and the second one is a row matrix and is located on the upper right side of the first matrix.

By "simple LaTeX tools" I mean preferably not using any special package, as I need the code in a Jupyter Notebook.

For your information, I also used MathPix, but it couldn't recognize the details I wanted.

3
  • 1
    Welcome to TeX.SE. A theme I notice in the answers is that they've deleted your &. This was causing your left-alignment and wasn't really necessary to begin with. – Teepeemm Nov 14 '20 at 17:56
  • @Teepeemm Hello! Thank you for the tip. Yes, that solves the left-alignment problem. But shifting the second matrix upwards would still be a problem, and I could solve it with the help of the accepted answer. – Arash Ashrafzadeh Nov 14 '20 at 18:23
  • The simplest solution is \begin{bmatrix}\\v\\\\\end{bmatrix}^{\begin{bmatrix}w\end{bmatrix}} - this also works perfectly in MathJax, which is how Jupyter notebooks typeset LaTeX. – vikarjramun Nov 14 '20 at 21:15
8

Nest the second bmatrix as the first element of a matrix environment and add to the latter two empty rows:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
  \begin{bmatrix}
     \\
   \; v\; \\
     \\
  \end{bmatrix}\!\!
\begin{matrix}
  \begin{bmatrix}
  \; w\; \\
  \end{bmatrix}
 \\{}\\ {}
\end{matrix}
\end{equation*}

\end{document} 

enter image description here

6

Let TeX do the computations.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
A=
\vcenter{\hbox{\valign{\hbox{$#$}\vfil\cr
  \begin{bmatrix} \mbox{} \\ \quad v \quad  \\ \mbox{} \end{bmatrix} \cr
  \begin{bmatrix} \quad w \quad \end{bmatrix} \cr
}}}
\end{equation*}

\end{document}

enter image description here

2

Perhaps nesting array-environments and \vphantom in some places does the trick—but I assume there are much better solutions.

\documentclass{article}
\usepackage{array}

\begin{document}
$A=\left[%
     \begin{array}{c}%
       {\vphantom{\left[\begin{array}{c}w\end{array}\right]}}\\
       {v}\\
       {\vphantom{\left[\begin{array}{c}w\end{array}\right]}}\\
     \end{array}%
   \right]\mathclose{}\  %
   \kern-\arraycolsep
   \begingroup
   % Adjust \arraycolsep to regulate the horizontal gaps between "[" and "w" and "]"
   \arraycolsep=1\arraycolsep\relax
   \kern-\arraycolsep
   \begin{array}{c}%
     {\mathopen{}\left[\begin{array}{c}w\end{array}\right]}\\
     {\vphantom{v}}\\
     {\vphantom{\left[\begin{array}{c}w\end{array}\right]}}\\
   \end{array}\kern-\arraycolsep\endgroup=A$
\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.