11

I have read all of the different solutions for fitting long formulas in a page, yet I am still not satisfied with the output I get. The formulas are right aligned which does not look good. Would you please let me know if you have a better solution. This is my code:

\begin{equation}

\begin{split}
(1-\mathbf{B})\begin{bmatrix} y_1\\y_2  \\ y_3 \end{bmatrix} &= \\
(\begin{bmatrix} 1\\1  \\ 1 \end{bmatrix}-\begin{bmatrix} 0.30064^{*} & -0.70171 &-10.27380 \\ 0.00206 &  0.35560^{*} &  -0.62373 \\  0.00013 & 0.00228 &  0.77829^{*} \end{bmatrix}\mathbf{B}-\\
\begin{bmatrix} -0.24890^{*} &  0.53801 &  -3.03724 \\  -0.00600 &   0.20570^{*} &  -1.04583 \\ -0.00010 & -0.00189 &  0.27768^{*}  \end{bmatrix}\mathbf{B}^2-\\
\begin{bmatrix} 0.61824^{*} &  0.33973 & -1.09651 \\  -0.00287 &   -0.12782 & 2.79815 \\  -0.00002 & -0.00249 &  -0.07773 \end{bmatrix}\mathbf{B}^3) \begin{bmatrix} \varepsilon_{1t} \\ \varepsilon_{2t} \\ \varepsilon_{3t}  \end{bmatrix}
\end{split}
\end{equation}
  • 4
    welcome to tex.sx, it's helpful (for future questions) to always include complete documents showing all packages used (as in my answer) rather than fragments. – David Carlisle Apr 11 '13 at 0:59
12

Long equations like this can sometimes hide the important details- I would consider using local definitions, such as

screenshot

Here's a complete MWE

% arara: pdflatex
% !arara: indent: {overwrite: true}
\documentclass{article}
\usepackage{amsmath}

\begin{document}

Consider the equation
\begin{equation}
    (1-\mathbf{B})\vec{y} = (1-M_1-M_2\mathbf{B}^2-M_3\mathbf{B}^3)\vec{\epsilon}
\end{equation}
where
\begin{align*}
    M_1 & = \begin{bmatrix} 0.30064^{*}  & -0.70171 & -10.27380 \\ 0.00206 &  0.35560^{*} &  -0.62373 \\  0.00013 & 0.00228 &  0.77829^{*} \end{bmatrix}\\
    M_2 & = \begin{bmatrix} -0.24890^{*} & 0.53801  & -3.03724  \\  -0.00600 &   0.20570^{*} &  -1.04583 \\ -0.00010 & -0.00189 &  0.27768^{*}  \end{bmatrix}\\
    M_3 & = \begin{bmatrix} 0.61824^{*}   & 0.33973  & -1.09651  \\  -0.00287 &   -0.12782 & 2.79815 \\  -0.00002 & -0.00249 &  -0.07773 \end{bmatrix}
\end{align*}
\end{document}

Further enhancements can be made using the siunitx package to help with decimal alignment.

siunitx

% arara: pdflatex
% !arara: indent: {overwrite: on, localSettings: true}
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

Consider the equation
\begin{equation}
    (1-\mathbf{B})\vec{y} = (1-M_1\mathbf{B}-M_2\mathbf{B}^2-M_3\mathbf{B}^3)\vec{\epsilon}
\end{equation}
where
\begin{align*}
    M_1 & = 
    \left[
        \setlength{\arraycolsep}{10pt}
        \begin{array}{S[table-format=1.5] S[table-format=1.5] S[table-format=2.5]}
            0.30064$^*$ & -0.70171    & -10.27380   \\ 
            0.00206     & 0.35560$^*$ & -0.62373    \\  
            0.00013     & 0.00228     & 0.77829$^*$ 
        \end{array}
    \right]
    \\
    M_2 & = 
    \left[
        \setlength{\arraycolsep}{10pt}
        \begin{array}{S[table-format=1.5] S[table-format=1.5] S[table-format=1.5]}
            -0.24890$^{*}$ & 0.53801       & -3.03724      \\  
            -0.00600       & 0.20570$^{*}$ & -1.04583      \\ 
            -0.00010       & -0.00189      & 0.27768$^{*}$ 
        \end{array}
    \right]
    \\
    M_3 & = 
    \left[
        \setlength{\arraycolsep}{10pt}
        \begin{array}{S[table-format=1.5] S[table-format=1.5] S[table-format=1.5]}
            0.61824$^{*}$ & 0.33973  & -1.09651 \\  
            -0.00287      & -0.12782 & 2.79815  \\  
            -0.00002      & -0.00249 & -0.07773 
        \end{array}
    \right]
\end{align*}
\end{document}
  • 2
    I'd give +2, one for each half of your answer. Though I think the columns are a little tight in your second example. – Ryan Reich Apr 11 '13 at 2:09
  • agreed about good answer ans advice, but it still looks a little raggedy. alignment on the decimal points would improve the appearance greatly. – barbara beeton Apr 11 '13 at 12:32
  • @cmhughes -- i see it now -- nice. (i could have sworn it wasn't that nicely aligned with i first looked at it though.) – barbara beeton Apr 11 '13 at 15:19
5

I'd structure the three lines so that the large matrices are aligned vertically. I'd also decimal-align the numbers in the three 3x3 matrices. To that effect, you could use the dcolumn package; this requires using array environments rather than pmatrix environments. You can still use the pmatrix environment for the three column vectors, of course.

enter image description here

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\renewcommand\arraycolsep{3pt} % default value: 6pt
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\begin{document}
\begin{equation}\begin{split} \label{eq:threelign}
(1-\mathbf{B})
\begin{bmatrix} y_1 \\y_2  \\ y_3 \end{bmatrix}
=  \left(
\begin{bmatrix} 1 \\1  \\ 1 \\ \end{bmatrix} 
\right.
&- \left[ \begin{array}{d{2.5}d{3.5}d{3.5}} 
0.30064^{*} & -0.70171 &-10.27380 \\ 
0.00206 &  0.35560^{*} &  -0.62373 \\  
0.00013 & 0.00228 &  0.77829^{*} \\
\end{array}\right] \mathbf{B} \\
&- \left[ \begin{array}{d{2.5}d{3.5}d{3.5}} 
-0.24890^{*} &  0.53801 &  -3.03724 \\  
-0.00600 &   0.20570^{*} &  -1.04583 \\ 
-0.00010 & -0.00189 &  0.27768^{*} \\ 
\end{array}\right] \mathbf{B}^2  \\
&- \left.
   \left[ \begin{array}{d{2.5}d{3.5}d{3.5}} 
0.61824^{*} &  0.33973 & -1.09651 \\  
-0.00287 &   -0.12782 & 2.79815 \\  
-0.00002 & -0.00249 &  -0.07773 
\end{array}\right] \mathbf{B}^3
\right) 
\begin{bmatrix} 
\varepsilon_{1t} \\ \varepsilon_{2t} \\ \varepsilon_{3t}  
\end{bmatrix}
\end{split}\end{equation}
\end{document}
4

Here's another possibility:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{split}
(1-\mathbf{B})
\begin{bmatrix} y_1\\y_2  \\ y_3 \end{bmatrix} 
&= 
\left(\begin{bmatrix} 1\\1  \\ 1 \end{bmatrix}
- \begin{bmatrix} 0.30064^{*} & -0.70171 & -10.27380 \\ 0.00206 &  0.35560^{*} &  -0.62373 \\  0.00013 & 0.00228 &  0.77829^{*} \end{bmatrix}\mathbf{B}\right. \\
&\qquad{} - \begin{bmatrix} -0.24890^{*} &  0.53801 &  -3.03724 \\  -0.00600 &   0.20570^{*} &  -1.04583 \\ -0.00010 & -0.00189 &  0.27768^{*}  \end{bmatrix}\mathbf{B}^2\\
&\qquad{} - \left.\begin{bmatrix} 0.61824^{*} &  0.33973 & -1.09651 \\  -0.00287 &   -0.12782 & 2.79815 \\  -0.00002 & -0.00249 &  -0.07773 \end{bmatrix}\mathbf{B}^3\right) \begin{bmatrix} \varepsilon_{1t} \\ \varepsilon_{2t} \\ \varepsilon_{3t}  \end{bmatrix}
\end{split}
\end{equation}

\end{document}

enter image description here

Notice the use of pairs \left...\right to get the big delimiters, and also of {} - ... so that the minus signs at the beginning of lines get treated as binary operators.

3

Perhaps multline here as there is not really any alignment point:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

original equation/split
\begin{equation}
\begin{split}
(1-\mathbf{B})\begin{bmatrix} y_1\\y_2  \\ y_3 \end{bmatrix} &= \\
(\begin{bmatrix} 1\\1  \\ 1 \end{bmatrix}-\begin{bmatrix} 0.30064^{*} & -0.70171 &-10.27380 \\ 0.00206 &  0.35560^{*} &  -0.62373 \\  0.00013 & 0.00228 &  0.77829^{*} \end{bmatrix}\mathbf{B}-\\
\begin{bmatrix} -0.24890^{*} &  0.53801 &  -3.03724 \\  -0.00600 &   0.20570^{*} &  -1.04583 \\ -0.00010 & -0.00189 &  0.27768^{*}  \end{bmatrix}\mathbf{B}^2-\\
\begin{bmatrix} 0.61824^{*} &  0.33973 & -1.09651 \\  -0.00287 &   -0.12782 & 2.79815 \\  -0.00002 & -0.00249 &  -0.07773 \end{bmatrix}\mathbf{B}^3) \begin{bmatrix} \varepsilon_{1t} \\ \varepsilon_{2t} \\ \varepsilon_{3t}  \end{bmatrix}
\end{split}
\end{equation}



new multline
\begin{multline}
(1-\mathbf{B})\begin{bmatrix} y_1\\y_2  \\ y_3 \end{bmatrix} = {}\\
\Biggl(\begin{bmatrix} 1\\1  \\ 1 \end{bmatrix}-\begin{bmatrix} 0.30064^{*} & -0.70171 &-10.27380 \\ 0.00206 &  0.35560^{*} &  -0.62373 \\  0.00013 & 0.00228 &  0.77829^{*} \end{bmatrix}\mathbf{B}-{}\\
\begin{bmatrix} -0.24890^{*} &  0.53801 &  -3.03724 \\  -0.00600 &   0.20570^{*} &  -1.04583 \\ -0.00010 & -0.00189 &  0.27768^{*}  \end{bmatrix}\mathbf{B}^2-{}\\
\begin{bmatrix} 0.61824^{*} &  0.33973 & -1.09651 \\  -0.00287 &   -0.12782 & 2.79815 \\  -0.00002 & -0.00249 &  -0.07773 \end{bmatrix}\mathbf{B}^3\Biggr)
 \begin{bmatrix} \varepsilon_{1t} \\ \varepsilon_{2t} \\ \varepsilon_{3t}  \end{bmatrix}
\end{multline}


\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.