# Splitting a matrix into several pages

I have some quite long matrices I would like to insert in a LaTeX document, and I wanted to know if it was possible to split the matrix environment to allow matrices to be displayed on several pages, as simply reducing enough the font makes my text unreadable. Here is a minimal working example:

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
A=\begin{pmatrix}
0&0\\
0&0\\
0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0
\end{pmatrix}
\end{align*}
\end{document}


In this example, we see that if we remove the last line of zeroes, the matrix will start at page 1 rather than at page 2 as it does here, while if we keep adding lines, LaTeX will continue displaying these additional elements and go beyond margins. I should precise that this is not the matrix I had in mind for my paper.

I should precise that in my specific case, the matrix has enough columns to fill a whole page.

• Maybe this helps – dexteritas Jun 29 '17 at 13:20
• Thank you dexteritas. I tried to use the previous answers concerning page breaking of other environments, but my compiler ignored the \allowdisplaybreaksand changed pages anyway. – Paul-Benjamin Jun 29 '17 at 13:30
• Please provide a MWE of your problem. – dexteritas Jun 29 '17 at 13:36
• I assume your actual matrix is not this narrow, otherwise you could fit it one page (albeit in sections). – John Kormylo Jun 29 '17 at 14:09
• @ John Kormylo Indeed, there are actually lengthy coefficient inside the matrix. Thank you for asking. – Paul-Benjamin Jun 29 '17 at 14:12

A possible solution is split your huge matrices in submatrices:

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}

\begin{document}
$\mathbf{A}=\begin{pmatrix} \mathbf{A}_1 \\ \mathbf{A}_2 \\ \mathbf{A}_3 \\ \mathbf{A}_4 \\ \end{pmatrix}$
where submatrices $\mathbf{A}_1$, $\mathbf{A}_2$, $\mathbf{A}_3$ and $\mathbf{A}_4$ are
$\mathbf{A}_1 = \begin{pmatrix} 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ \end{pmatrix} \quad \mathbf{A}_2 = \begin{pmatrix} 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ \end{pmatrix} \quad \mathbf{A}_3 = \begin{pmatrix} 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ \end{pmatrix} \quad \mathbf{A}_4 = \begin{pmatrix} 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ 0&0\\0&0\\ \end{pmatrix}$
\end{document}

• This is a nice solution if the matrix is narrow enough, but this is not my case, as I precised it in the comments. Please excuse me for being unclear, I will state it explicitly in the question. – Paul-Benjamin Jun 29 '17 at 15:08
• @Paul-Benjamin, I show an example only. This can work even with wide submatrices, for example each on one page. – Zarko Jun 29 '17 at 16:41

You could clip it, with a bit of overlap for continuity. Note that the baseline is at the center (more or less) which corresponds to 0pt in the viewport. \strutbox is a predefined box containing \strut, so \ht\strutbox is the height of \strut.

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}

\newsavebox{\tempbox}

\begin{document}
\savebox{\tempbox}{\begin{minipage}{\textwidth}
\begin{align*}
A=\begin{pmatrix}
0&0\\
0&0\\
0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0\\
0&0\\0&0
\end{pmatrix}
\end{align*}
\end{minipage}}%
\adjustbox{clip=true,viewport=0pt {-\ht\strutbox} {\wd\tempbox} {\ht\tempbox}}{\usebox{\tempbox}}
\newpage
\adjustbox{clip=true,viewport=0pt {-\dp\tempbox} {\wd\tempbox} {\dp\strutbox}}{\usebox{\tempbox}}
\end{document}


• In my editor (TeXstudio) I get a strange result, as the matrix is cut from the middle of the first page. Do you obtain better results on your editor? – Paul-Benjamin Jun 29 '17 at 15:04
• I added an image from my setup (TeXnicCenter, MikTeX and pdflatex). – John Kormylo Jun 29 '17 at 15:10
• Thank you, it does not seem to be the case. – Paul-Benjamin Jun 29 '17 at 15:10