I'm trying to get a system of equations next to a figure using the minipage environment. This is what I have come up with so far:
\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}
I want the equations to align at the left of the page and the figure at the right of the page, in both cases exactly lined up with the textwidth. Also, I would like the figure to be centered in height, with the caption immediately underneath.
So far, I have managed to get the equations to be aligned to the left of the figure by setting every equation in a flalign environment separately. However, this produces a lot of space between the equations (which was fixed using nospaceflalign from How to remove unnecessary space after flalign* environment), and they also do not completely line up with the text. I tried to fix this using \makebox[\textwidth]{\makebox[1.1\textwidth]
, which managed to get the equations to line up with the text, but then the figure was positioned either too far to the right or underneath the equations.
This is the code I used for that:
\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}
Does anyone have an idea how to fix this?
Thanks in advance!