2

I have made two tabulars, inside a pmatrix, inside a math environment (displaymath). The outcome doesn't fit on the page, does anybody know how I can scale my code, so that it fits?

\documentclass[a4paper]{amsart}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
\usepackage[dutch]{babel}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}
\begin{displaymath}
\begin{pmatrix}
\begin{tabular}{c c c c c c c c c c c}

   &  &  &$\vdots$ &   &  &  &$\vdots$  &  &  &  \\
   &$A$ &  &         0     &   &  $B$&  &             0&  & $C$&  \\
   &  &  &$\vdots$ &   &  &  &$\vdots$  &  &  &  \\  \cline{4-8}
 $\cdots$ &0 &$\cdots$ 0&\multicolumn{1}{|l}{0}  &  0 &  $\cdots$&0  &  1 &\multicolumn{1}{|l}{0}$\cdots$ & 0&$\cdots$ \\\cline{5-7}
   &  &  &         \multicolumn{1}{|l}{0}     & \multicolumn{1}{|l}{}  &   &  &       \multicolumn{1}{|l}{0}&\multicolumn{1}{|l}{}  &  &  \\
   &$D$ &  & \multicolumn{1}{|l}{ $\vdots$ }   &  \multicolumn{1}{|l}{} &  $E$&  &\multicolumn{1}{|l}{$\vdots$}&  \multicolumn{1}{|l}{}& $F$&  \\
   &  &  &      \multicolumn{1}{|l}{0} &\multicolumn{1}{|l}{}   &   &  &  \multicolumn{1}{|l}{0}&  \multicolumn{1}{|l}{}&  &  \\ \cline{5-7}
 $\cdots$ &0 &$\cdots$ 0 &  \multicolumn{1}{|l}{1}  & 0  &  $\cdots$&0  &  0 &\multicolumn{1}{|l}{0  $\cdots$} & 0&$\cdots$ \\ \cline{4-8}
   &  &  &         $\vdots$     &   &   &  &             $\vdots$&  &  &  \\
   &$G$ &  &        0     &   &  $H$&  &             0&  & $I$&  \\
   &  &  &        $\vdots$      &   &   &  &             $\vdots$&  &  &  \\


\end{tabular}
\end{pmatrix}
\Longrightarrow
\begin{pmatrix}
\begin{tabular}{c c c c c c c c c c c}

   &  &  &$\vdots$ &   &  &  &$\vdots$  &  &  &  \\
   &$A$ &  &         0     &   &  $B$&  &             0&  & $C$&  \\
   &  &  &$\vdots$ &   &  &  &$\vdots$  &  &  &  \\  \cline{4-8}
 $\cdots$ &0 &$\cdots$ 0&\multicolumn{1}{|l}{0}  &  0 &  $\cdots$&0  &  1 &\multicolumn{1}{|l}{0}$\cdots$ & 0&$\cdots$ \\\cline{5-7}
   &  &  &         \multicolumn{1}{|l}{0}     & \multicolumn{1}{|l}{}  &   &  &       \multicolumn{1}{|l}{0}&\multicolumn{1}{|l}{}  &  &  \\
   &$D$ &  & \multicolumn{1}{|l}{ $\vdots$ }   &  \multicolumn{1}{|l}{} &  $E$&  &\multicolumn{1}{|l}{$\vdots$}&  \multicolumn{1}{|l}{}& $F$&  \\
   &  &  &      \multicolumn{1}{|l}{0} &\multicolumn{1}{|l}{}   &   &  &  \multicolumn{1}{|l}{0}&  \multicolumn{1}{|l}{}&  &  \\ \cline{5-7}
 $\cdots$ &0 &$\cdots$ 0 &  \multicolumn{1}{|l}{1}  & 0  &  $\cdots$&0  &  0 &\multicolumn{1}{|l}{0  $\cdots$} & 0&$\cdots$ \\ \cline{4-8}
   &  &  &         $\vdots$     &   &   &  &             $\vdots$&  &  &  \\
   &$G$ &  &        0     &   &  $H$&  &             0&  & $I$&  \\
   &  &  &        $\vdots$      &   &   &  &             $\vdots$&  &  &  \\


\end{tabular}
\end{pmatrix}
\end{displaymath}        
\end{document}
Sven
  • 95
  • 1
  • 5
  • I can't put the code into a block, sorry – Sven Nov 26 '14 at 09:19
  • Please make your example a complete document so that we can run it (as well as knowing other details like how wide your page is) Also why are you using tabular rather than array? The only difference is that array entries are in math mode, which is what you want here – David Carlisle Nov 26 '14 at 09:27

3 Answers3

2

With some work, we can remove all unnecessary space:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\svdots}{%
  \vbox{\baselineskip4\p@\lineskiplimit\z@\kern2\p@\hbox{.}\hbox{.}\hbox{.}}%
}
\makeatother

\begin{document}
\[
\left(
\begin{array}{*{3}{@{}c} @{} *{7}{c} @{\,} *{3}{c@{}}}
&&&& \vdots &&&& \vdots \\
& A &&& 0 && B && 0 &&& C \\
&&&& \svdots &&&& \svdots \\
\cline{5-9}
\cdots & 0 & \cdots & \multicolumn{1}{@{}c|}{0} & 0 & 0 & \cdots& 0 &
  \multicolumn{1}{c|}{1} & 0 & \cdots & 0 & \cdots \\
\cline{6-8}
&&& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{0} &&& \multicolumn{1}{c|}{} &
  \multicolumn{1}{c|}{0} \\
& D && \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\svdots} && E &
  \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\svdots} &&& F \\
&&& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{0} &&& \multicolumn{1}{c|}{} &
  \multicolumn{1}{c|}{0} \\
\cline{6-8}
\cdots & 0 & \cdots & \multicolumn{1}{@{}c|}{0} & 1 & 0 & \cdots& 0 &
  \multicolumn{1}{c|}{0} & 0 & \cdots & 0 & \cdots \\
\cline{5-9}
&&&& \vdots &&&& \vdots \\
& G &&& 0 && H && 0 &&& I \\
&&&& \svdots &&&& \svdots \\
\end{array}
\right)
\]

\end{document}

Note \svdots to correct the vertical dots in some places.

enter image description here

egreg
  • 1,121,712
1

The tabular is not doing anything useful, you could use array to save putting each entry into math, but here you can just remove it and use the pmatrix.

You can reduce fonts and column spacing but it just looks a mess and to cramped to read, so I would break over a line.

enter image description here

\documentclass[a4paper]{amsart}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
\usepackage[dutch]{babel}
\usepackage{amssymb}
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{20}
\usepackage{graphicx}

\begin{document}
\noindent X\dotfill X

\begin{multline*}
\begin{pmatrix}
   &  &  &\vdots &   &  &  &\vdots  &  &  &  \\
   &A &  &         0     &   &  B&  &             0&  & C&  \\
   &  &  &\vdots &   &  &  &\vdots  &  &  &  \\
 \cline{4-8}
 \cdots &0 &\cdots 0&\multicolumn{1}{|l}{0}  &  0 &  \cdots&0  &  1 &\multicolumn{1}{|l}{0\cdots} & 0&\cdots \\\cline{5-7}
   &  &  &         \multicolumn{1}{|l}{0}     & \multicolumn{1}{|l}{}  &   &  &       \multicolumn{1}{|l}{0}&\multicolumn{1}{|l}{}  &  &  \\
   &D &  & \multicolumn{1}{|l}{ \vdots }   &  \multicolumn{1}{|l}{} &  E&  &\multicolumn{1}{|l}{\vdots}&  \multicolumn{1}{|l}{}& F&  \\
   &  &  &      \multicolumn{1}{|l}{0} &\multicolumn{1}{|l}{}   &   &  &  \multicolumn{1}{|l}{0}&  \multicolumn{1}{|l}{}&  &  \\
 \cline{5-7}
 \cdots &0 &\cdots 0 &  \multicolumn{1}{|l}{1}  & 0  &  \cdots&0  &  0 &\multicolumn{1}{|l}{0  \cdots} & 0&\cdots \\ \cline{4-8}
   &  &  &         \vdots     &   &   &  &             \vdots&  &  &  \\
   &G &  &        0     &   &  H&  &             0&  & I&  \\
   &  &  &        \vdots      &   &   &  &             \vdots&  &  & 
\end{pmatrix}\\{}
\Longrightarrow
\begin{pmatrix}
   &  &  &\vdots &   &  &  &\vdots  &  &  &  \\
   &A &  &         0     &   &  B&  &             0&  & C&  \\
   &  &  &\vdots &   &  &  &\vdots  &  &  &  \\  \cline{4-8}
 \cdots &0 &\cdots 0&\multicolumn{1}{|l}{0}  &  0 &  \cdots&0  &  1 &\multicolumn{1}{|l}{0\cdots} & 0&\cdots \\\cline{5-7}
   &  &  &         \multicolumn{1}{|l}{0}     & \multicolumn{1}{|l}{}  &   &  &       \multicolumn{1}{|l}{0}&\multicolumn{1}{|l}{}  &  &  \\
   &D &  & \multicolumn{1}{|l}{ \vdots }   &  \multicolumn{1}{|l}{} &  E&  &\multicolumn{1}{|l}{\vdots}&  \multicolumn{1}{|l}{}& F&  \\
   &  &  &      \multicolumn{1}{|l}{0} &\multicolumn{1}{|l}{}   &   &  &  \multicolumn{1}{|l}{0}&  \multicolumn{1}{|l}{}&  &  \\ \cline{5-7}
 \cdots &0 &\cdots 0 &  \multicolumn{1}{|l}{1}  & 0  &  \cdots&0  &  0 &\multicolumn{1}{|l}{0  \cdots} & 0&\cdots \\ \cline{4-8}
   &  &  &         \vdots     &   &   &  &             \vdots&  &  &  \\
   &G &  &        0     &   &  H&  &             0&  & I&  \\
   &  &  &        \vdots      &   &   &  &             \vdots&  &  &  
\end{pmatrix}
\end{multline*}

\end{document}
David Carlisle
  • 757,742
0

If you do not want to reduce the font size, you will have to reduce the space between the columns in order to set both matrices next to each other:

% arara: pdflatex

\documentclass[a4paper]{amsart}    
\usepackage{mathtools}

\begin{document}
\begin{equation*}
\arraycolsep=1.55pt\def\arraystretch{1} % maximum value for this case.
    \left(\begin{array}{*{13}c}         
        & & & & \vdots & & & & \vdots & & & & \\
        & A & & & 0 & & B & & 0 & & & C & \\
        & & & & \vdots & & & & \vdots & & & & \\ \cline{5-9}
        \cdots & 0 & \cdots & 0 & \multicolumn{1}{|c}{0} & 0 & \cdots & 0 & 1 & \multicolumn{1}{|c}{0} & \cdots & 0 & \cdots \\ \cline{6-8}
        & & & & \multicolumn{1}{|c}{0} & \multicolumn{1}{|c}{} & & & \multicolumn{1}{|c}{0} & \multicolumn{1}{|c}{} & & & \\
        & D & & & \multicolumn{1}{|c}{\vdots} & \multicolumn{1}{|c}{} & E & & \multicolumn{1}{|c}{\vdots} & \multicolumn{1}{|c}{} & & F & \\
        & & & & \multicolumn{1}{|c}{0} & \multicolumn{1}{|c}{} & & & \multicolumn{1}{|c}{0} & \multicolumn{1}{|c}{} & & & \\ \cline{6-8}
        \cdots & 0 & \cdots & 0 & \multicolumn{1}{|c}{1} & 0 & \cdots & 0 & 0 & \multicolumn{1}{|c}{0} & \cdots & 0 & \cdots \\ \cline{5-9}
        & & & & \vdots & & & & \vdots & & & & \\
        & G & & & 0 & & H & & 0 & & & I & \\
        & & & & \vdots & & & & \vdots & & & & \\            
    \end{array}\right)
    \Longrightarrow
    \left(\begin{array}{*{13}c}         
        & & & & \vdots & & & & \vdots & & & & \\
        & A & & & 0 & & B & & 0 & & & C & \\
        & & & & \vdots & & & & \vdots & & & & \\ \cline{5-9}
        \cdots & 0 & \cdots & 0 & \multicolumn{1}{|c}{0} & 0 & \cdots & 0 & 1 & \multicolumn{1}{|c}{0} & \cdots & 0 & \cdots \\ \cline{6-8}
        & & & & \multicolumn{1}{|c}{0} & \multicolumn{1}{|c}{} & & & \multicolumn{1}{|c}{0} & \multicolumn{1}{|c}{} & & & \\
        & D & & & \multicolumn{1}{|c}{\vdots} & \multicolumn{1}{|c}{} & E & & \multicolumn{1}{|c}{\vdots} & \multicolumn{1}{|c}{} & & F & \\
        & & & & \multicolumn{1}{|c}{0} & \multicolumn{1}{|c}{} & & & \multicolumn{1}{|c}{0} & \multicolumn{1}{|c}{} & & & \\ \cline{6-8}
        \cdots & 0 & \cdots & 0 & \multicolumn{1}{|c}{1} & 0 & \cdots & 0 & 0 & \multicolumn{1}{|c}{0} & \cdots & 0 & \cdots \\ \cline{5-9}
        & & & & \vdots & & & & \vdots & & & & \\
        & G & & & 0 & & H & & 0 & & & I & \\
        & & & & \vdots & & & & \vdots & & & & \\            
    \end{array}\right)
\end{equation*} 
\end{document}

enter image description here


The other possibilities are:

  • reduce font size
  • put negative kerning to the \cdots
  • use the shorter \Rightarrow
  • set the whole thing on two lines (see Mr. Carlisle's answer)
LaRiFaRi
  • 43,807
  • there's really too much space above the vertical dots, and would look better adjusted. the explanation is in the answer to this question: Wrong (too much) vertical space above \vdots in small matrix – barbara beeton Nov 26 '14 at 13:53
  • @barbarabeeton Yes, that's why I left the visual debugging (yellow marks) in the first place. I did not like it at all but wondered, if this is done on purpose. As \vdots are made for matrices, I left it, as it is. But thanks for the link. – LaRiFaRi Nov 26 '14 at 14:49
  • i read egreg's answer after i read yours, and he addressed the dots spacing. i don't think his approach would work as well in a footnote environment though. as for yellow marks, i guess i really need to get my monitor tuned -- i didn't notice them until you mentioned them, although i did notice some sort of vertical clutter that i didn't try to identify. – barbara beeton Nov 26 '14 at 15:08
  • @barbarabeeton \vdots has fixed spacing (\baselineskip=4pt), which means it will be funny in a \footnotesize context. – egreg Nov 26 '14 at 15:14
  • @egreg -- it's true that \vdots has fixed spacing, but in a footnote or other smaller-size context, that won't be nearly as noticeable as the extra space at the top. and since the period sits on the baseline, space below would be governed by the "local" baselineskip, so the space at the top would make even more of a difference, though admittedly not much. – barbara beeton Nov 26 '14 at 15:47