3

Consider the following expression:

\documentclass[12pt, a4paper]{report}
\usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs,amsmath}
\begin{document}
       \begin{align*}
    S\left(t\right)&\geq  S\left(t\right)\exp \left\lbrace {-\int_0^t \left[\beta_A A\left(\tau\right) +\beta_I I\left(\tau\right) \right]\;\mathrm{d}\tau-\mu t -\rho t} \right \rbrace\\[1ex]
    &+\exp \left\lbrace {-\int_0^t \left[\beta_A A\left(\tau\right) +\beta_I I\left(\tau\right) \right]\;\mathrm{d}\tau-\mu t -\rho t} \right \rbrace \left \lbrace\int_0^t b(1-\nu)  \exp\left \lbrace{\int_0^\tau \left[\beta_A A\left(\zeta\right) +\beta_I I\left(\zeta\right) \right]\;\mathrm{d}\zeta+\mu \tau +\rho \tau}\right \rbrace\;\mathrm{d}\tau\right \rbrace.
    \end{align*}
\end{document}

What would be an "ideal" way to write this?

4 Answers 4

4

The first thing you should do is to eliminate all \left/\right pairs, as they are doing nothing but introducing spurious spaces. I would also define a macro for the differential and give it an operator spacing (\, instead of \;). The brackets around the last term look superfluous to me.

\documentclass[12pt, a4paper]{report}

\usepackage{amsmath}

\newcommand*{\diff}{\mathop{}\!\mathrm{d}} % common definition

\begin{document}

\[
S(t) \geq
\begin{aligned}[t]
&S(t)\exp\biggl\lbrace {-\int_0^t [\beta_A A(\tau) +\beta_I I(\tau) ] \diff\tau-\mu t -\rho t} \biggr\rbrace\\[1ex]
&+\exp \biggl\lbrace {-\int_0^t [\beta_A A(\tau) +\beta_I I(\tau) ]\diff\tau-\mu t -\rho t} \biggr\rbrace \\
&\qquad\times \int_0^t b(1-\nu)  \exp\biggl\lbrace{\int_0^\tau [\beta_A A(\zeta) +\beta_I I(\zeta) ]\diff\zeta+\mu \tau +\rho \tau}\biggr\rbrace\diff\tau.
\end{aligned}
\]

\end{document}

enter image description here

Note that mathtools loads amsmath and graphicx, and amssymb loads amsfonts. Your

\usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs,amsmath}

can be thus reduced to

\usepackage{verbatim,mathtools,amssymb, amsthm, mathrsfs}
2
  • Thank you for a neat solution however when I run this code I am met with: ! LaTeX Error: Command \diff already defined. Or name \end... illegal, see p.192 of the manual. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.108 \newcommand*{\diff}{\mathop{}\!\mathrm{d}} % common definition ?
    – Math
    May 19 at 15:01
  • @Math Well, use another name. Or don't use it at all, it was only a suggestion. You can of course keen typing \,\mathrm{d} manually.
    – campa
    May 19 at 15:03
3

Another option is to split it into multiple statements, such as

\documentclass[12pt, a4paper]{report}
\usepackage{verbatim, mathtools,amssymb, amsthm, mathrsfs}
\begin{document}
    \begin{equation*}
        S(t) \ge S(t) \exp[- J(t) ] + \exp[-J(t)] K(t)
    \end{equation*}
    where
    \begin{align*}
        J(t) &= \int_0^t [\beta_A A(\tau) + \beta_I I(\tau)] \; \mathrm{d}\tau - \mu t - \rho t\\
        K(t) &= \int_0^t b(1-\nu)  \exp\left \lbrace{\int_0^\tau [\beta_A A(\zeta) +\beta_I I(\zeta) ] \; \mathrm{d}\zeta+\mu \tau +\rho \tau}\right \rbrace\;\mathrm{d}\tau
    \end{align*}
\end{document}

giving the result

enter image description here

2

Does this layout with the multlined environment befit you?

Unrelated: you don't have to load amsfont when load amssymb as the latter does it for you. Similarly, needless to load amsmath if you load mathtools.

\documentclass[12pt, a4paper]{report}
\usepackage{graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs}

\begin{document}

       \begin{align*}
    S\left(t\right)&\geq S\left(t\right)\exp \left\lbrace {-\int_0^t \left[\beta_A A\left(\tau\right) +\beta_I I\left(\tau\right) \right]\;\mathrm{d}\tau-\mu t -\rho t} \right \rbrace\\[1ex]
    &\phantom{\geq}+\begin{multlined}[t]\exp \left\lbrace {-\int_0^t \left[\beta_A A\left(\tau\right) +\beta_I I\left(\tau\right) \right]\;\mathrm{d}\tau-\mu t -\rho t} \right \rbrace \times \\
    \left \lbrace\int_0^t b(1-\nu) \exp\left \lbrace{\int_0^\tau \left[\beta_A A\left(\zeta\right) +\beta_I I\left(\zeta\right) \right]\;\mathrm{d}\zeta+\mu \tau +\rho \tau}\right \rbrace\;\mathrm{d}\tau\right \rbrace.\end{multlined}
    \end{align*}

\end{document} 

enter image description here

3
  • This looks nice too but can you make the multiplicative sign a "cross" like in campa's answer? i ask so the reader doesn't get confused with the full stop.
    – Math
    May 19 at 15:09
  • @Math: done, mylord!
    – Bernard
    May 19 at 15:28
  • I completely forgot that all we needed is \times sorry!
    – Math
    May 19 at 15:38
2

You have already got several nice answers. Since the question is tagged typography and you ask for an ideal way of doing this, I feel that an approach different from the others could be of interest (perhaps not for you, right now, since you are using LaTeX and not ConTeXt, but maybe for other users).

I think that an ideal way of typesetting this kind of formula is probably one that is not based on math alignments, but on some paragraph type math environment. It also has the advantage that one can break it inside fences, even though that is not necessary here. (It could also potentially be better when it comes to tagging and voice reading support, but let us leave that aside.)

We define such an environment with

\defineformula[long][
    split=yes,
    textalign=middle,
    hang=yes,
    distance=1em,
    spaceinbetween=.5\lineheight,
]

Then we can typeset the formula, more or less as you did (I removed some of the \left( and \right) since they do not add anything at those places, and also added some formatting.)

\startlongformula
    S(t) 
    \alignhere 
        \geq 
        S(t) 
        \exp 
        \left\lbrace 
            -\int_{0}^{t} 
            \left[
                \beta_{A} A(\tau) +\beta_{I} I(\tau) 
            \right]
            \dd\tau
            -\mu t -\rho t
        \right\rbrace
    \breakhere
    \skiphere[1]
        +\exp
        \left\lbrace 
            -\int_{0}^{t} 
            \left[
                \beta_{A} A(\tau) + \beta_{I} I(\tau) 
            \right]
            \dd\tau
            -\mu t -\rho t 
        \right\rbrace 
    \breakhere
    \skiphere[2]
        \times
        \left(
            \int_{0}^{t} b(1-\nu)  
            \exp
            \left\lbrace
                \int_{0}^{\tau} 
                \left[
                    \beta_{A} A(\zeta) + \beta_{I} I(\zeta)
                \right]
                \dd\zeta 
                + \mu \tau +\rho \tau
            \right\rbrace
            \dd\tau
        \right).
\stoplongformula

It is worth to note the \alignhere that sets an align point (not really needed in this example, but if there would be another line it would be useful) the \breakhere that insert line breaks, and also the \skiphere[1] and \skiphere[2] that indent the second and third line. (The \dd gives a d set in the differential class, no fixing with spaces needed.)

The output looks like this:

multilined formula

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.