# How to remove spaces and make the sub-matrices appear larger

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\author{}
\begin{document}
$\left[ \begin{array}{cccccccccccccccccccccccccccccccccccccccccccccc} 1 & 1 & \dots & 1 & 1 & 1 & \dots &\dots &\dots &1 & 1 \\ 0 & 0 & \dots & 0 & 0 & 0 & \dots &\dots &\dots &0 & 0 \\ \dots & \dots & \dots & \dots & \dots & \dots & \dots &\dots &\dots &\dots & \dots \\ \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots &\dots &\dots &\dots \\ 0 & 0 & \dots & 0 & 0 & 0 & \dots &\dots &\dots &0 & 0 \\ \cline{1-11} & & & & \multicolumn{1}{c|}{} & & \\ & & \mathbf{{J^T}} & & \multicolumn{1}{c|}{} && &&\mathbf{{A-(n-2)I}} \\ & & & & \multicolumn{1}{c|}{} & & \end{array} \; \right]$
\end{document}


I have written the above code but I am having two issues:

1. There are spaces appearing inside the matrix after the dots specifically in the third last column. I don't know how to fix it.

2. Also \mathbf{{J^T}} and \mathbf{{A-(n-2)I}} are appearing very small in the matrix. Is there any way to make $J^T$ and $A-(n-2)I$ appear larger? I tried using \huge but its of no help.

Can someone kindly help me out? Thanks in advance.

• why so many dots, I don't think this is a good display style. – ZhiyuanLck Jun 11 '20 at 13:41

By placing the bottom textual row in a zero-width \makebox, I could eliminate the excess space. It also allowed me to specify \Large before entering $...$ inline math mode, so as to make the text larger.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\author{}
\begin{document}
$\left[ \begin{array}{cccccccccccccccccccccccccccccccccccccccccccccc} 1 & 1 & \dots & 1 & 1 & 1 & \dots &\dots &\dots &1 & 1 \\ 0 & 0 & \dots & 0 & 0 & 0 & \dots &\dots &\dots &0 & 0 \\ \dots & \dots & \dots & \dots & \dots & \dots & \dots &\dots &\dots &\dots & \dots \\ \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots &\dots &\dots &\dots \\ 0 & 0 & \dots & 0 & 0 & 0 & \dots &\dots &\dots &0 & 0 \\ \cline{1-11} & & & & \multicolumn{1}{c|}{} & & \\ & & \makebox[0pt]{\Large\mathbf{{J^T}}} & & \multicolumn{1}{c|}{} && && \makebox[0pt]{\Large\mathbf{{A-(n-2)I}}} \\ & & & & \multicolumn{1}{c|}{} & & \end{array} \; \right]$
\end{document}


• Do you mind if I ask you to kindly explain what fixes you applied so that I can understand and apply in myself too\ – Math_Freak Jun 11 '20 at 13:40
• @Math_Freak I just added an explanation. The key was the \makebox[0pt]{\Large$...$}. – Steven B. Segletes Jun 11 '20 at 13:41
• What does it do? Can you please explain its function? I never seen it. – Math_Freak Jun 11 '20 at 13:42
• \makebox creates a text box, where one can optionally specify the fixed width. By specifying as 0pt, the full text is shown, but the array thinks of it as ultimately narrow, and so it does not push aside the adjacent columns creating extra unwanted width. Inside the text box, I have to use $...$ to get back into math mode, but I can also prepend that with a text size specifier such as \Large, which will not otherwise work inside of math mode. @Math_Freak – Steven B. Segletes Jun 11 '20 at 13:45
• Awesome, thanks a lot – Math_Freak Jun 11 '20 at 13:45

This is actually a two-by-two block matrix, so I'd treat it as such.

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

\begin{document}

$\left[\begin{array}{cc} \begin{matrix} 1 & 1 & \dots & 1 \\ 0 & 0 & \dots & 0 \\ \dots & \dots & \dots & \dots \\ \dots & \dots & \dots & \dots \\ 0 & 0 & \dots & 0 \end{matrix} & \begin{matrix} 1 & 1 & \dots & \dots & \dots & 1 & 1 \\ 0 & 0 & \dots & \dots & \dots & 0 & 0 \\ \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ 0 & 0 & \dots & \dots & \dots & 0 & 0 \end{matrix} \\ \hline \multicolumn{1}{c|}{\mathbf{J}^T} & \vphantom{\begin{matrix} 0 \\ 0 \\ 0\end{matrix}} \mathbf{A}-(n-2)\mathbf{I} \end{array}\right]$

\end{document}


With a phantom I force the lower part to be as high as three rows. Add rows inside it for making it higher.

Note that you don't want \mathbf{A-(n-2)I}: only “A” and “I” should be boldface.

For making the symbols in the lower part bigger, I already suggested a trick:

\newcommand{\bigentry}[2][\huge]{\begin{tabular}{@{}c@{}}#1$#2$\end{tabular}}


With this in the preamble and modifying the last part of the array into

\hline
\multicolumn{1}{c|}{\bigentry[\LARGE]{\mathbf{J}^T}} &
\vphantom{\begin{matrix} 0 \\ 0 \\ 0\end{matrix}} \bigentry[\LARGE]{\mathbf{A}-(n-2)\mathbf{I}}
\end{array}\right]


you get

• Thank you so very much, Its really helpful – Math_Freak Jun 11 '20 at 14:16