0

I have the following matrix equation. However, the equation doesnt perfecty fit inside one line. The matrix goes right over the edge but also doesnt start at 0cm at the left. Does someone has one idea how to achieve the matrix to fit inside the equation ?

Here is a short MWE:

\documentclass[a4paper]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}

\usepackage[paper=a4paper,left=40mm,right=30mm,top=30mm,bottom=35mm]{geometry}

\begin{document}
\noindent Dem ..... zu Folge, kann jede der $k$ Dimensionen aus Gleichung () einzeln regressiert werden. Bei Annahme zentrierter Daten ergibt sich
\begin{flalign*}
 &\begin{bmatrix}
y_{p+1,i} \\
y_{p+2,i}  \\
\vdots \\
\vdots \\
y_{T,i}
\end{bmatrix} =
 \begin{bmatrix}
y_{p,1} & \cdots & y_{p,k} & \cdots & \cdots & y_{1,1} & \cdots & y_{1,k}  \\
y_{p+1,1} & \cdots & y_{p+1,k} & \cdots & \cdots & y_{2,1} & \cdots & y_{2,k}    \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots  \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots  \\
y_{T-1,1} & \cdots & y_{T-1,k} & \cdots & \cdots & y_{T-p,1} & \cdots & y_{T-p,k}  
\end{bmatrix}
 \begin{bmatrix}
\Phi_{1,1,i} \\
\Phi_{1,2,i}  \\
\vdots \\
\vdots \\
\Phi_{p,k,i}
\end{bmatrix} +
 \begin{bmatrix}
\varepsilon_{p+1,i} \\
\varepsilon_{p+2,i}  \\
\vdots \\
\vdots \\
\varepsilon_{T,i}
\end{bmatrix}, &
\end{flalign*}
für $i=1,\dots,k$. Mit $\mathbb{Z}$ als Lagmatrix gilt für die $i$-te Dimension äquivalent
\end{document}
3
  • In the larger matrix you have two columns of dots. With one column the equation fits. Or you might need to break the equation on two lines. – campa Aug 27 '18 at 9:15
  • I used the two columns of dots to show that the distance between the cells is larger – Leo96 Aug 27 '18 at 9:20
  • Can I somehow reduce the space on the left. There is a bit of space that can be used – Leo96 Aug 27 '18 at 9:21
3

Don't use flalign* to begin with; using just equation* will reduce the amount of overfilling. With flalign* I get an overfull of 30.88466pt, with equation* it is 14.19312pt.

Next, you can avoid the double columns and rows of dots and, if you wish, decrease the amount of padding between columns. Do it locally, so only the big matrix will be affected.

Without decreasing \arraycolsep the overfull is a mere 1.93335pt, which could also be cured by inserting \!\! after the big matrix. However, reducing \arraycolsep by 2pt will make the display much shorter and better.

I also add a trick for lowering the subscripts (add an empty superscript), which improves the appearance of the capital letter subscripts.

\documentclass[a4paper]{scrartcl}
\usepackage[T1]{fontenc} % mandatory for German
\usepackage[ngerman]{babel}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}

\usepackage[paper=a4paper,left=40mm,right=30mm,top=30mm,bottom=35mm]{geometry}

\newcommand{\evdots}{\hspace*{0.25em}\vdots\hspace*{0.25em}}

\begin{document}
\noindent Dem ..... zu Folge, kann jede der $k$ Dimensionen aus Gleichung () einzeln regressiert werden. Bei Annahme zentrierter Daten ergibt sich
\begin{equation*}
\begin{bmatrix}
y^{}_{p+1,i} \\
y^{}_{p+2,i}  \\
\vdots \\
y^{}_{T,i}
\end{bmatrix} =
\begingroup\addtolength{\arraycolsep}{-2pt}
\begin{bmatrix}
y^{}_{p,1} & \dots & y^{}_{p,k} & \hdotsfor{2} & y^{}_{1,1} & \dots & y^{}_{1,k}  \\
y^{}_{p+1,1} & \dots & y^{}_{p+1,k} & \hdotsfor{2} & y^{}_{2,1} & \dots & y^{}_{2,k}    \\
\vdots & \vdots & \vdots & \evdots & \evdots & \vdots & \vdots & \vdots  \\
y^{}_{T-1,1} & \dots & y^{}_{T-1,k} & \hdotsfor{2} & y^{}_{T-p,1} & \dots & y^{}_{T-p,k}  
\end{bmatrix}
\endgroup
\begin{bmatrix}
\Phi_{1,1,i} \\
\Phi_{1,2,i}  \\
\vdots \\
\Phi_{p,k,i}
\end{bmatrix} +
\begin{bmatrix}
\varepsilon^{}_{p+1,i} \\
\varepsilon^{}_{p+2,i}  \\
\vdots \\
\varepsilon^{}_{T,i}
\end{bmatrix}, 
\end{equation*}
für $i=1,\dots,k$. Mit $\mathbb{Z}$ als Lagmatrix gilt für die $i$-te Dimension äquivalent
\end{document}

enter image description here

1

You simply can play with the value of \arraycolsep (locally): setting it to 4pt, instead of 5, is enough. I took the opportunity to add some improvements to your matrices (at least from my point of view):

\documentclass[a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage[paper=a4paper,left=40mm,right=30mm,top=30mm,bottom=35mm, showframe]{geometry}

\begin{document}

\noindent Dem ..... zu Folge, kann jede der $k$ Dimensionen aus Gleichung () einzeln regressiert werden. Bei Annahme zentrierter Daten ergibt sich
\begin{equation*}
\setlength{\arraycolsep}{4pt}
 \begin{bmatrix}
y_{p+1,i} \\
y_{p+2,i} \\
\vdots \\[-1.5ex]
\vdots \\[-1ex]
y_{T,i}
\end{bmatrix} =
 \begin{bmatrix}
y_{p,1} & \cdots & y_{p,k} & \hdotsfor{2} & y_{1,1} & \cdots & y_{1,k} \\
y_{p+1,1} & \cdots & y_{p+1,k} & \hdotsfor{2} & y_{2,1} & \cdots & y_{2,k} \\
\vdots & \vdots & \vdots & \multicolumn{2}{c}{\vdots} & \vdots & \vdots & \vdots \\[-1.5ex]
\vdots & \vdots & \vdots & \multicolumn{2}{c}{\vdots} & \vdots & \vdots & \vdots \\[-1ex]
y_{T-1,1} & \cdots & y_{T-1,k} & \multicolumn{2}{c}{\ldots\ldots} & y_{T-p,1} & \cdots & y_{T-p,k}
\end{bmatrix}%
 \begin{bmatrix}
\Phi_{1,1,i} \\
\Phi_{1,2,i} \\
\vdots \\[-1.5ex]
\vdots \\[-1ex]
\Phi_{p,k,i}
\end{bmatrix} +
 \begin{bmatrix}
\varepsilon_{p+1,i} \\
\varepsilon_{p+2,i} \\
\vdots \\[-1.5ex]
\vdots \\[-1ex]
\varepsilon_{T,i}
\end{bmatrix},
\end{equation*}
für $i=1,\dots,k$. Mit $\mathbb{Z}$ als Lagmatrix gilt für die $i$-te Dimension äquivalent

\end{document}

enter image description here

1
  • @egreg: You're right. I had already done it, but I copied an initial version. I'll fix it at once. – Bernard Aug 27 '18 at 11:01

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.