LaTeX documents can include images. There are two approaches.
Use software (e.g. a graphics programme) to create an image, then import it as an image file;
use a LATE X’s package to create the image directly with simple commands.
We will look at both of these methods.
There are lots of ways to create an image, for example,
Images can be stored in different file-formats. Different formats suit different purposes.
photos | graphs/plots | screenshots | most other | |
JPEG | ✓ | ✗ | ✗ | ✗ |
✗ | ✓ | ✗ | ✓ | |
PNG | ✗ | (✓) | ✓ | (✓) |
These are the three formats used with LaTeX.
Joint Photographic Experts Group (.jpg or .jpeg)
High compression gives smaller filesize but lower image quality; low compression makes images clearer but increases the filesize.
Portable Network Graphics (.png).
Raster images (JPEG or PNG files) will have a pixel size, e.g. “640 pixels by 1024 pixels”. More pixels means more detail, but also a bigger file.
When you display an image it will also have a physical size, e.g. “5 cm by 10 cm” or “2 inches by 3 inches”. The resolution of an image is the number of pixels (or dots) per unit of measurement, typically measured in dots per inch (dpi). Higher resolution means better quality but a bigger file. Standard high resolution for a printed image is 300 dpi.
Portable Document Format (.pdf)
Use PDF images wherever possible for mathematical diagrams.
Good software to try for creating mathematical diagrams includes
Both are free and both export images as PDFs.
For editing images, software includes
The pgfplots
package is great for creating graphs quickly.
\begin{tikzpicture} \begin{axis}[ xlabel=$x$, ylabel=$y$] \addplot[smooth]{x^2}; \end{axis} \end{tikzpicture}
It can also do more complicated things...
.
We’ll look at how to use PGFplots more in Lab 4.
Lots of examples are available at http://pgfplots.sourceforge.net/gallery.html.
Activity. The circulated document (also available on the course website) is in need of a serious proof-reading. Find and correct as many problems as you can (some of which may be LaTeX errors).
Basic punctuation is easy: start sentences with capital letters and end them with full-stops. However, there are plenty of other punctuation marks that are often used (and misused).
It’s not hard to use punctuation correctly once one learns the rules.
Commas are used in lists. However, they have other uses. One of these is to separate clauses in sentences.
Often, where commas are used corresponds to where a pause is needed if read aloud.
Example.
A common mistake is to overuse commas, inserting them in places where a pause in speech makes things sound odd. It’s best to miss one out if in doubt.
A colon is used to indicate that what follows explains or lists what precedes it.
A colon splits a sentence into two halves, the first half should make sense on its own.
Examples.
A common error is to put a hyphen afterwards, creating ‘:-’. This is not correct punctuation. Avoid!
The main use of a semicolon is to join together two sentences where the latter is related to the former. A semicolon is used to indicate a connection.
Examples.
Try not to overuse semicolons and only use them if you know how to.
Exclamation marks are used for indicating surprise or for issuing instructions.
Examples.
Exclamation marks are not often used in formal writing.
F. Scott Fitzgerald wrote
Cut out all those exclamation marks. An exclamation mark is like laughing at your own jokes.
Apostrophes are used to indicate missing letters or to indicate possession.
Examples.
A common error is to use an apostrophe in ‘its’ when used in a possessive way, as in ‘The cat chased its tail’. Apostrophes are also unnecessary in ours, yours, his, hers, theirs, and whose, and never needed for plurals.
Bad use of apostrophes tends to provoke strong reactions!
In Computer Lab 4 we’ll look at the commands needed to include graphics in a document.