4

I am creating a calculus study guide with LaTeX. I want my equations to be left aligned, but with the added text everything sort of looks terrible (not really left aligned and quite jagged in my opinion). Is there a better way to get left aligned equations that still look good?

Here's a MWE:

\documentclass[12pt]{article}

\usepackage[fleqn]{amsmath}
\usepackage[margin=1.0in]{geometry}

\begin{document}
\section{Definite Integration}
\begin{align*}
  \int_a^b f(x) dx &= \lim_{n \to \infty} \sum_{k=1}^n f(x_k)\Delta x\\
  \int_a^a f(x) dx &= 0\\
  \int_a^b f(x) dx &= -\int_b^a f(x) dx\\
  \int_a^b cf(x) dx &= c\int_a^b f(x) dx\\
  \int_a^b (f(x) \pm g(x)) dx &= \int_a^b f(x) dx \pm \int_a^b g(x) dx\\
  \int_a^p f(x) dx + \int_p^b f(x) dx &= \int_a^b f(x) dx\\
  \text{If } f(x) > g(x) \text{ on the interval } [a,b] &\text{ then } \int_a^b f(x) dx > \int_a^b g(x) dx
\end{align*}
\end{document}

2 Answers 2

3

You could place the fragment If $f(x) > g(x)$ on the interval $[a,b]$, then inside an \intertext directive. You should also insert thinspaces ahead of the dx terms in the integrals.

enter image description here

\documentclass[12pt]{article}
\usepackage[fleqn]{amsmath}
\usepackage[margin=1in]{geometry}

\begin{document}
\section{Definite Integration}
\begin{align*}
  \int_a^b f(x)\,dx &= \lim_{n \to \infty} \sum_{k=1}^n f(x_k)\Delta x\\
  \int_a^a f(x)\,dx &= 0\\
  \int_a^b f(x)\,dx &= -\int_b^a f(x)\,dx\\
  \int_a^b cf(x)\,dx &= c\int_a^b f(x)\,dx\\
  \int_a^b \bigl(f(x) \pm g(x)\bigr)\,dx &= \int_a^b f(x)\,dx \pm \int_a^b g(x)\,dx\\
  \int_a^p f(x)\,dx + \int_p^b f(x)\,dx &= \int_a^b f(x)\,dx\\
\intertext{If $f(x) > g(x)$ on the interval $[a,b]$, then} 
\int_a^b f(x)\,dx &> \int_a^b g(x)\,dx
\end{align*}
\end{document}
1
  • Whoa intertext. That's new to me. Thanks for your help! Oct 28, 2015 at 4:11
4

The following example sets the left part of the equations left aligned and keeps the alignment of the equal signs. The text below is set as normal text with inline math.

Also the example uses \diff for the differential operator, which improves the horizontal spacing by adding a little space before depending on the previous math atom.

\documentclass[12pt]{article}

\usepackage[fleqn]{amsmath}
\usepackage[margin=1.0in]{geometry}

% Better horizontal spacing
\newcommand*{\diff}{\mathop{}\!d}

\begin{document}
\section{Definite Integration}
\begin{alignat*}{2}
  &\int_a^b f(x) \diff x
    &&= \lim_{n \to \infty} \sum_{k=1}^n f(x_k)\,\Delta x\\
  &\int_a^a f(x) \diff x &&= 0\\
  &\int_a^b f(x) \diff x &&= -\int_b^a f(x) \diff x\\
  &\int_a^b cf(x) \diff x &&= c\int_a^b f(x) \diff x\\
  &\int_a^b (f(x) \pm g(x)) \diff x
    &&= \int_a^b f(x) \diff x \pm \int_a^b g(x) \diff x\\
  &\int_a^p f(x) \diff x + \int_p^b f(x) \diff x &&= \int_a^b f(x) \diff x
\end{alignat*}
  If $f(x) > g(x)$ on the interval $[a,b]$ then
  $\displaystyle\int_a^b f(x) \diff x > \int_a^b g(x) \diff x$.
\end{document}

Result

1
  • Thanks for the diff operator. Hard to say which I like better between the two alignments. Perhaps I'll use a mix of both Oct 28, 2015 at 4:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .