2

I am trying to use \minipages to create two columns of equations. However, it seems like the equations exceed the 0.5\textwidth I have set for the minipage. Is there any way to break up the equation or to solve it without breaking it up? Thanks!

\begin{minipage}{0.5\textwidth}   %left column
\begin{align*}
    \frac{\mathrm{d} R1(t)}{\mathrm{d} I(t)} & = \frac{\gamma \bar{k} I(t) S(t)  +  \alpha \bar{k} S(t) R2(t)  + \delta S(t)}{- \bar{k} I(t)S(t)} \\
     & =  - \gamma - \alpha \frac{R2(t)}{I(t)}  -  \frac{\delta}{\bar{k} I(t)}
\end{align*}
\end{minipage}
\hfill\vline\hfill
\begin{minipage}{0.5\textwidth} %right column
\begin{align*}
    \frac{\mathrm{d} R1(t)}{\mathrm{d} I(t)} & = \frac{5.3 I(t) S(t) + 4.5 S(t) R2(t) + 0.5 S(t)}{-10 I(t) S(t)}  \\
     & =  - 0.53 - 0.45 \frac{R2(t)}{I(t)}  -  \frac{0.05}{I(t)}
\end{align*}
\end{minipage}

enter image description here

  • 2
    Welcome to tex.sx. Actually, it looks like the equations are narrow enough, but the space (line ending) after the first \end{minipage} gives a good breakpoint, and the additional space needed by the \hfill\vline\hfill takes the total length over the line width. Add % after the \end{minipage} and decrease the width of the minipages to 0.48\textwidth. That should be enough to fix it. – barbara beeton Aug 19 at 2:00
  • @barbarabeeton thank you! It worked. – blsh Aug 19 at 2:12
  • 1
    Also, be sure to insert a \noindent instruction before the first minipage. – Mico Aug 19 at 10:40
2

With the standard article class, with no option, the text width is set to 345pt. On the other hand, your longest equations are 195.14384pt and 205.44582pt wide respectively.

This makes for slightly more than 400pt, so there's no chance to set the two blocks side by side unless you increase the text width; in order to ensure space for the mid rule, along with some padding, no less than 420pt are needed.

Here's with 420pt (wider is obviously possible). The showframe option is just to show the margins of the text block.

\documentclass{article}
\usepackage[textwidth=420pt,showframe]{geometry}
\usepackage{amsmath}

\newcommand{\diff}{\mathop{}\!\mathrm{d}}

\begin{document}

\[
\begin{aligned}[t]
  \frac{\diff R1(t)}{\diff I(t)}
  & = \frac{\gamma \bar{k} I(t) S(t)  +  \alpha \bar{k} S(t) R2(t)  + \delta S(t)}
           {- \bar{k} I(t)S(t)} \\
  & =  - \gamma - \alpha \frac{R2(t)}{I(t)}  -  \frac{\delta}{\bar{k} I(t)}
\end{aligned}\hspace{1000pt minus 1fil}\vrule\hspace{1000pt minus 1fil}
\begin{aligned}[t]
  \frac{\diff R1(t)}{\diff I(t)}
  & = \frac{5.3 I(t) S(t) + 4.5 S(t) R2(t) + 0.5 S(t)}{-10 I(t) S(t)\vphantom{\bar{k}}}  \\
  & =  - 0.53 - 0.45 \frac{R2(t)}{I(t)\vphantom{\bar{k}}}  -  \frac{0.05}{I(t)\vphantom{\bar{k}}}
\end{aligned}
\]

\end{document}

Note the phantoms to make the lines the same height and depth.

enter image description here

Alternatively, a single align*:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\diff}{\mathop{}\!\mathrm{d}}

\begin{document}

\begin{align*}
  \frac{\diff R1(t)}{\diff I(t)}
  & = \frac{\gamma \bar{k} I(t) S(t)  +  \alpha \bar{k} S(t) R2(t)  + \delta S(t)}
           {- \bar{k} I(t)S(t)} \\
  & =  - \gamma - \alpha \frac{R2(t)}{I(t)}  -  \frac{\delta}{\bar{k} I(t)} \\[2ex]
  & = \frac{5.3 I(t) S(t) + 4.5 S(t) R2(t) + 0.5 S(t)}{-10 I(t) S(t)}  \\
  & =  - 0.53 - 0.45 \frac{R2(t)}{I(t)}  -  \frac{0.05}{I(t)}
\end{align*}

\end{document}

enter image description here

1

Unless the text block of your document is considerably wider than the default for the article document class, you will need line-break the first fraction term. in both minipage environments.

enter image description here

Note the use of \noindent before the first \begin{minipage} statement:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}

\noindent % <-- new
\begin{minipage}[t]{0.5\textwidth} %left-hand minipage
\begin{align*}
    \frac{\mathrm{d} R_1(t)}{\mathrm{d} I(t)}
    &= \bigl[\gamma \bar{k} I(t) S(t) + \alpha\bar{k}S(t)R_2(t)  \\
    &\quad+\delta S(t)\bigr]\big/\bigl[-\bar{k}I(t)S(t)\bigr] \\
    &=  - \gamma - \alpha \frac{R_2(t)}{I(t)}  -  \frac{\delta}{\bar{k} I(t)}
\end{align*}
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth} %right-hand minipage
\begin{align*}
    \frac{\mathrm{d} R_1(t)}{\mathrm{d} I(t)} 
    &= \bigl[5.3 I(t) S(t) + 4.5 S(t) R_2(t) \\
    &\quad + 0.5 S(t)\bigr]\big/\bigl[-10 I(t) S(t)\bigr]  \\
    &=  - 0.53 - 0.45 \frac{R_2(t)}{I(t)} - \frac{0.05}{I(t)}
\end{align*}
\end{minipage}
\end{document} 
  • The visual provided with the question showed a (full?) line of text before the display. That's what I considered when I offered my suggestion. (Which the OP said worked.) So it seems that the page width is wider than that of article. Too bad no document class info or MWE was provided. – barbara beeton Aug 19 at 16:06
1

Your equations hardly fit between the margins when loading geometry. Other than that, I propose to use a single align* environment, with three columns, the middle column being dedicated to the vertical line.

\documentclass{article}
\usepackage{amsmath}
\usepackage[showframe]{geometry} 

\begin{document}

\begin{align*}
    \frac{\mathrm{d} R1(t)}{\mathrm{d} I(t)} & = \frac{\gamma \bar{k} I(t) S(t) + \alpha \bar{k} S(t) R2(t) + \delta S(t)}{- \bar{k} I(t)S(t)} & & \vrule &
    \frac{\mathrm{d} R1(t)}{\mathrm{d} I(t)} & = \frac{5.3 I(t) S(t) + 4.5 S(t) R2(t) + 0.5 S(t)}{-10 I(t) S(t)} \\
     & = - \gamma - \alpha \frac{R2(t)}{I(t)} - \frac{\delta}{\bar{k} I(t)} & \smash{\rule[-2ex]{0.5pt}{12ex}}& & & = - 0.53 - 0.45 \frac{R2(t)}{I(t)} - \frac{0.05}{I(t)}
\end{align*}

\end{document} 

enter image description here

  • Thanks for making the code readable, milady! – Bernard Aug 19 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.