我有一个大型矩阵,编译后会从 pdf 中删除。\resizebox{0.94\textwidth}{!}{%$...$}
我遵循了一个建议,但这导致我剩余的工作之间有很大的垂直空间。矩阵无法更改,必须按原样显示。如果您有建议,不需要
\resizebox
,我们将非常感激,但它的所有元素必须按原样出现。
\documentclass[fleqn]{book}
%%CreatedwithwxMaxima22.04.0
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{iftex}
\ifPDFTeX
%PDFLaTeXorLaTeX
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}}
\else
%XeLaTeXorLuaLaTeX
\usepackage{fontspec}
\fi
\usepackage{graphicx}
\usepackage{color}
\usepackage{amsmath,amssymb,mathtools}
\usepackage{grffile}
\usepackage{ifthen}
\newsavebox{\picturebox}
\newlength{\pictureboxwidth}
\newlength{\pictureboxheight}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand{\includeimage}[1]{
\savebox{\picturebox}{\includegraphics{#1}}
\settoheight{\pictureboxheight}{\usebox{\picturebox}}
\settowidth{\pictureboxwidth}{\usebox{\picturebox}}
\ifthenelse{\lengthtest{\pictureboxwidth>.95\linewidth}}
{
\includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1}
}
{
\ifthenelse{\lengthtest{\pictureboxheight>.80\textheight}}
{
\includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1}
}
{
\includegraphics{#1}
}
}
}
\newlength{\thislabelwidth}
\DeclareMathOperator{\abs}{abs}
\definecolor{labelcolor}{RGB}{100,0,0}
\begin{document}
{\begin{equation}\label{mat}
\hspace*{-0.5cm}
\renewcommand\arraystretch{2.25}
\medmuskip=0mu
\setlength\arraycolsep{2.5pt} % default: 5pt
\resizebox{1.35\textwidth}{!}{%
$D=\begin{bmatrix}
1 &{x_{n+1}-h} & {\bigg(x_{n+1}-h\bigg)^2} & {\bigg(x_{n+1}-h\bigg)^3} & {\bigg(x_{n+1}-h\bigg)^4} & {\bigg(x_{n+1}-h\bigg)^5} & {\bigg(x_{n+1}-h\bigg)^6} & {\bigg(x_{n+1}-h\bigg)^7} & {\bigg(x_{n+1}-h\bigg)^8} & {\bigg(x_{n+1}-h\bigg)^9}\\
0 & 1 & 2 {\bigg(x_{n+1}-h\bigg)} & 3 {\bigg(x_{n+1} -h\bigg)^2} & 4 {\bigg(x_{n+1} -h\bigg)^3} & 5 {\bigg(x_{n+1} -h\bigg)^4} & 6 {\bigg(x_{n+1} -h\bigg)^5} & 7 {\bigg(x_{n+1} -h\bigg)^6} & 8 {\bigg(x_{n+1} -h\bigg)^7} & 9 {\bigg(x_{n+1} -h\bigg)^8}\\
0 & 1 & 2 {x_{n+1}} & 3 {x_{n+1}^2} & 4 {x_{n+1}^3} & 5 {x_{n+1}^4} & 6 {x_{n+1}^5} & 7 {x_{n+1}^6} & 8 {x_{n+1}^7} & 9 {x_{n+1}^8}\\
0 & 1 & 2{\bigg(x_{n+1}+ \frac{1}{2}h\bigg)} & 3{\bigg(x_{n+1}+ \frac{1}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^8}\\
0 & 1 & 2 {\bigg(x_{n+1}+h\bigg)} & 3 {\bigg(x_{n+1} +h\bigg)^2} & 4 {\bigg(x_{n+1} +h\bigg)^3} & 5 {\bigg(x_{n+1} +h\bigg)^4} & 6 {\bigg(x_{n+1} +h\bigg)^5} & 7 {\bigg(x_{n+1} +h\bigg)^6} & 8 {\bigg(x_{n+1} +h\bigg)^7} & 9 {\bigg(x_{n+1} +h\bigg)^8}\\
0 & 1 & 2 {\bigg(x _{n+1}+ \frac{3}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^8}\\
0 & 1 & 2 {\bigg(x_{n+1} +2 h\bigg)} & 3 {\bigg(x_{n+1} +2 h\bigg)^2} & 4 {\bigg(x_{n+1} +2 h\bigg)^3} & 5 {\bigg(x_{n+1} +2 h\bigg)^4} & 6 {\bigg(x_{n+1} +2 h\bigg)^5} & 7 {\bigg(x_{n+1} +2 h\bigg)^6} & 8 {\bigg(x_{n+1} +2 h\bigg)^7} & 9 {\bigg(x_{n+1} +2 h\bigg)^8}\\
0 & 1 & 2{\bigg(x_{n+1}+\frac{5}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^8}\\
0 & 1 & 2 {\bigg(x_{n+1}+3h\bigg)} & 3 {\bigg(x_{n+1}+3h\bigg)^2} & 4 {\bigg(x_{n+1}+3h\bigg)^3} & 5 {\bigg(x_{n+1}+3h\bigg)^4} & 6 {\bigg(x_{n+1}+3h\bigg)^5} & 7 {\bigg(x_{n+1}+3h\bigg)^6} & 8 {\bigg(x_{n+1}+3h\bigg)^7} & 9 {\bigg(x_{n+1}+3h\bigg)^8}\\
0 & 1 & 2 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^3} & 5 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^4} & 6 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^5} & 7 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^6} & 8 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^7} & 9 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^8}
\end{bmatrix}$}
\end{equation}
\par}
The determinant of the new $D$ matrix is:
\begin{equation}det (B) =\frac{15380234690625 h}{64}h^{36}\end{equation}
The inverse of {\eqref{mat}} is the $C$ matrix, which is calculated using \textbf{wxMaxima} codes as shown in the \textbf{Appendix}.
Our sole interest in the $C$ matrix is its first row and the elements are:
\end{document}
另外,我可以在方程环境中使用\hspace*{}
或吗?以及如何将其仅用于特定方程?\hspace
附言:我对 Latex 还很陌生,请用幼儿水平的水平来解释。谢谢
答案1
正如我在评论中提到的,即使你使用“小字体大小”,你的矩阵也无法适应页面。在这里提到的选项中,我提供了一种可能的方法:
- 允许将矩阵分成两部分
- 使每个部分都突出外部文本块边框
(红线表示页面布局)
\documentclass[fleqn]{book}
%\usepackage{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage[strict]{changepage}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{iftex}
\ifPDFTeX
%PDFLaTeXorLaTeX
\usepackage[T1]{fontenc}
\DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}}
\else
%XeLaTeXorLuaLaTeX
\usepackage{fontspec}
\fi
\usepackage{graphicx}
\usepackage{color}
\usepackage{nccmath, amssymb, mathtools}
\setlength\mathindent{0pt}
\begin{document}
\begin{adjustwidth*}{}{-\dimexpr\marginparsep+\marginparwidth}
\begin{multline}
% first part of matrix
D=\left[\begin{matrix*}[l]
1 &{x_{n+1}-h} & {\Bigl(x_{n+1}-h\Bigr)^2} & {\Bigl(x_{n+1}-h\Bigr)^3} & {\Bigl(x_{n+1}-h\Bigr)^4} & {\Bigl(x_{n+1}-h\Bigr)^5} \\
0 & 1 & 2 {\Bigl(x_{n+1}-h\Bigr)} & 3 {\Bigl(x_{n+1} -h\Bigr)^2} & 4 {\Bigl(x_{n+1} -h\Bigr)^3} & 5 {\Bigl(x_{n+1} -h\Bigr)^4} \\
0 & 1 & 2 {x_{n+1}} & 3 {x_{n+1}^2} & 4 {x_{n+1}^3} & 5 {x_{n+1}^4} \\
0 & 1 & 2{\Bigl(x_{n+1}+ \frac{1}{2}h\Bigr)} & 3{\Bigl(x_{n+1}+ \frac{1}{2}h\Bigr)^2} & 4{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^3} & 5{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^4} \\
0 & 1 & 2 {\Bigl(x_{n+1}+h\Bigr)} & 3 {\Bigl(x_{n+1} +h\Bigr)^2} & 4 {\Bigl(x_{n+1} +h\Bigr)^3} & 5 {\Bigl(x_{n+1} +h\Bigr)^4} \\
0 & 1 & 2 {\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)} & 3{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^2} & 4{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^3} & 5{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^4} \\
0 & 1 & 2 {\Bigl(x_{n+1} +2 h\Bigr)} & 3 {\Bigl(x_{n+1} +2 h\Bigr)^2} & 4 {\Bigl(x_{n+1} +2 h\Bigr)^3} & 5 {\Bigl(x_{n+1} +2 h\Bigr)^4} & \\
0 & 1 & 2{\Bigl(x_{n+1}+\frac{5}{2}h\Bigr)} & 3{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^2} & 4{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^3} & 5{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^4} \\
0 & 1 & 2 {\Bigl(x_{n+1}+3h\Bigr)} & 3 {\Bigl(x_{n+1}+3h\Bigr)^2} & 4 {\Bigl(x_{n+1}+3h\Bigr)^3} & 5 {\Bigl(x_{n+1}+3h\Bigr)^4} \\
0 & 1 & 2 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)} & 3{\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^2} & 4{\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^3} & 5 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^4}
\end{matrix*}\right.\quad\dotsm \\
% second part of matrix
\dotsm\quad\left.\begin{matrix*}[l]
{\Bigl(x_{n+1}-h\Bigr)^5} & {\Bigl(x_{n+1}-h\Bigr)^6} & {\Bigl(x_{n+1}-h\Bigr)^7} & {\Bigl(x_{n+1}-h\Bigr)^8} & {\Bigl(x_{n+1}-h\Bigr)^9}\\
5 {\Bigl(x_{n+1} -h\Bigr)^4} & 6 {\Bigl(x_{n+1} -h\Bigr)^5} & 7 {\Bigl(x_{n+1} -h\Bigr)^6} & 8 {\Bigl(x_{n+1} -h\Bigr)^7} & 9 {\Bigl(x_{n+1} -h\Bigr)^8}\\
5 {x_{n+1}^4} & 6 {x_{n+1}^5} & 7 {x_{n+1}^6} & 8 {x_{n+1}^7} & 9 {x_{n+1}^8}\\
5{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^4} & 6{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^5} & 7{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^6} & 8{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^7} & 9{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^8}\\
5 {\Bigl(x_{n+1} +h\Bigr)^4} & 6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width*}\par
The determinant of the new $D$ matrix is:
\begin{equation}
\det (B) =\frac{15380234690625 h}{64}h^{36}
\end{equation}
The inverse of {\eqref{mat}} is the $C$ matrix, which is calculated using \textbf{wxMaxima} codes as shown in the \textbf{Appendix}.
Our sole interest in the $C$ matrix is its first row and the elements are:
\end{document}
答案2
您的示例报告
Overfull \hbox (106.53506pt too wide) detected at line 70
\resizebox
如果你避免并添加一些子术语的符号,它会更具可读性
\documentclass[fleqn]{book}
%%CreatedwithwxMaxima22.04.0
% probably better to use parskip package
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{iftex}
\ifPDFTeX
%PDFLaTeXorLaTeX
% no \usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}}
\else
%XeLaTeXorLuaLaTeX
% no need unless changing fonts \usepackage{fontspec}
\fi
\usepackage{graphicx}
\usepackage{color}
\usepackage{amsmath,amssymb,mathtools}
% no \usepackage{grffile}
\usepackage{ifthen}
\newsavebox{\picturebox}
\newlength{\pictureboxwidth}
\newlength{\pictureboxheight}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
% you need % where %%% marked
% there is no need for this as \includegraphics
% already measures the natural size
\newcommand{\includeimage}[1]{%%%
\savebox{\picturebox}{\includegraphics{#1}}
\settoheight{\pictureboxheight}{\usebox{\picturebox}}
\settowidth{\pictureboxwidth}{\usebox{\picturebox}}
\ifthenelse{\lengthtest{\pictureboxwidth>.95\linewidth}}
{%%%
\includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1}%%%
}
{%%%
\ifthenelse{\lengthtest{\pictureboxheight>.80\textheight}}
{%%%
\includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1}%%%
%%%
}
{%%%
\includegraphics{#1}%%%
}
}
}
\newlength{\thislabelwidth}
\DeclareMathOperator{\abs}{abs}
\definecolor{labelcolor}{RGB}{100,0,0}
\begin{document}
Let $y(i)=x_{n+1}+ih$
{\footnotesize
\setlength\arraycolsep{1.6pt} % default: 5pt
\begin{multline}\label{mat}
\hspace*{-0.5cm}
\renewcommand\arraystretch{2.25}
\medmuskip=0mu
D={}\\
\begin{bmatrix}
1 &y(-1) & \!y(-1)^2\! & y(-1)^3 & y(-1)^4 & y(-1)^5 & y(-1)^6 & y(-1)^7 & y(-1)^8 & y(-1)^9\\
0 & 1 & 2 y(-1)) & 3 y(-1)^2 & 4 y(-1)^3 & 5y(-1)^4 & 6 y(-1)^5 & 7 y(-1)^6 & 8 y(-1)^7 & 9 y(-1)^8\\
0 & 1 & 2 y(0) & 3 y(0)^2 & 4 y(0)^3 & 5 y(0)^4 & 6 y(0)^5 & 7 y(0)^6 & 8 y(0)^7 & 9 y(0)^8\\
0 & 1 & 2y( \frac{1}{2}) & 3y( \frac{1}{2})^2 & 4y( \frac{1}{2})^3 & 5y( \frac{1}{2})^4 & 6y( \frac{1}{2})^5 & 7y( \frac{1}{2})^6 & 8y( \frac{1}{2})^7 & 9y( \frac{1}{2})^8\\
0 & 1 & 2 y(0) & 3 y(0)^2 & 4 y(0)^3 & 5 y(0)^4 & 6 y(0)^5 & 7 y(0)^6 & 8 y(0)^7 & 9 y(0)^8\\
0 & 1 & 2 y( \frac{3}{2}) & 3y( \frac{3}{2})^2 & 4y( \frac{3}{2})^3 & 5y( \frac{3}{2})^4 & 6y( \frac{3}{2})^5 & 7y( \frac{3}{2})^6 & 8y( \frac{3}{2})^7 & 9y( \frac{3}{2})^8\\
0 & 1 & 2 y(2 ) & 3 y(2 )^2 & 4 y(2 )^3 & 5 y(2 )^4 & 6 y(2 )^5 & 7 y(2 )^6 & 8 y(2 )^7 & 9 y(2 )^8\\
0 & 1 & 2y(\frac{5}{2}) & 3y( \frac{5}{2})^2 & 4y( \frac{5}{2})^3 & 5y( \frac{5}{2})^4 & 6y( \frac{5}{2})^5 & 7y( \frac{5}{2})^6 & 8y( \frac{5}{2})^7 & 9y( \frac{5}{2})^8\\
0 & 1 & 2 y(3) & 3 y(3)^2 & 4 y(3)^3 & 5 y(3)^4 & 6 y(3)^5 & 7 y(3)^6 & 8 y(3)^7 & 9 y(3)^8\\
0 & 1 & 2 y( \frac{7}{2}) & 3y( \frac{7}{2})^2 & 4y( \frac{7}{2})^3 & 5 y( \frac{7}{2})^4 & 6 y( \frac{7}{2})^5 & 7 y( \frac{7}{2})^6 & 8 y( \frac{7}{2})^7 & 9 y( \frac{7}{2})^8
\end{bmatrix}
\end{multline}
}
The determinant of the new $D$ matrix is:
\begin{equation}det (B) =\frac{15380234690625 h}{64}h^{36}\end{equation}
The inverse of {\eqref{mat}} is the $C$ matrix, which is calculated using \textbf{wxMaxima} codes as shown in the \textbf{Appendix}.
Our sole interest in the $C$ matrix is its first row and the elements are:
\end{document}