我有一个很长的矩阵,一旦它达到页面的宽度限制,我想以拆分形式显示它。我尝试使用拆分,但没有成功。我是乳胶新手,所以有很多命令我不知道。谢谢。
\documentclass[a4paper,twoside,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,bm}
\begin{document}
%%%% use split
\noindent % to emulate a preceding text
\[
\begin{split}
\begin{split}
{
\left[ \begin {array}{cccccccccccc} k_{p}+k_{c}&0&0&0&0&0&0&0&0&-k_{p
}&0&0\\ \noalign{\medskip}0&k_{p}+k_{c}&k_{p}&0&0&0&0&0&0&0&-k_{p}&0
\\ \noalign{\medskip}0&k_{p}&k_{p}+k_{{\it cu}}&0&0&0&0&0&0&0&-k_{p}&0
\\ \noalign{\medskip}0&0&0&-k_{m}\, \left( \cos \left( \alpha \right)
\right) ^{2}+k_{m}+k_{r}&-k_{m}\,\cos \left( \alpha \right) \sin
\left( \alpha \right) &-k_{m}\,\sin \left( \alpha \right) &0&0&0&k_{m
}\, \left( \cos \left( \alpha \right) \right) ^{2}-k_{m}&k_{m}\,\cos
\left( \alpha \right) \sin \left( \alpha \right) &k_{m}\,\sin \left(
\alpha \right) \\ \noalign{\medskip}0&0&0&-k_{m}\,\cos \left( \alpha
\right) \sin \left( \alpha \right) &k_{m}\, \left( \cos \left( \alpha
\right) \right) ^{2}+k_{r}&k_{m}\,\cos \left( \alpha \right) &0&0&0&
k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha \right) &-k_{m}\,
\left( \cos \left( \alpha \right) \right) ^{2}&-k_{m}\,\cos \left(
\alpha \right) \\ \noalign{\medskip}0&0&0&-k_{m}\,\sin \left( \alpha
\right) &k_{m}\,\cos \left( \alpha \right) &k_{m}+k_{{\it ru}}&0&0&0&
k_{m}\,\sin \left( \alpha \right) &-k_{m}\,\cos \left( \alpha \right)
&-k_{m}\\ \noalign{\medskip}0&0&0&0&0&0&-k_{m}\, \left( \cos \left(
\alpha \right) \right) ^{2}+k_{m}+k_{s}&k_{m}\,\cos \left( \alpha
\right) \sin \left( \alpha \right) &k_{m}\,\sin \left( \alpha
\right) &k_{m}\, \left( \cos \left( \alpha \right) \right) ^{2}-k_{m
}&-k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha \right) &k_{m}
\,\sin \left( \alpha \right) \\ \noalign{\medskip}0&0&0&0&0&0&k_{m}\,
\cos \left( \alpha \right) \sin \left( \alpha \right) &k_{m}\, \left(
\cos \left( \alpha \right) \right) ^{2}+k_{s}&k_{m}\,\cos \left(
\alpha \right) &-k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha
\right) &-k_{m}\, \left( \cos \left( \alpha \right) \right) ^{2}&k_{
m}\,\cos \left( \alpha \right) \\ \noalign{\medskip}0&0&0&0&0&0&k_{m}
\,\sin \left( \alpha \right) &k_{m}\,\cos \left( \alpha \right) &k_{m}
+k_{{\it su}}&-k_{m}\,\sin \left( \alpha \right) &-k_{m}\,\cos \left(
\alpha \right) &k_{m}\\ \noalign{\medskip}-k_{p}&0&0&k_{m}\, \left(
\cos \left( \alpha \right) \right) ^{2}-k_{m}&k_{m}\,\cos \left(
\alpha \right) \sin \left( \alpha \right) &k_{m}\,\sin \left( \alpha
\right) &k_{m}\, \left( \cos \left( \alpha \right) \right) ^{2}-k_{m
}&-k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha \right) &-k_{m
}\,\sin \left( \alpha \right) &-2\,k_{m}\, \left( \cos \left( \alpha
\right) \right) ^{2}+2\,k_{m}+k_{p}&0&-2\,k_{m}\,\sin \left( \alpha
\right) \\ \noalign{\medskip}0&-k_{p}&-k_{p}&k_{m}\,\cos \left(
\alpha \right) \sin \left( \alpha \right) &-k_{m}\, \left( \cos
\left( \alpha \right) \right) ^{2}&-k_{m}\,\cos \left( \alpha
\right) &-k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha
\right) &-k_{m}\, \left( \cos \left( \alpha \right) \right) ^{2}&-k_
{m}\,\cos \left( \alpha \right) &0&2\,k_{m}\, \left( \cos \left(
\alpha \right) \right) ^{2}+k_{p}&0\\ \noalign{\medskip}0&0&0&k_{m}\,
\sin \left( \alpha \right) &-k_{m}\,\cos \left( \alpha \right) &-k_{m}
&k_{m}\,\sin \left( \alpha \right) &k_{m}\,\cos \left( \alpha \right)
&k_{m}&-2\,k_{m}\,\sin \left( \alpha \right) &0&2\,k_{m}\end {array}
\right]
}
\end{split}
\end{split}
\]
\end{document}
答案1
我尝试修改你的机器生成的代码,使其输出占用更少的空间。例如,我已将所有 156 个 [!!] 和 替换为 和,\left(
从而节省了大量空间。我们应该走得更远,例如删除 和 中的所有括号实例——相信我,所有这些括号都占用了\right)
(
)
\cos(\alpha)
\sin(\alpha)
很多空间。同样,我删除了所有 50 多个实例\,
。即使进行了所有这些优化,也几乎肯定需要切换到横向模式并采用指令\resizebox
。
在我看来,结果几乎无法阅读。读者只需看一眼排版矩阵,就几乎无法理解。如果这是我的文档,而我必须展示几个 12x12 矩阵,我要么拒绝这样做,要么展示四个独立的 6x6 矩阵或四个独立的 12x3 矩阵。
\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,rotating}
\usepackage[margin=2.5cm]{geometry} % set page parameters suitably
\begin{document}
\begin{sidewaystable}
\setcounter{MaxMatrixCols}{12}
\renewcommand\arraystretch{1.25}
\resizebox{\textwidth}{!}{%
$\begin{bmatrix}
k_p+k_c &0&0&0&0&0&0&0&0& -k_p &0&0\\
0&k_p+k_c&k_p&0&0&0&0&0&0&0&-k_p&0\\
0&k_p&k_p+k_{\mathit{cu}}&0&0&0&0&0&0&0
&-k_p&0\\
0&0&0&-k_m (\cos\alpha)^2+k_m+k_r
&-k_m\cos\alpha \sin\alpha &-k_m\sin\alpha
&0&0&0&k_m (\cos\alpha)^2-k_m
&k_m\cos\alpha \sin\alpha &k_m\sin\alpha \\
0&0&0&-k_m\cos\alpha \sin\alpha
&k_m (\cos\alpha)^2+k_r& k_m\cos\alpha
&0&0&0& k_m\cos\alpha \sin\alpha
& -k_m(\cos\alpha)^2& -k_m\cos\alpha \\
0&0&0&-k_m\sin\alpha &k_m\cos\alpha
&k_m+k_{\mathit{ru}}&0&0&0&k_m\sin\alpha
&-k_m\cos\alpha &-k_m\\
0&0&0&0&0&0&-k_m (\cos\alpha)^2+k_m+k_s
&k_m \cos\alpha \sin\alpha &k_m\sin\alpha
&k_m (\cos\alpha)^2-k_m&-k_m\cos\alpha \sin\alpha
&k_m \sin\alpha \\
0&0&0&0&0&0&k_m\cos\alpha \sin\alpha
&k_m (\cos\alpha)^2+k_s&k_m\cos\alpha
&-k_m\cos\alpha \sin\alpha
&-k_m (\cos\alpha)^2& k_m\cos\alpha \\
0&0&0&0&0&0&k_m\sin\alpha &k_m\cos\alpha
&k_m+k_{\mathit{su}}&-k_m\sin\alpha
&-k_m\cos\alpha &k_m\\
-k_p&0&0&k_m (\cos\alpha)^2-k_m
&k_m\cos\alpha \sin\alpha & k_m\sin\alpha
&k_m (\cos\alpha)^2-k_m&-k_m\cos\alpha \sin\alpha
&-k_m\sin\alpha &-2k_m (\cos\alpha)^2 +2k_m+k_p
&0&-2k_m\sin\alpha\\
0&-k_p&-k_p&k_m\cos\alpha \sin\alpha
&-k_m (\cos\alpha)^2 & -k_m\cos\alpha
&-k_m\cos\alpha \sin\alpha &-k_m (\cos\alpha)^2
&-k_m\cos\alpha &0&2k_m (\cos\alpha)^2+k_p&0\\
0&0&0&k_m\sin\alpha &-k_m\cos\alpha &-k_m
&k_m\sin\alpha &k_m\cos\alpha &k_m
&-2k_m\sin\alpha &0&2k_m
\end{bmatrix}$}
\end{sidewaystable}
\end{document}
答案2
将其调整为横向视图:
\documentclass[a4paper,twoside,12pt]{book}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,bm}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\noindent
\resizebox{\linewidth}{!}{$%
\left[ \begin {array}{cccccccccccc} k_{p}+k_{c}&0&0&0&0&0&0&0&0&-k_{p
}&0&0\\ \noalign{\medskip}0&k_{p}+k_{c}&k_{p}&0&0&0&0&0&0&0&-k_{p}&0
\\ \noalign{\medskip}0&k_{p}&k_{p}+k_{{\it cu}}&0&0&0&0&0&0&0&-k_{p}&0
\\ \noalign{\medskip}0&0&0&-k_{m}\, \left( \cos \left( \alpha \right)
\right) ^{2}+k_{m}+k_{r}&-k_{m}\,\cos \left( \alpha \right) \sin
\left( \alpha \right) &-k_{m}\,\sin \left( \alpha \right) &0&0&0&k_{m
}\, \left( \cos \left( \alpha \right) \right) ^{2}-k_{m}&k_{m}\,\cos
\left( \alpha \right) \sin \left( \alpha \right) &k_{m}\,\sin \left(
\alpha \right) \\ \noalign{\medskip}0&0&0&-k_{m}\,\cos \left( \alpha
\right) \sin \left( \alpha \right) &k_{m}\, \left( \cos \left( \alpha
\right) \right) ^{2}+k_{r}&k_{m}\,\cos \left( \alpha \right) &0&0&0&
k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha \right) &-k_{m}\,
\left( \cos \left( \alpha \right) \right) ^{2}&-k_{m}\,\cos \left(
\alpha \right) \\ \noalign{\medskip}0&0&0&-k_{m}\,\sin \left( \alpha
\right) &k_{m}\,\cos \left( \alpha \right) &k_{m}+k_{{\it ru}}&0&0&0&
k_{m}\,\sin \left( \alpha \right) &-k_{m}\,\cos \left( \alpha \right)
&-k_{m}\\ \noalign{\medskip}0&0&0&0&0&0&-k_{m}\, \left( \cos \left(
\alpha \right) \right) ^{2}+k_{m}+k_{s}&k_{m}\,\cos \left( \alpha
\right) \sin \left( \alpha \right) &k_{m}\,\sin \left( \alpha
\right) &k_{m}\, \left( \cos \left( \alpha \right) \right) ^{2}-k_{m
}&-k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha \right) &k_{m}
\,\sin \left( \alpha \right) \\ \noalign{\medskip}0&0&0&0&0&0&k_{m}\,
\cos \left( \alpha \right) \sin \left( \alpha \right) &k_{m}\, \left(
\cos \left( \alpha \right) \right) ^{2}+k_{s}&k_{m}\,\cos \left(
\alpha \right) &-k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha
\right) &-k_{m}\, \left( \cos \left( \alpha \right) \right) ^{2}&k_{
m}\,\cos \left( \alpha \right) \\ \noalign{\medskip}0&0&0&0&0&0&k_{m}
\,\sin \left( \alpha \right) &k_{m}\,\cos \left( \alpha \right) &k_{m}
+k_{{\it su}}&-k_{m}\,\sin \left( \alpha \right) &-k_{m}\,\cos \left(
\alpha \right) &k_{m}\\ \noalign{\medskip}-k_{p}&0&0&k_{m}\, \left(
\cos \left( \alpha \right) \right) ^{2}-k_{m}&k_{m}\,\cos \left(
\alpha \right) \sin \left( \alpha \right) &k_{m}\,\sin \left( \alpha
\right) &k_{m}\, \left( \cos \left( \alpha \right) \right) ^{2}-k_{m
}&-k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha \right) &-k_{m
}\,\sin \left( \alpha \right) &-2\,k_{m}\, \left( \cos \left( \alpha
\right) \right) ^{2}+2\,k_{m}+k_{p}&0&-2\,k_{m}\,\sin \left( \alpha
\right) \\ \noalign{\medskip}0&-k_{p}&-k_{p}&k_{m}\,\cos \left(
\alpha \right) \sin \left( \alpha \right) &-k_{m}\, \left( \cos
\left( \alpha \right) \right) ^{2}&-k_{m}\,\cos \left( \alpha
\right) &-k_{m}\,\cos \left( \alpha \right) \sin \left( \alpha
\right) &-k_{m}\, \left( \cos \left( \alpha \right) \right) ^{2}&-k_
{m}\,\cos \left( \alpha \right) &0&2\,k_{m}\, \left( \cos \left(
\alpha \right) \right) ^{2}+k_{p}&0\\ \noalign{\medskip}0&0&0&k_{m}\,
\sin \left( \alpha \right) &-k_{m}\,\cos \left( \alpha \right) &-k_{m}
&k_{m}\,\sin \left( \alpha \right) &k_{m}\,\cos \left( \alpha \right)
&k_{m}&-2\,k_{m}\,\sin \left( \alpha \right) &0&2\,k_{m}\end {array}
\right]
$}
\end{landscape}
\end{document}