# Rotation of a bmatrix

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:

$$\footnotesize \arraycolsep=1pt \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}} & \dfrac{(\xi_{2}-1)\xi_{1}}{\alpha_{1}} \end{bmatrix}$$

-
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

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:

\resizebox{!}{.9\textheight}{\rotatebox{90}{$B=\begin{bmatrix} %... \end{bmatrix}$}}


should work for you.

-

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.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{mathtools} % mathtools is a superset of amsmath
\allowdisplaybreaks
\begin{document}
\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
\begin{align*}
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} &
-\dfrac{(\xi_2-1)(2\xi_1-\xi_2)}{4\alpha_1}
\end{bmatrix}\,,\\[2ex]
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}
\\[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} &
\dfrac{(\xi_2+1)(2\xi_1-\xi_2)}{4\alpha_1}
\end{bmatrix}\,,\\[2ex]
B_3 &=
\begin{bmatrix}
-\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} &
\dfrac{(\xi_1-1)\xi_2}{\alpha_2}
\end{bmatrix}\,,\\
\shortintertext{and}
B_4 &=
\begin{bmatrix}
\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} &
\dfrac{(\xi_2-1)\xi_1}{\alpha_1}
\end{bmatrix}\,.\\
\end{align*}
\end{document}

-