如何自动修复超满的 \hbox?

如何自动修复超满的 \hbox?

问题是“在第 357 行检测到 Overfull \hbox (39.27608pt too wide)”,第一个图像的代码是这样的,问题出现在这里:

\[\begin{array}{cl}
    = & (x-\delta_{n+1})\left|\begin{array}{cccccc}
                    \delta_1 - x & \gamma_2 & & & & \\
                    \gamma_2 & \delta_2 - x & \gamma_3 & & & \\
                    & \cdot & \cdot & \cdot & & \\
                    & & \cdot & \cdot & \cdot & \\
                    & & & \gamma_{n-1} & \delta_{n-1} - x & \gamma_{n} \\
                    & & & & \gamma_{n} & \delta_{n} - x
                   \end{array}  \right| - \\
    - & \gamma_{n+1}^2 \left|\begin{array}{cccccc}
                    \delta_1 - x & \gamma_2 & & & & \\
                    \gamma_2 & \delta_2 - x & \gamma_3 & & & \\
                    & \cdot & \cdot & \cdot & & \\
                    & & \cdot & \cdot & \cdot & \\
                    & & & \gamma_n & \delta_n - x & \gamma_{n+1} \\
                    & & & & \gamma_{n+1} & \delta_{n+1} - x
                   \end{array}  \right| \\

在此处输入图片描述 并且手动解决的错误代码是这样的:

\[\begin{array}{cl}
    = & (x-\delta_{n+1})\left|\begin{array}{cccccc}
                    \delta_1 - x & \gamma_2 & & & & \\
                    \gamma_2 & \delta_2 - x & \gamma_3 & & & \\
                    & \cdot & \cdot & \cdot & & \\
                    & & \cdot & \cdot & \cdot & \\
                    & & & \gamma_{n-1} & \delta_{n-1} - x & \gamma_{n} \\
                    & & & & \gamma_{n} & \delta_{n} - x
                   \end{array}  \right| -  \gamma_{n+1}^2 \left|\begin{array}{cccccc}
                    \delta_1 - x & \gamma_2 & & & & \\
                    \gamma_2 & \delta_2 - x & \gamma_3 & & & \\
                    & \cdot & \cdot & \cdot & & \\
                    & & \cdot & \cdot & \cdot & \\
                    & & & \gamma_n & \delta_n - x & \gamma_{n+1} \\
                    & & & & \gamma_{n+1} & \delta_{n+1} - x
                   \end{array}  \right| \\
    = &  (x-\delta_{n+1})\left|\begin{array}{cccccc}
                    \delta_1 - x & \gamma_2 & & & & \\
                    \gamma_2 & \delta_2 - x & \gamma_3 & & & \\
                    & \cdot & \cdot & \cdot & & \\
                    & & \cdot & \cdot & \cdot & \\
                    & & & \gamma_{n-1} & \delta_{n-1} - x & \gamma_{n} \\
                    & & & & \gamma_{n} & \delta_{n} - x
                   \end{array}  \right| + \gamma_{n+1}^2 \left|\begin{array}{ccccccc}
                    \delta_1 - x & \gamma_2 & & & & & \\
                    \gamma_2 & \delta_2 - x & \gamma_3 & & & & \\
                    & \cdot & \cdot & \cdot & & & \\
                    & & \cdot & \cdot & \cdot & & \\
                    & & & \gamma_n & \delta_n - x & \gamma_{n+1} & \\
                    & & & & \gamma_{n+1} & \delta_{n+1} - x & 1 \\
                    & & & & & 1 & 0
                   \end{array}  \right| \\
\end{array}\]

在此处输入图片描述

答案1

不确定你需要什么“自动方式”。我强烈建议你使用数学包——具体来说,是包中用于多行数学材料的环境——并array用(a)代替align*“外部”结构的环境array和(b)vmatrix代替的环境来替换嵌套环境\left| \begin{array}{...} ... \end{array}\right|

在此处输入图片描述

\documentclass{article} % or some other suitable class
\usepackage{amsmath} % for 'align*' and 'vmatrix' environments, 
                     % and for '\allowdisplaybreaks' macro

\begin{document}
\allowdisplaybreaks
\begingroup % limit scope of next instruction to current TeX group
\renewcommand\arraystretch{1.25} % default value: 1.0
\begin{align*}
 (x-&\delta_{n+1})p_n(x) - \gamma_{n+1}^2p_{n-1}(x) \\
    &= (x-\delta_{n+1})\det(J_n-xId) - \gamma_{n+1}^2\det(J_{n+1}-xId) \\
    &= (x-\delta_{n+1})
       \begin{vmatrix}
            \delta_1{-}x & \gamma_2 \\
            \gamma_2 & \delta_2{-}x & \gamma_3 \\
            & \cdot & \cdot & \cdot \\
            & & \cdot & \cdot & \cdot \\
            & & & \gamma_{n-1} & \delta_{n-1}{-}x & \gamma_{n} \\
            & & & & \gamma_{n} & \delta_{n}{-}x
       \end{vmatrix} \\[\jot]
    &\qquad\quad -\gamma_{n+1}^2 
       \begin{vmatrix}
            \delta_1{-}x & \gamma_2 \\
            \gamma_2 & \delta_2{-}x & \gamma_3 \\
            & \cdot & \cdot & \cdot \\
            & & \cdot & \cdot & \cdot \\
            & & & \gamma_n & \delta_n{-}x & \gamma_{n+1} \\
            & & & & \gamma_{n+1} & \delta_{n+1}{-}x
       \end{vmatrix} \\[2\jot]
    &= (x-\delta_{n+1})
       \begin{vmatrix}
            \delta_1{-}x & \gamma_2 \\
            \gamma_2 & \delta_2{-}x & \gamma_3 \\
            & \cdot & \cdot & \cdot \\
            & & \cdot & \cdot & \cdot \\
            & & & \gamma_{n-1} & \delta_{n-1}{-}x & \gamma_{n} \\
            & & & & \gamma_{n} & \delta_{n}{-}x
       \end{vmatrix} \\[\jot]
    &\qquad\quad +\gamma_{n+1}^2 
       \begin{vmatrix}
            \delta_1{-}x & \gamma_2 \\
            \gamma_2 & \delta_2{-}x & \gamma_3 \\
            & \cdot & \cdot & \cdot \\
            & & \cdot & \cdot & \cdot \\
            & & & \gamma_n & \delta_n{-}x & \gamma_{n+1} \\
            & & & & \gamma_{n+1} & \delta_{n+1}{-}x & 1 \\
            & & & & & 1 & 0
       \end{vmatrix} 
\end{align*}
\endgroup
\end{document}

相关内容