1

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:

enter image description here

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}
\newcommand{\arraystretchdefault}{ \renewcommand {\arraystretch} {\arraystretchdefaultl} }
\arraystretchdefault

\usepackage[showframe = true]{geometry}

\begin{document}

    \begin{equation}
    \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]
\end{equation}


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

    \begin{minipage}{1\textwidth}
    %
        \begin{equation}
        %
                %
                \renewcommand{\arraystretch}{1.1}
                \left[
                    \begin{array}{c}
                        V_{1} \\
                        \vdots \\
                        V_{l} \\
                        \vdots \\
                        V_{k} \\
                        \vdots \\
                        V_{p} \\
                        \vdots \\
                        \vdots \\ \midrule[0.25mm]
                        0 \\
                    \end{array}
                \right]
                =
                \renewcommand{\arraystretch}{1.1}
                \left[
                    \begin{array}{c c c c c c c c c !{\vrule width 0.25mm}c}
                        & & & & & Z_{1k} & \dotsm & Z_{1p} & \dotsm & Z_{1k} - Z_{1p} \\
                        & & \scalebox{1}{$Z_{orig}$} &  & & \vdots & & \vdots &  & \vdots \\
                        & & & & & Z_{lk} & \dotsm & Z_{lp} & \dotsm & Z_{lk} - Z_{lp} \\
                        & & &  & & \vdots & & \vdots &  & \vdots \\
                        Z_{k1} & \dotsm & \dotsm & Z_{km} & \dotsm & Z_{kk} & \dotsm & Z_{kp} & \dotsm & Z_{kk} - Z_{kp} \\
                        \vdots & & & \vdots & & \vdots & & \vdots &  & \vdots \\
                        Z_{p1} & \dotsm & \dotsm & Z_{pm} & \dotsm & Z_{pk} & \dotsm & Z_{pp} & \dotsm & Z_{pk} - Z_{pp} \\
                        \vdots & & & \vdots & & \vdots & & \vdots &  & \vdots \\
                        \vdots & & & \vdots & & \vdots & & \vdots &  & \vdots \\ \Xcline{1-10}{0.25mm}
                        Z_{k1} - Z_{p1} & \dotsm & \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 \\
                        \vdots \\ \midrule[0.25mm]
                        0 \\
                    \end{array}
                    \right]
                %
                \arraystretchdefault
        %
        \end{equation}
    %
    \end{minipage}

\end{adjustbox}




\end{document}
1
  • Centered relative to the text area or relative to the page? Mar 20, 2018 at 13:56

1 Answer 1

0

like this?

enter image description here

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}
\newcommand{\arraystretchdefault}{ \renewcommand {\arraystretch} {\arraystretchdefaultl} }
\arraystretchdefault

\usepackage[showframe = true]{geometry}

\begin{document}
\begin{equation}
\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]
\end{equation}

\begin{adjustwidth}{-3em}{-5em}
    \renewcommand{\arraystretch}{1.1}
    \small
\begin{equation}
\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]
        \end{equation}
            \arraystretchdefault
\end{adjustwidth}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.