1

My problem is that the outputs of \bmatrix are a bit weird and not of the same height and the linespacings are different depending on element heights.

I have put these on a blank document and I got a satisfactory result therefore I think maybe some packages are interfering with each other.

Also my other bmatrices are not affected and removing the align environment doesn't solve the problem.

These are the packages I use

\usepackage{amsthm,amssymb,amsmath}         
\usepackage{epsf,graphicx}                                          
\usepackage[a4paper]{geometry}                          
\usepackage{titlesec}                                           
\usepackage{setspace}                                            
\usepackage[stable,bottom]{footmisc}                        
\usepackage{placeins}
\usepackage[colorlinks,citecolor=blue]{hyperref}
\hypersetup{linkcolor=blue}
\usepackage{zref-perpage}                                   
\zmakeperpage[1]{footnote}
\usepackage{cancel}
\usepackage{tikz}
\usetikzlibrary{fit,positioning}
\usetikzlibrary{bayesnet}
\usepackage{adjustbox}

\usepackage{pgfplots}
\pgfplotsset{every tick label/.append style={font=\tiny}}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{booktabs}
\usepackage{units}

And this is the tex code

\begin{align}
\begin{bmatrix}
0 & \Sigma^r_{xy} \\
\Sigma^r_{yx} & 0 \\
\end{bmatrix} 
\begin{bmatrix}
l_{x} \\
l_{y} \\
\end{bmatrix}
=\lambda 
\begin{bmatrix}
\Sigma^r_{xx} &     0        \\
0             & \Sigma^r_{yy} \\
\end{bmatrix}
\begin{bmatrix}
l_{x} \\
l_{y} \\
\end{bmatrix} \\ %%%%%%
\begin{bmatrix}
0 & \Sigma^l_{xy} \\
\Sigma^l_{yx} & 0 \\
\end{bmatrix} 
\begin{bmatrix}
r_{x} \\
r_{y} \\
\end{bmatrix}
=\lambda 
\begin{bmatrix}
\Sigma^l_{xx} &     0        \\
0             & \Sigma^l_{yy} \\
\end{bmatrix}
\begin{bmatrix}
r_{x} \\
r_{y} \\
\end{bmatrix}
\end{align}

output

  • Please provide the document in one piece, nothing we have to glue together! –  Apr 16 '16 at 13:30
  • Which document class do you use? I am unable to reproduce the look of your screenshot when I try to compile your code using the article document class. – Mico Apr 16 '16 at 13:37
  • Have you, or a package you load, modified the values of \arraystretch and/or \extrarowheight somewhere in the document? – Mico Apr 16 '16 at 13:42
  • @Mico I'm also unable to reproduce it when I glue my code and my preamble! I don't know which parts to copy here. – saied Vanguard Apr 16 '16 at 13:42
  • So there must be something in the body of the document (i.e, something after \begin{document}) that modifies some important parameters. Given how cramped the screenshot looks, I would suspect that \baselineskip, \arraystretch, or \extrarowheight have been modified. – Mico Apr 16 '16 at 13:44
  • yes I did copy the code from http://tex.stackexchange.com/questions/14071/how-can-i-increase-the-line-spacing-in-a-matrix but I undid it later. – saied Vanguard Apr 16 '16 at 13:46
  • I also tried deleting all of the outputs of xelatex and recompiling the code again. It didn't help. – saied Vanguard Apr 16 '16 at 13:48
  • @Mico I commented out the few instances of the commands you mentioned (in template files etc.) still not solved – saied Vanguard Apr 16 '16 at 14:21

2 Answers2

1

The value of \arraystrech is set elsewhere but commenting that out didn't help. It seems that the default value was also not appropriate.

So I put the \align inside a group and then checked a couple of \arraystrech values until I found the right one. Thank you everyone!

\begingroup
\renewcommand*{\arraystretch}{2}
\begin{align}
&\begin{bmatrix}
0 & \Sigma^r_{xy} \\
\Sigma^r_{yx} & 0 \\
\end{bmatrix} 
\begin{bmatrix}
l_{x} \\
l_{y} \\
\end{bmatrix}
=\lambda 
\begin{bmatrix}
\Sigma^r_{xx} &     0        \\
0             & \Sigma^r_{yy} \\
\end{bmatrix}
\begin{bmatrix}
l_{x} \\
l_{y} \\
\end{bmatrix} \\ %%%%%%
&\begin{bmatrix}
0 & \Sigma^l_{xy} \\
\Sigma^l_{yx} & 0 \\
\end{bmatrix} 
\begin{bmatrix}
r_{x} \\
r_{y} \\
\end{bmatrix}
=\lambda 
\begin{bmatrix}
\Sigma^l_{xx} &     0        \\
0             & \Sigma^l_{yy} \\
\end{bmatrix}
\begin{bmatrix}
r_{x} \\
r_{y} \\
\end{bmatrix}
\end{align}
\endgroup
0

(Not a real answer, just a MWE placeholder.)

As Mico indicated, your result can't be reproduced with what you provided. Below is a MWE with the minimum amount of uncommented code. None of the packages you mentioned make any difference in the output, so they've been commented out.

Whatever is causing the bad alignment is elsewhere in your actual document.

\documentclass{article}
\usepackage{amsmath}
% Irrelevant packages
%\usepackage{amsthm,amssymb}         
%\usepackage{epsf,graphicx}                                          
%\usepackage[a4paper]{geometry}                          
%\usepackage{titlesec}                                           
%\usepackage{setspace}                                            
%\usepackage[stable,bottom]{footmisc}                        
%\usepackage{placeins}
%\usepackage[colorlinks,citecolor=blue]{hyperref}
%\hypersetup{linkcolor=blue}
%\usepackage{zref-perpage}                                   
%\zmakeperpage[1]{footnote}
%\usepackage{cancel}
%\usepackage{tikz}
%\usetikzlibrary{fit,positioning}
%\usetikzlibrary{bayesnet} % untested, but probably irrrelevant
% Irrelevant packages
%\usepackage{adjustbox}
%\usepackage{pgfplots}
%\pgfplotsset{every tick label/.append style={font=\tiny}}
%\usepackage{algorithm}
%\usepackage{algorithmic}
%\usepackage{booktabs}
%\usepackage{units}
\begin{document}
\begin{align}
\begin{bmatrix}
0             & \Sigma^r_{xy} \\
\Sigma^r_{yx} & 0 \\
\end{bmatrix} 
%
\begin{bmatrix}
l_{x} \\
l_{y} \\
\end{bmatrix}
%
&=\lambda % may want to align related equations on equal sign
%
\begin{bmatrix}
\Sigma^r_{xx} &     0        \\
0             & \Sigma^r_{yy} \\
\end{bmatrix}
%
\begin{bmatrix}
l_{x} \\
l_{y} \\
\end{bmatrix}
%
\\
%
\begin{bmatrix}
0             & \Sigma^l_{xy} \\
\Sigma^l_{yx} & 0 \\
\end{bmatrix}
%
\begin{bmatrix}
r_{x} \\
r_{y} \\
\end{bmatrix}
%
&=\lambda
%
\begin{bmatrix}
\Sigma^l_{xx} & 0        \\
0             & \Sigma^l_{yy} \\
\end{bmatrix}
%
\begin{bmatrix}
r_{x} \\
r_{y} \\
\end{bmatrix}
\end{align}
\end{document}

enter image description here

Mike Renfro
  • 20,550