调整矩阵大小以适合页面宽度

调整矩阵大小以适合页面宽度

我正在尝试调整矩阵的大小,使其适合页面宽度。我读过一些解决方案,但我已经在文档中使用其他矩阵,我正在尝试寻找一种只会更改一个矩阵环境的解决方案。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage[makeroom]{cancel}
\begin{document}

\begin{align}


\begin{bmatrix}
\dfrac{-\lambda u_t}{u^2}+uu_x-(-u_xu_{xx}-uu_{xxx}-2u_xu_{xx}) & i (+uu_{xx}+u_x^2-4 \lambda^2)+2i\lambda (u_x+2\lambda)-(i(u^2_x+uu_{xx}+2\lambda u_x)) \\


i(-uu_{xx}-u_x^2+4\lambda^2)+2i\lambda (u_x-2 \lambda)+i(u^2_x+uu_{xx}-2\lambda u_x) & \dfrac{\lambda u_t}{u^2}-uu_x-(u_x u_{xx}+uu_{xxx}+2u_x u_{xx})\\
\end{bmatrix}

\end{align}
\end{document}

答案1

在此处输入图片描述

  • 任何方程式中的代码都不能是空行
  • 为了将方程缩小到文本宽度,我建议使用包\medmath中的nccmath函数(这将方程大小缩小约 1/4)
  • 将长数学术语拆分为两行:
\documentclass{article}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}

\usepackage{nccmath, mathtools}
\usepackage{multicol}
\usepackage[makeroom]{cancel}
\begin{document}

\begin{align}\setlength\arraycolsep{1pt}
\medmath{
\begin{bmatrix}
\begin{multlined}
-\mfrac{\lambda u_t}{u^2}+uu_x  \\
-(-u_xu_{xx}-uu_{xxx}-2u_xu_{xx}) 
\end{multlined} &   \begin{multlined}
                    i(+uu_{xx}+u_x^2-4 \lambda^2)+2i\lambda (u_x+2\lambda)  \\ 
                    - i(u^2_x+uu_{xx}+2\lambda u_x)
                    \end{multlined}     \\[7ex]
\begin{multlined}
i(-uu_{xx}-u_x^2+4\lambda^2)    \\
+2i\lambda (u_x-2 \lambda)+i(u^2_x+uu_{xx}-2\lambda u_x)
\end{multlined} &   \begin{multlined}
                    \mfrac{\lambda u_t}{u^2} - uu_x \\
                    -(u_x u_{xx}+uu_{xxx}+2u_x u_{xx})
                    \end{multlined}
\end{bmatrix}}
\end{align}
\end{document}

答案2

缩小文本应该只是最后的手段(即使如此也要避免这样做)

我将使用如下布局

在此处输入图片描述

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage[makeroom]{cancel}
\begin{document}

\begin{equation}% don't use align if no alignment
\begin{bmatrix}a_{11}&a_{12}\\a_{21}&a_{22}\end{bmatrix}
\end{equation}
where
\begin{align*}
a_{11}&=\frac{-\lambda u_t}{u^2}+uu_x-(-u_xu_{xx}-uu_{xxx}-2u_xu_{xx})\\
a_{12}&=i (+uu_{xx}+u_x^2-4 \lambda^2)+2i\lambda (u_x+2\lambda)-(i(u^2_x+uu_{xx}+2\lambda u_x)) \\
a_{21}&=i(-uu_{xx}-u_x^2+4\lambda^2)+2i\lambda (u_x-2 \lambda)+i(u^2_x+uu_{xx}-2\lambda u_x) \\
a_{22}&=\frac{\lambda u_t}{u^2}-uu_x-(u_x u_{xx}+uu_{xxx}+2u_x u_{xx})
\end{align*}
\end{document}

答案3

如果您尝试在文本宽度内修复方程式,请尝试使用adjustbox.sty,但分辨率可能会影响,这里是MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage[makeroom]{cancel}
\usepackage{adjustbox}
\begin{document}

\noindent\adjustbox{minipage=[r][0.5\textwidth][b]{0.25\textwidth},scale={0.6}}{
\begin{align}
\begin{bmatrix}
\dfrac{-\lambda u_t}{u^2}+uu_x-(-u_xu_{xx}-uu_{xxx}-2u_xu_{xx}) & i (+uu_{xx}+u_x^2-4 \lambda^2)+2i\lambda (u_x+2\lambda)-(i(u^2_x+uu_{xx}+2\lambda u_x)) \\
i(-uu_{xx}-u_x^2+4\lambda^2)+2i\lambda (u_x-2 \lambda)+i(u^2_x+uu_{xx}-2\lambda u_x) & \dfrac{\lambda u_t}{u^2}-uu_x-(u_x u_{xx}+uu_{xxx}+2u_x u_{xx})\\
\end{bmatrix}
\end{align}
}


\end{document}

相关内容