# How can I force a large matrix to be horizontally centered and allow it to exceed both margins?

I am trying to get a very large matrix to be centered. I know that it is too large to fit within the margins, but I still want it with its current size. As shown in the figure below, the matrix overlaps only with the right margin and I would like it to be horizontally centered and exceed both margins symmetrically (e.g., if it exceeded the right margin by 1 cm then it also should exceed the left margin by 1 cm).

If possible, I would like the solution to have array environment in it or at least and another environment that allows me to draw horizontal and vertical lines inside the matrices as shown below:

My source code:

\documentclass[11pt, a4paper]{book}
\usepackage{makecell}
\usepackage{amsmath}
\usepackage{amssymb, amsfonts}
\usepackage{graphicx}
\usepackage{float}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{adjustbox}

\newcommand {\arraystretchdefaultl} {1.3}
\arraystretchdefault

\usepackage[showframe = true]{geometry}

\begin{document}

$$\left[ \begin{array}{c} V_{i} \\ \midrule[0.25mm] 0 \end{array} \right] % = % \left[ \begin{array}{c c!{\vrule width 0.25mm} c c} & Z_{orig} & & col. \medspace k - col. \medspace p \\ \Xcline{1-4}{0.25mm} & row. \medspace k - row. \medspace p & & Z_{th,kp}+Z_{b}\\ \end{array} \right] % \left[ \begin{array}{c} I_{i} \\ \midrule[0.25mm] I_{q} \end{array} \right]$$

\begin{adjustbox}{width=1\textwidth, center}

\begin{minipage}{1\textwidth}
%
%
\end{minipage}

\end{adjustbox}

\end{document}

• Centered relative to the text area or relative to the page? Mar 20, 2018 at 13:56

## 1 Answer

like this?

for spilling out on both side of text width i use macro adjustwidth from package changepage. i rewrote your matrix (make it shorter for one column) and use smaller font for it too.

\documentclass[11pt, a4paper]{book}
\usepackage{amsmath, amssymb}
\usepackage{graphicx}
\usepackage{float}
\usepackage{booktabs, makecell, tabularx}
\usepackage[strict]{changepage}

\newcommand {\arraystretchdefaultl} {1.3}
\arraystretchdefault

\usepackage[showframe = true]{geometry}

\begin{document}
$$\left[\begin{array}{c} V_{i} \\ \midrule[0.25mm] 0 \end{array}\right] % = % \left[\begin{array}{c c!{\vrule width 0.25mm} c c} & Z_{orig} & & col. \medspace k - col. \medspace p \\ \Xcline{1-4}{0.25mm} & row. \medspace k - row. \medspace p & & Z_{th,kp}+Z_{b}\\ \end{array}\right] % \left[\begin{array}{c} I_{i} \\ \midrule[0.25mm] I_{q} \end{array}\right]$$

\begin{adjustwidth}{-3em}{-5em}
\renewcommand{\arraystretch}{1.1}
\small
$$\left[\begin{array}{c} V_{1} \\ \vdots \\ V_{l} \\ \vdots \\ V_{k} \\ \vdots \\ V_{p} \\ \vdots \\ \Xcline{1-1}{0.25mm} 0 \\ \end{array}\right] = \left[\begin{array}{cc cc cc cc !{\vrule width 0.25mm} c} & & & & Z_{1k} & \dotsm & Z_{1p} & \dotsm & Z_{1k} - Z_{1p} \\ & & & & \vdots & & \vdots & & \vdots \\ & & Z_{orig} & & Z_{lk} & \dotsm & Z_{lp} & \dotsm & Z_{lk} - Z_{lp} \\ & & & & \vdots & & \vdots & & \vdots \\ Z_{k1} & \dotsm & Z_{km} & \dotsm & Z_{kk} & \dotsm & Z_{kp} & \dotsm & Z_{kk} - Z_{kp} \\ \vdots & & \vdots & & \vdots & & \vdots & & \vdots \\ Z_{p1} & \dotsm & Z_{pm} & \dotsm & Z_{pk} & \dotsm & Z_{pp} & \dotsm & Z_{pk} - Z_{pp} \\ \vdots & & \vdots & & \vdots & & \vdots & & \vdots \\ \Xcline{1-9}{0.25mm} Z_{k1} - Z_{p1} & \dotsm & Z_{km} - Z_{pm} & \dotsm & Z_{kk} - Z_{pk} & \dotsm & Z_{kp} - Z_{pp} & \dotsm & Z_{th, kp} + Z_{b} \end{array}\right] % \left[\begin{array}{c} V_{1} \\ \vdots \\ V_{l} \\ \vdots \\ V_{k} \\ \vdots \\ V_{p} \\ \vdots \\ \Xcline{1-1}{0.25mm} 0 \\ \end{array}\right]$$
\arraystretchdefault
\end{adjustwidth}
\end{document}