6

Currently I have a matrix like this:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
  \nabla\Psi \times \mathbf{\hat{\theta}} / r
  =
  \begin{pmatrix}
    \frac{\partial \Psi}{\partial r} \\
    0 \\
    \frac{\partial \Psi}{\partial z} \\
  \end{pmatrix}
  \times 
  \begin{pmatrix}
    0   \\
    1/r \\
    0   \\
  \end{pmatrix}
\end{equation*}

\end{document}

and this is what it looks like:

enter image description here

The matrix elements seem to be compressed vertically slightly because they are partial differentiations and therefore quite large. Is there any way to increase the size of the matrix elements vertically so they don't seem as compressed? I have looked around online.

alexwlchan
  • 5,417
Stefan
  • 61

3 Answers3

4

I also used \dfrac:

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

\begin{equation*}
  \nabla\Psi \times \mathbf{\hat{\theta}} / r
  =\def\arraystretch{2}%%%%%%%%%%  change the value to whatever you want
  \begin{pmatrix}
    \dfrac{\partial \Psi}{\partial r} \\
    0 \\
    \dfrac{\partial \Psi}{\partial z} \\
  \end{pmatrix}
  \times 
  \begin{pmatrix}
    0   \\
    1/r \\
    0   \\
  \end{pmatrix}
\end{equation*}

\end{document}

enter image description here

1

Here's one way, using a \parenMatrixstack{} instead of a pmatrix:

\documentclass{article}
\usepackage{tabstackengine}
\begin{document}
\[
\setstackgap{L}{2\baselineskip}
\nabla\Psi \times\mathbf{\hat{\theta}}/r =
\parenMatrixstack{
\displaystyle\frac{\partial \Psi}{\partial r}\\
0\\
\displaystyle\frac{\partial \Psi}{\partial z}
} \times 
\parenMatrixstack{%
0\\
1/r\\
0
}
\]
\end{document}

enter image description here

If you want the vertical paren sizes to match, then a few \vphantoms will help:

\documentclass{article}
\usepackage{tabstackengine}
\begin{document}
\[
\setstackgap{L}{2\baselineskip}
\nabla\Psi \times\mathbf{\hat{\theta}}/r =
\parenVectorstack{
\displaystyle\frac{\partial \Psi}{\partial r}\\
0\\
\displaystyle\frac{\partial \Psi}{\partial z}
} \times 
\parenVectorstack{%
0\vphantom{\displaystyle\frac{0}{0}}\\
1/r\\
0\vphantom{\displaystyle\frac{0}{0}}
}
\]
\end{document}

enter image description here

  • Thanks, I seem to be having issues installing tabstackengine though. As far as I can tell it's a relatively new package, but I can't add packages directly to the program files MikTex since I'm on school computers. – Stefan Mar 06 '14 at 13:53
  • @stefan You can always just place the .sty file in your current working directory. It is available at http://ctan.org/pkg/tabstackengine (i.e., http://ctan.org/tex-archive/macros/latex/contrib/tabstackengine) – Steven B. Segletes Mar 06 '14 at 13:58
1

Here is another possible solution:

\documentclass{article}

\usepackage{amsmath}

\newcommand*\diffPart[3][\partial]{\frac{#1#2}{#1#3}}

\begin{document}

\renewcommand*\arraystretch{1.2}% change value according to need
\begin{equation*}
  \nabla\Psi \times \mathbf{\hat{\theta}}/r
  =
  {\mkern -5mu}
  \begin{pmatrix}
    \diffPart{\Psi}{r} \\
    0                  \\
    \diffPart{\Psi}{z}
  \end{pmatrix}
  {\mkern -7mu}
  \times
  {\mkern -7mu}
  \begin{pmatrix}
    0   \\
    1/r \\
    0
  \end{pmatrix}
  {\mkern -5mu}
\end{equation*}

\end{document}

output

Notes

  • You don't need \\ at the end of the last line in each matrix.

  • The distance between the elements in the vectors is determined by \arraystretch.

  • The spacing surrounding the matrices are shrunk using \mkern.

  • The {\mkern -5mu} after the last matrix can't be seen dirctly in the output but it makes the equation centered instead of being pushed slightly to the left.