We are looking at more detailed issues with LaTeX and writing. You will be starting your first mini-project next week. You will also be (anonymously) critiquing the write-ups of others.
There are three basic ways to ‘mark up’ text in LaTeX.
$..$ or \[..\].
{..} following a command, e.g. \emph{hello} or
\section{Introduction}.
By putting it inside an environment,
\begin{itemize}
\item One thing.
\item Another thing.
\end{itemize}
Environments begin with \begin{..} and end with \end{..}.
I indent environments with four spaces to make my file more readable.
Maths not in maths-mode.
Text in maths-mode.
Using the wrong dash.
Punctuation in the wrong place.
Using too much displayed mathematics.
Using bold text.
Overful hboxes.
When using inline maths, it is easy to forget the single dollars.
Look out for maths symbols not displayed in italics.
Examples. This is correct, whereas this x is not. This f(x) is wrong as well, as is this set A, which is should be .
The reverse situation is using text in math-mode.
This is easy to spot, as the text becomes italic and spacing isn’t correct.
Examples.
The first case here may have happened by accident.
The second is someone fiddling to make things look okay, but looks bad.
Text is occassionally needed within math-mode.
If it is necessary, use the \text{...} command (from amsmath).
The \text command allows us to write
Notice the spacing between the maths and text. This has been done using the
\quad command, which creates a large space:
\[
x = u + v
\quad\text{and}\quad
y = u - v.
\]
In typography there are at least four(!) kinds of dash.
| name | LaTeX | |||
| hyphen | - | - | quick-witted | quick-witted |
| minus sign | $-$ | $3 - 4 = -1$ |
||
| en-dash | – | -- | 30–40 people | 30--40 people |
| em-dash | — | --- |
For numerical ranges you use an en-dash not a hyphen.
The “en” and “em” refer to the width of the letters “N” and “M”.
In British English, for parenthetical asides – like this – the en-dash is used.
However, in American English, typically—in this way—the em-dash is used.
4. Punctuation in the wrong place
Punctuation needs to be outside of inline mathematics.
Therefore $x=2$. The result is proved.
Therefore $x=2.$ The result is proved.
These display as follows.
Therefore . The result is proved.
Therefore The result is proved.
There are two things wrong here.
These subtle differences will make your document look worse.
4. Punctuation in the wrong place II
Conversely, punctuation needs to be inside of displayed mathematics!
Otherwise it can fall to the next line.
Thus, \[ \sin^2 x + \cos^2 x = 1 \], and the result follows.
gives rise to
Thus,
, and the result follows.
5. Using too much displayed mathematics I
Beginners to LaTeX often overuse displayed mathematics. Displayed mathematics should be used for important steps that you would like to stand out, or for formulas and equations too big to display well in-line. Too much displayed maths slows the reader down.
Here’s an example of something broken up too much by display-math.
5. Using too much displayed mathematics II
Example. Suppose not, and is rational. Then, by Lemma 1.2,
where and share no common factors. Thus, squaring, we get
It follows that is even, and hence so is . Write
for some …
5. Using too much displayed mathematics III
Example (Re-write). Suppose not, and is rational. Then, by Lemma 1.2, , where and share no common factors. Thus, squaring, we get . It follows that is even, and hence so is . Write for some …
As we know, LaTeX is a mark-up language. The best approach is to use
LaTeX to tell the computer what kind of thing your text is, rather than
specifically how to display it. The choice of bold or italic for emphasized
text should be left to LaTeX. This ensures consistency and stops mixing
bold and italics. For emphasized text you should use the \emph{...}
command.
LaTeX creates documents with fully-justified text (i.e., text stretched from the left margin to the right). Usually LaTeX does this well, and doesn’t like to stretch the space between the words too much. Sometimes it chooses to spill over the right margin slightly. If this happens, you will get a warning about an ‘overfull hbox’. An hbox is a horizontal box of text.
Example. Overfull hboxes can happen with looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong words.
To fix this, slightly reword the sentence; usually LaTeX finds a better way to split the lines. If the overfull hbox is very slight, you might choose to ignore it.
Using too many paragraphs.
Not writing in full sentences.
Some have a habit of starting each new sentence as a new paragraph. Each new paragraph should represent a change of idea or step forward.
Example (Bad). Let .
Differentiating, we find .
Thus, if and only if .
Since for all , it follows that…
Example (Better). Let . Differentiating, we find . Thus, if and only if . Since for all , it follows that…
2. Not writing in full sentences
Mathematicians often try to save time when writing by hand, adding little notes, and these might not be written in full sentences.
When typing mathematics you should write everything in full sentences.
Example (Bad). If then (product rule). Sub in . Then…
Example (Better). If then use the product rule to obtain . Substitute in . Then…
Activity (More proof-reading). The circulated document, available on the course website, has a number of problems with it. Find as many ways of improving the document as you can.
First mini-project to launch next week
Make sure you attend the Week 6 lectures next week, as the first mini-project will be launched then (to be submitted in Week 8).
In Computer Lab 5 we’ll look at referencing and tables and a few other things.