TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a report, with a restriction on page numbers. So I want to rotate a bmatrix that sticks out of the page (horizontal) and put it inside a \minipage.

My bmatrix:

\medmuskip = 1mu % default: 4mu plus 2mu minus 4mu
B = \begin{bmatrix}
-\dfrac{(\xi_{2}-1)(2\xi1+\xi2)}{4\alpha_{1}}  & 0 & 
-\dfrac{(\xi_{2}-1)(2\xi_{1}-\xi_{2}) }{4\alpha_{1}} & 0 &  
 \dfrac{(\xi_{2}+1)(2\xi_{1}+\xi_{2})}{4\alpha_{1}} & 0 &  
 \dfrac{(\xi_{2}+1)(2\xi_{1}-\xi_{2})}{4\alpha_{1}} & 0 & 
-\dfrac{(\xi_{2}-1)(\xi_{2}+1)}{2\alpha_{1}} & 0 &  
-\dfrac{(\xi_{2}+1)\xi_{1}}{\alpha_{1}} & 0 &  
 \dfrac{(\xi_{2}-1)(\xi_{2}+1)}{2\alpha_{1}} & 0 &  
 \dfrac{(\xi_{2}-1)\xi_{1}}{\alpha_{1}} & 0 \\[0.3em]
 0 &  -\dfrac{(\xi_{1}-1)(2\xi_{2}+\xi_{1})}{4\alpha_{2}} &
 0 &  -\dfrac{(\xi_{1}+1)(-2\xi_{2}+\xi_{1})}{4\alpha_{2}} &
 0 &  \dfrac{(\xi_{1}+1)(2\xi_{2}+\xi_{1})}{4\alpha_{2}} &
 0 & \dfrac{1}{4\alpha_{2}} (\xi_{1}-1)(-2\xi_{2}+\xi_{1}) &
 0 &  -\dfrac{(\xi_{1}+1)\xi_{2}}{\alpha_{2}} &
 0 & -\dfrac{(\xi_{1}-1)(\xi_{1}+1)}{2\alpha_{2}} &
 0 & \dfrac{(\xi_{1}-1)\xi_{2}}{\alpha_{2}} &
 0 & \dfrac{(\xi_{1}-1)(\xi_{1}+1)}{2\alpha_{2}} \\[0.3em]
-\dfrac{(\xi_{1}-1)(2\xi_{2}+\xi_{1})}{4\alpha_{2}} & 
-\dfrac{(\xi_{2}-1)(2\xi1+\xi2)}{4\alpha_{1}} & 
-\dfrac{(\xi_{1}+1)(-2\xi_{2}+\xi_{1})}{4\alpha_{2}} & 
-\dfrac{(\xi_{2}-1)(2\xi_{1}-\xi_{2})}{4\alpha_{1}} & 
 \dfrac{(\xi_{1}+1)(2\xi_{2}+\xi_{1})}{4\alpha_{2}} & 
 \dfrac{(\xi_{2}+1)(2\xi_{1}+\xi_{2})}{4\alpha_{1}} & 
 \dfrac{(\xi_{1}-1)(-2\xi_{2}+\xi_{1})}{4\alpha_{2}} & 
 \dfrac{(\xi_{2}+1)(2\xi_{1}-\xi_{2})}{4\alpha_{1}} & 
-\dfrac{(\xi_{1}+1)\xi_{2}}{\alpha_{2}} & 
-\dfrac{(\xi_{2}-1)(\xi_{2}+1)}{2\alpha_{1}} & 
-\dfrac{(\xi_{1}-1)(\xi_{1}+1)}{2\alpha_{2}} & 
-\dfrac{(\xi_{2}+1)\xi_{1}}{\alpha_{1}} & 
 \dfrac{(\xi_{1}-1)\xi_{2}}{\alpha_{2}} & 
 \dfrac{(\xi_{2}-1)(\xi_{2}+1)}{2\alpha_{1}} &  
 \dfrac{(\xi_{1}-1)(\xi_{1}+1)}{2\alpha_{2}} & 
share|improve this question
While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. – Peter Grill Dec 3 '12 at 19:20
up vote 5 down vote accepted

I would suggest rotating using the graphicx package's \rotatebox{<angle>}{<stuff>}. More specifically, you'd use \rotatebox{90}{$<stuff>$} since <stuff> is math content and \rotatebox sets <stuff> in text mode by default.

If your output is still too large (vertically) after rotating, graphicx offers \resizebox{<h-len>}{<v-len>}{<stuff>} which will fit the object <stuff> inside <h-len> horizontally and <v-len> vertically. Using ! in either argument will maintain the aspect ratio.

For example:


should work for you.

share|improve this answer

Your matrix B has 16 [!] columns, and two thirds of all entries are non-trivial (i.e., non-zero). Assuming a normal page size and normal page margins, there's simply no way you can make this matrix fit in either portrait or landscape mode -- even if you choose the fontsize directive \tiny (two full steps smaller than \footnotesize) and are willing to warn your readers to have a magnifying glass handy if they wish to read what you've written.

Given these realities, you may prefer to use normal font sizes and just break up the matrix B into four submatrices, each one containing "just" four columns. Note that you won't actually use more physical or virtual pages with this approach than if you display the entire matrix (using a nearly microscopic font size...) in rotated (landscape) mode.

This idea is implemented in the following MWE.

enter image description here

\usepackage{mathtools} % mathtools is a superset of amsmath
\arraycolsep=3pt % amsmath xmatrix default is 5pt
Let $B = B_1 \mid B_2 \mid B_3 \mid B_4$ (the horizontal concatenation of the four matrices), where
 B_1 &= \begin{bmatrix} 
 -\dfrac{(\xi_2-1)(2\xi_1+\xi_2)}{4\alpha_1}  & 0 & 
 -\dfrac{(\xi_2-1)(2\xi_1-\xi_2) }{4\alpha_1} & 0 \\[1.6ex]
0 & -\dfrac{(\xi_1-1)(2\xi_2+\xi_1)}{4\alpha_2} & 
0 & -\dfrac{(\xi_1+1)(-2\xi_2+\xi_1)}{4\alpha_2} \\[1.6ex]
 -\dfrac{(\xi_1-1)(2\xi_2+\xi_1)}{4\alpha_2} &  
 -\dfrac{(\xi_2-1)(2\xi_1+\xi_2)}{4\alpha_1} &
 -\dfrac{(\xi_1+1)(-2\xi_2+\xi_1)}{4\alpha_2} & 
 B_2 &= \begin{bmatrix} 
 \dfrac{(\xi_2+1)(2\xi_1+\xi_2)}{4\alpha_1} & 0 &  
 \dfrac{(\xi_2+1)(2\xi_1-\xi_2)}{4\alpha_1} & 0  \\[1.6ex]
 0 &  \dfrac{(\xi_1+1)(2\xi_2+\xi_1)}{4\alpha_2} & 
 0 &  \dfrac{(\xi_1-1)(-2\xi_2+\xi_1)}{4\alpha_2}   
 \dfrac{(\xi_1+1)(2\xi_2+\xi_1)}{4\alpha_2} & 
 \dfrac{(\xi_2+1)(2\xi_1+\xi_2)}{4\alpha_1} & 
 \dfrac{(\xi_1-1)(-2\xi_2+\xi_1)}{4\alpha_2} &  
 B_3 &= 
 -\dfrac{(\xi_2-1)(\xi_2+1)}{2\alpha_1} & 0 &  
 -\dfrac{(\xi_2+1)\xi_1}{\alpha_1} & 0 &  \\[1.6ex]
0 &  -\dfrac{(\xi_1+1)\xi_2}{\alpha_2} & 
0 & -\dfrac{(\xi_1-1)(\xi_1+1)}{2\alpha_2}\\[1.6ex]
 -\dfrac{(\xi_2-1)(\xi_2+1)}{2\alpha_1} & 
 -\dfrac{(\xi_1-1)(\xi_1+1)}{2\alpha_2} & 
 -\dfrac{(\xi_2+1)\xi_1}{\alpha_1} &  
 B_4 &= 
 \dfrac{(\xi_2-1)(\xi_2+1)}{2\alpha_1} & 0 &  
 \dfrac{(\xi_2-1)\xi_1}{\alpha_1} & 0 \\[1.6ex]
0 & \dfrac{(\xi_1-1)\xi_2}{\alpha_2} & 
0 & \dfrac{(\xi_1-1)(\xi_1+1)}{2\alpha_2} \\[1.6ex]
 \dfrac{(\xi_1-1)\xi_2}{\alpha_2} & 
 \dfrac{(\xi_2-1)(\xi_2+1)}{2\alpha_1} &  
 \dfrac{(\xi_1-1)(\xi_1+1)}{2\alpha_2} & 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.