1

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.

2 Answers2

3

A possible solution is split your huge matrices in submatrices:

enter image description here

\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}
Zarko
  • 296,517
  • 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
1

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}
\usepackage{adjustbox}

\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}

two pages

John Kormylo
  • 79,712
  • 3
  • 50
  • 120