LaTeX's fantastic for writing out papers with mathematics and mathematical results in them, but I've never really learned how to use it to type up calculations, as one would write them on a piece of paper, or a blackboard.
TL;DR is there a "paragraph mode" for mathematics?
What I mean by this is, when I write out my calculations, I usually want them in a display style, that is, I want the larger integral and summation signs, and the larger fractions, I want the limits above and below the symbols, that sort of thing, as you would write maths on a blackboard or a piece of homework.
The problem is, if you're writing out calculations, I was always taught to write them like, essentially, individual paragraphs. I was to have them flush with the left margin and I was to leave a line (or at least, some space) between each line of my calculation.
Clearly, consecutive \[ ... \]
s are ill-suited to this and not just because of the centring. Suppose we have line 1, then line 2, and the left hand side of the = sign is different on each line, but then we wish to have an aligned equation, like this:
\[
36V^{2} = A^{2}x^{2} - 2Ax^{4}
\]
\[
V = \frac{1}{6}(A^{2}x^{2} - 2Ax^{4})^{\frac{1}{2}}
\]
\begin{flalign*}
\frac{dV}{dx} &= \frac{2A^{2}x - 8Ax^{3}}{12\sqrt{A^{2}x^{2} -
2Ax^{4}}} \\[12pt]
&= \frac{A^{2}x - 4Ax^{3}}{6\sqrt{A^{2}x^{2} - 2Ax^{4}}}
\end{flalign*}
How are we to ensure consistent spacing between each line?
Traditionally I have used a bit of a hack, with its own imperfections.
\documentclass[fleqn,12pt]{article}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\setlength{\mathindent}{0pt}
\begin{document}
$\begin{displaystyle}
36V^{2} = A^{2}x^{2} - 2Ax^{4} \\[12pt]
V = \frac{1}{6}(A^{2}x^{2} - 2Ax^{4})^{\frac{1}{2}}
\end{displaystyle}$
\begin{flalign*}
\frac{dV}{dx} &= \frac{2A^{2}x - 8Ax^{3}}{12\sqrt{A^{2}x^{2} -
2Ax^{4}}} \\[12pt]
&= \frac{A^{2}x - 4Ax^{3}}{6\sqrt{A^{2}x^{2} - 2Ax^{4}}}
\end{flalign*}
\end{document}
But I'm not longer confident this is ideal.
What I really want is:
- All lines flush with the left margin
- Perfectly consistent gap between all lines, including between single, independent lines of mathematics, each line in an aligned environment, the last independent single line and the first line of an aligned environment, and text
- Display style
- Ability to switch freely between aligned and unaligned maths and text
For example:
\documentclass[fleqn,12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\setlength{\mathindent}{0pt}
\begin{document}
Let the volume of the container be denoted~$V$ and let the area be
denoted~$A$.
$\begin{displaystyle}
36V^{2} = A^{2}x^{2} - 2Ax^{4} \\[\parskip]
V = \frac{1}{6}(A^{2}x^{2} - 2Ax^{4})^{\frac{1}{2}}
\end{displaystyle}$
\begin{flalign*}
\frac{dV}{dx} &= \frac{2A^{2}x - 8Ax^{3}}{12\sqrt{A^{2}x^{2} -
2Ax^{4}}} \\[\parskip]
&= \frac{A^{2}x - 4Ax^{3}}{6\sqrt{A^{2}x^{2} - 2Ax^{4}}}
\end{flalign*}
\begin{flalign*}
\frac{dV}{dx} = 0 &\implies A^{2}x = 4Ax^{3} \\[\parskip]
&\implies x = 0 \text{ or } x^{2} = \frac{A}{4} \\[\parskip]
&\implies x = 0,\ \pm\frac{\sqrt{A}}{2}
\end{flalign*}
We discard $x = 0$ and $x = -\sqrt{A}/2$ since the length of the base
of the container can be neither 0 nor negative.
$\therefore$ $V$ is a maximum at $x = \sqrt{A}/2$.
\end{document}
What I'm aiming for is (in so far as possible) precisely this, but with perfectly even spacing between all lines and, if possible, a less ghastly source code. I mean \\[\parskip]
(or, until recently, \\[12pt]
) at the end of almost every line was okay before I read LaTeX: A Document Preparation System but now I feel like I must be doing something wrong!
Best Answer
If you really need to this then instead of using the
parskip
package you might try using a document class that is designed for this type of layout. One example comes from the Dutch TeX user group in thentgclass
collection. Using theirartikel3
class with thefleqn
option, setting the\mathindent
to zero and using just standardamsmath
environmentsequation(*)
,align(*)
andsplit
gives many of the features you request.Note that there is a big difference whether there is a blank line or not between two consecutive display math environments in the source.
Another example is the classes from the koma bundle, which have a
parskip
option.The code would be the same as above, just with the first line changed to e.g.
There are quite a number of different choices for the
parskip
value. See the bundles documentation for full information.On the other hand I would strongly discourage writing in this way. Sequences of equations without intervening text giving the structure of the arguments is not good for the reader (including yourself). I would be strongly inclined to write something more in this style: