2

I am noticing an odd problem with LaTeX that causes matrices and arrays that I compile to have a whitespace gap at the top of the array. When I use the same code as others online, I produce different results. I suspect this may be an adverse consequence of packages I have installed, but I am not sure where to begin.

I would post a picture, but I was rejected by this website from posting an image....

\begin{equation}
\setlength{\extrarowheight}{0.3cm}
\label{objective}
\left[
\begin {array}{ccc}
9&13&17\\
\noalign{\medskip}
14&18&22
\end {array}
\right]
\end{equation}

The post on vertical asymmetric size variation for parentheses does not solve this issue, though it does allow me to create whitespace at the bottom also. However, this does not eliminate the undesired whitespace gap at the top.


I solved my problem. Maybe it serves as an additional answer to the related questions on this site.

Using the \arraystretch command is an easy way to tune the vertical whitespace in arrays. The following code is an example.

\begin{equation}
\setlength{\extrarowheight}{0.3cm}
\label{objective}
\left[
\renewcommand{\arraystretch}{.4}
\begin {array}{ccc}
9&13&17\\
\noalign{\medskip}
14&18&22
\end {array}
\right]
\end{equation}
  • Dear Ben: you cannot post a picture because you are a relatively new user. One way to get around it is to upload the picture somewhere else and provide a link to it. Other higher reputation users (or the moderators) can then insert the picture to your post for you. – Willie Wong May 12 '11 at 8:41
  • It is good that you included some code. Even better, though, would be to include a minimal working example---some code that can be copied and compiled as is and manifests the issue that you are experiencing. – vanden May 12 '11 at 15:29
  • We'd like to keep answers separate from questions, so you should write a separate answer instead of editing your answer into the question. Self-answers are perfectly admissible, and a well-written answer may earn you additional reputation. – Werner Nov 17 '11 at 6:48
2
\listfiles
\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}\label{objective}
\begin {bmatrix}
 9 & 13 & 17\\
14 & 18 & 22
\end {bmatrix}
\end{equation}

\begin{equation}
\begin {bmatrix}
 9 & 13 & 17\\[\bigskipamount]
14 & 18 & 22
\end {bmatrix}
%
\def\arraystretch{2}
\begin {bmatrix}
 9 & 13 & 17\\
14 & 18 & 22
\end {bmatrix}
\end{equation}

\end{document}

enter image description here

|improve this answer|||||
  • Herbert, thanks for posting the equations. When I create the equation 1 you show, I have a whitespace gap within the matrix at the top - it appears more like equation 2 although I'm not using arraystretch yet. I have to add arraystretch to compress the matrix manually to appear like equation 1. – Ben May 12 '11 at 14:22
  • @Hebert, I think Vanden already mentioned this... – Ben May 12 '11 at 19:32

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.