2

The following Latex document shows this equation:

\documentclass{article}
% \usepackage[document]{ragged2e}
\usepackage{
  parskip % Makes formatting nicer
}
\begin{document}
$\lim_{x \to c}(f(x) - f(c))
\\ = \lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}$
\end{document}

Latex screenshot

I'm very happy with how this looks.

However, when I use the ragged2e package (by uncommenting the usepackage statement above) Latex fails to build:

Latex errors

How can I make this work with ragged2e, without changing the appearance of my equation?

I've tried moving the \\ to the end of line 7 but saw the same errors.

3
  • 2
    Welcome to TSE. When I remove the \\, I get no errors. Commented Aug 12, 2021 at 12:32
  • @JoséCarlosSantos For me this puts the whole equation on one line. I'm happy with how the equation looks now and would like to keep it that way.
    – K--
    Commented Aug 12, 2021 at 12:37
  • 3
    using inlin emath here doesn't look nice I'd use multline from amsmath which will use display math and id explicitly designed to show a single equation breaking over a line Commented Aug 12, 2021 at 12:53

3 Answers 3

4

If it's all one equation, you should assure that LaTeX won't insert a page break between the lines. One way to do so is by encasing the material in an aligned environment.

Do note that this concern is quite independent of whether or not the ragged2e package is loaded (with or without the document option).

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'aligned' environment
\usepackage[document]{ragged2e}
%\usepackage{parskip} % probably not needed if 'ragged2e' package is loaded with 'document' option

\begin{document}
$\begin{aligned}
&\lim_{x \to c}(f(x) - f(c))\\
&= \lim_{x \to c}(x - c)\tfrac{f(x) - f(c)}{x - c}
\end{aligned}$
\end{document}
4

Inline math uses a compressed style so that when used mid-paragraph it does not disturb the regular baseline spacing of the surrounding text. It isn't really suitable for a self-standing math display.

The amsmath package provides a range of multi-line math environments depending on teh effect that you want to achieve.

enter image description here

\documentclass[twocolumn,fleqn]{article}
\usepackage{amsmath}% always load for mathematicat documents
\setlength\mathindent{0pt}
\usepackage[document]{ragged2e}
\usepackage{
  parskip % Makes formatting ---nicer--- different
}
\begin{document}


\subsection*{inline}
$\lim_{x \to c}(f(x) - f(c))$\\
${}= \lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}$

\subsection*{multline}
\begin{multline*}
\lim_{x \to c}(f(x) - f(c))\\
 = \lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}
\end{multline*}

\subsection*{multline (alt)}
\begin{multline*}
\lim_{x \to c}(f(x) - f(c)) ={}\\
 \lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}
\end{multline*}


\subsection*{align}
\begin{align*}
\lim_{x \to c}(f(x) - f(c))\\
&= \lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}
\end{align*}


\subsection*{align2}
\begin{align*}
\lim_{x \to c}(f(x) - f(c))={}\\
&\lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}
\end{align*}

\subsection*{align3}
\begin{align*}
&\lim_{x \to c}(f(x) - f(c)) \\
&= \lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}
\end{align*}

\subsection*{align4}
\begin{align*}
&\lim_{x \to c}(f(x) - f(c)) ={}\\
&\lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}
\end{align*}


\end{document}
2

Perhaps that this is what you are looking for:

\documentclass{article}
\usepackage[document]{ragged2e}
\usepackage{
  parskip % Makes formatting nicer
}
\begin{document}
$\lim_{x \to c}(f(x) - f(c))$

$=\lim_{x \to c}(x - c)\frac{f(x) - f(c)}{x - c}$
\end{document}
1
  • It obfuscates the fact that this is all one equation, but it is a nice simple solution +1
    – K--
    Commented Aug 12, 2021 at 12:43

You must log in to answer this question.

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