如何在小页面环境中将带有文本的方程式左对齐,并与右对齐的图形对齐?

如何在小页面环境中将带有文本的方程式左对齐,并与右对齐的图形对齐?

我正在尝试使用 minipage 环境在图形旁边获取方程组。这是我目前得到的结果:

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{caption}

\begin{document}

\noindent The final method to predict the further development of COVID-19 concerns a SEIRD-model, which classifies individuals as susceptible (S), exposed (E), infectious (I), recovered (R) and dead (D). The number of people per class changes over time, according to the following differential equations: \\

\begin{minipage}{0.4\textwidth}
\begin{flalign*}
\frac{dS}{dt} = -\beta S(t)\frac{I(t)}{N(t)} &&\\
\frac{dE}{dt} = \beta S(t)\frac{I(t)}{N(t)} - k E(t)&&\\
\frac{dI}{dt} = k E(t) - (\gamma + \delta) I(t)&&\\
\frac{dR}{dt} = \gamma I(t) &&\\
\frac{dD}{dt} = \delta I(t) \\&&
\end{flalign*}
\end{minipage}%%%
\begin{minipage}{0.6\textwidth}
\includegraphics[width=60mm, height =25mm]{seird4.png}
\captionof{figure}{Visualization of the SEIRD model}
\label{fig:seird} 
\end{minipage}%%% 

\end{document}

我希望方程式在页面左侧对齐,图形在页面右侧对齐,两种情况下都与文本宽度完全对齐。另外,我希望图形在高度上居中,标题紧挨在下方。

到目前为止,我已设法通过在 flalign 环境中分别设置每个方程式,使方程式与图形左侧对齐。然而,这在方程式之间产生了很大的空间(使用 nospaceflalign 修复了这个问题如何在 flalign* 环境后删除不必要的空间),而且它们也没有完全与文本对齐。我尝试使用 来解决这个问题\makebox[\textwidth]{\makebox[1.1\textwidth],这样就能让方程式与文本对齐,但图形的位置要么太靠右,要么在方程式下方。

这是我使用的代码:

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{caption}

\newenvironment{nospaceflalign*}
 {\setlength{\abovedisplayskip}{0pt}\setlength{\belowdisplayskip}{0pt}%
  \csname flalign*\endcsname}
 {\csname endflalign*\endcsname\ignorespacesafterend}

\begin{document}

\noindent The final method to predict the further development of COVID-19 concerns a SEIRD-model, which classifies individuals as susceptible (S), exposed (E), infectious (I), recovered (R) and dead (D). The number of people per class changes over time, according to the following differential equations: \\

\makebox[\textwidth]{\makebox[1.1\textwidth]{%
\begin{minipage}{0.6\textwidth}
%\flushleft
\begin{nospaceflalign*}
\frac{dS}{dt} = -\beta S(t)\frac{I(t)}{N(t)} &&
\end{nospaceflalign*}
\begin{nospaceflalign*}
\frac{dE}{dt} = \beta S(t)\frac{I(t)}{N(t)} - k E(t)&&
\end{nospaceflalign*}
\begin{nospaceflalign*}
\frac{dI}{dt} = k E(t) - (\gamma + \delta) I(t)&&
\end{nospaceflalign*}
\begin{nospaceflalign*}
\frac{dR}{dt} = \gamma I(t) &&
\end{nospaceflalign*}
\begin{nospaceflalign*}
\frac{dD}{dt} = \delta I(t) \\&&
\end{nospaceflalign*}
\end{minipage}%%%
\columnsep 
\begin{minipage}{0.5\textwidth}
\includegraphics[width=60mm, height =25mm]{seird4.png}
\captionof{figure}{Visualization of the SEIRD model}
\label{fig:seird} 
\end{minipage}%%% 
}}

\end{document}

有人知道如何解决这个问题吗?

提前致谢!

答案1

我提出以下其中一种解决方案:一个使用flalign*measuredfigure环境,来自threeparttable,另一个使用  align*嵌套在由 和命令fleqn定义的环境中的简单环境。nccmath\ffigboxfloatrow

\diff无关:我使用来自的命令简化了莱布尼茨符号中导数的输入esdiff

\documentclass{article}
\usepackage[export]{adjustbox}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{esdiff, nccmath}
\usepackage{caption, floatrow}
\usepackage{threeparttable}

\begin{document}

\noindent The final method to predict the further development of COVID-19 concerns a SEIRD-model, which classifies individuals as susceptible (S), exposed (E), infectious (I), recovered (R) and dead (D). The number of people per class changes over time, according to the following differential equations: \\

\noindent\begin{minipage}{0.4\textwidth}
\begin{flalign*}
\diff{S}{t} & = -\beta S(t)\frac{I(t)}{N(t)} & & & &\vrule \\
\diff{E}{t} & = \beta S(t)\frac{I(t)}{N(t)} - k E(t) \\
\diff{I}{t} & = k E(t) - (\gamma + \delta) I(t) \\
\diff{R}{t} & = \gamma I(t) \\
\diff{D}{t} & = \delta I(t) \\
\end{flalign*}
\end{minipage}%%%
\begin{minipage}{0.6\textwidth}
\begin{measuredfigure}
\includegraphics[width=60mm, height =25mm]{cahierduneecoliere}
\caption{Visualization of the SEIRD model}%of{figure}
\label{fig:seird}
\end{measuredfigure}
\end{minipage}%%
\vskip 1cm
\noindent\begin{minipage}{0.4\textwidth}
\begin{fleqn}
\begin{align*}
\diff{S}{t} & = -\beta S(t)\frac{I(t)}{N(t)} && & & \\
\diff{E}{t} & = \beta S(t)\frac{I(t)}{N(t)} - k E(t)&&\\
\diff{I}{t} & = k E(t) - (\gamma + \delta) I(t)&&\\
\diff{R}{t} & = \gamma I(t) &&\\
\diff{D}{t} & = \delta I(t) \\&&
\end{align*}
\end{fleqn}
\end{minipage}%
\begin{minipage}{0.6\textwidth}
\ffigbox[\FBwidth]{\caption{Visualization of the SEIRD model}%
\label{fig:seird}}
{\includegraphics[width=60mm, height =25mm, valign=c]{cahierduneecoliere}}
\end{minipage}%%%%

\end{document} 

在此处输入图片描述

答案2

您可以让它更简单。我使用displaymath环境,因此不会有分页符。

里面我使用了两个小页面,一个用于方程,一个用于图像。方程只需要aligned

非常重要:在名称和符号之间添加联系,例如

susceptible~(S)

因此符号不会在换行符处与名称分离。我还删除了冒号,因为它不属于正常流。在方程式后添加标点符号可能很有用,但这是可选的。

\documentclass{article}
\usepackage{amsmath}
\usepackage{caption}
\usepackage{graphicx}

\begin{document}

The final method to predict the further development of COVID-19 concerns 
a SEIRD-model, which classifies individuals as susceptible~(S), exposed~(E), 
infectious~(I), recovered~(R) and dead~(D). The number of people per class 
changes over time, according to the following differential equations
\[
\begin{minipage}{0.6\textwidth}
\qquad$\displaystyle\begin{aligned}
\frac{dS}{dt} &= -\beta S(t)\frac{I(t)}{N(t)} \\
\frac{dE}{dt} &= \beta S(t)\frac{I(t)}{N(t)} - k E(t) \\
\frac{dI}{dt} &= k E(t) - (\gamma + \delta) I(t) \\
\frac{dR}{dt} &= \gamma I(t) \\
\frac{dD}{dt} &= \delta I(t) \\
\end{aligned}$
\end{minipage}
\begin{minipage}{0.4\textwidth}
\includegraphics[width=\textwidth,height=2cm]{example-image}
\captionof{figure}{Visualization of the SEIRD model}
\label{fig:seird} 
\end{minipage}
\]

\end{document}

我设置了图片的宽度和高度只是为了显示居中对齐。否则,永远不要同时使用这两个键。

在此处输入图片描述

\qquad如果您将其更改为,以下也是您获得的输出\centering。无论如何,我不会将方程式与左边距对齐。

在此处输入图片描述

相关内容