2

I asked a question here on how to align tables differently on even and odd pages. Now I need to do the same for equations written in align environment. I tried the same trick proposed for tables. They did not seem to work. Could anyone help me with this please? Thanks. My example is as follows.

\documentclass[a4paper, twoside, hidelinks, 11pt]{book}

\usepackage{lipsum}
\usepackage{amsmath}

\begin{document}

\lipsum

\begin{align*}
\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1}                    & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1}                    & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.
\end{align*}

\end{document}

enter image description here

  • 1
    I'd say the overriding problem with this equation is that it's too wide and doesn't fit inside the text block. Are you asking for advice on how to make equation fit in the text block? This issue isn't really related to whether the equation is on a recto or a verso page. – Mico Aug 14 '15 at 11:17
  • I am asking whether I can let this equation take up the outer margin just like how the table can be moved in my previous question. – LaTeXFan Aug 14 '15 at 11:19
4

I propose two solutions:

  • either you use \mathclap (from mathtools) so the equation overflows equally on both sides. A variant consists additionally in setting a smaller value of arraycolsep.
  • or you use the medsize environment (from nccmath).

Let me add that if you load geometry(without any option), you have more sensible margins and there is no problem.

\documentclass[a4paper, twoside, hidelinks, 11pt]{book}

\usepackage{lipsum}
\usepackage{mathtools, nccmath}

\begin{document}

\lipsum

\[ \mathclap{\frac{\sigma^2}{n}
    \begin{bmatrix}
      \alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
      \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
      \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
    \end{bmatrix}.} \]
  \vskip0.5cm

  \[ \setlength\arraycolsep{3pt}
    \mathclap{\frac{\sigma^2}{n}
      \begin{bmatrix}
        \alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
        \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
        \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
      \end{bmatrix}.} \]
    \vskip0.5cm

    \[ \frac{\sigma^2}{n}
      \begin{medsize}\begin{bmatrix}
        \alpha_1(1-\alpha_1)^{2\xi_0-1} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
        \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
        \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
        \end{bmatrix}\end{medsize}. \]



\end{document}

enter image description here 

enter image description here

3

Rather than let the equation spill into one or both margins, I suggest you find ways to reduce its size. One way to make the matrix fit inside the text block consists of (i) setting the parameter \medmuskip, which governs the space around binary operators (such as -) to zero, (ii) reducing the amount of intercolumn whitespace, and (iii) switching to a slightly smaller font size.

Even better, in my opinion, is not to show the full 3x3 symmetrix matrix at all. Instead, show that the matrix can be written as the outer product of two vectors. Presumably, it's the symmetric structure of the matrix that's really important; I suspect that showing the contents of all nine elements of the 3x3 matrix is much less important.

enter image description here

\documentclass[a4paper, twoside, hidelinks, 11pt]{book}

\usepackage{lipsum}
\usepackage{amsmath}

\begin{document}

\hrule

\medskip
Unmodified: 
\[
\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1}                    & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1}                    & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.
\]


\bigskip
Better: Adjust some of the matrix parameters.
{\small                        % 10% linear font size reduction
\setlength\arraycolsep{2.5pt}  % default value: 5pt
\setlength\medmuskip{0mu}      % default value: 5mu
\[
\frac{\sigma^2}{n}
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{2\xi_0-1}                    & \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} \,& \alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_2)^{\xi_0} & \alpha_2(1-\alpha_2)^{2\xi_0-1}                    & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} \\[5pt]
\alpha_1(1-\alpha_1)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_2(1-\alpha_2)^{\xi_0-1}(1-\alpha_3)^{\xi_0} & \alpha_3(1-\alpha_3)^{2\xi_0-1}
\end{bmatrix}.
\]
}


\bigskip
Best:  Don't show the full $3\times3$ matrix at all.
{\renewcommand\arraystretch{1.3} % increase line spacing
\[
\frac{\sigma^2}{n} 
\begin{bmatrix}
\alpha_1(1-\alpha_1)^{\xi_0-1} \\
\alpha_2(1-\alpha_2)^{\xi_0-1} \\
\alpha_3(1-\alpha_3)^{\xi_0-1} 
\end{bmatrix}
\begin{bmatrix}
(1-\alpha_1)^{\xi_0} & (1-\alpha_2)^{\xi_0}  & (1-\alpha_3)^{\xi_0} 
\end{bmatrix}
\]

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