MAS116/117 Presentation Lecture 4:
Images and a Bit of Punctuation

Dr Simon Willerton

1 Images

Including images  

LaTeX documents can include images. There are two approaches.

1.

Use software (e.g. a graphics programme) to create an image, then import it as an image file;

2.

use a LATE X’s package to create the image directly with simple commands.

We will look at both of these methods.

1.1 Image files

Image formats  

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
PDF
PNG () ()

These are the three formats used with LaTeX.

JPEG  

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.

PIC

PNG  

Portable Network Graphics (.png).

PIC

Image size and resolution  

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.

PIC PIC

PDF  

Portable Document Format (.pdf)

PIC

Use PDF images wherever possible for mathematical diagrams.

Image editing software  

Good software to try for creating mathematical diagrams includes

Both are free and both export images as PDFs.

For editing images, software includes

1.2 Using the PGFplots package

PGFplots  

The pgfplots package is great for creating graphs quickly.

−−−0246012xy 6 4 200

 

\begin{tikzpicture}
    \begin{axis}[
            xlabel=$x$,
            ylabel=$y$]
        \addplot[smooth]{x^2};
    \end{axis}
\end{tikzpicture}

It can also do more complicated things...

A second example  

−−24−−01xyy.42105=.5sin x

A third example  

       model
−−−0246−02 6 4 2 2,0,00000 estimate

A fourth example  


.

We’ll look at how to use PGFplots more in Lab 4.

Lots of examples are available at http://pgfplots.sourceforge.net/gallery.html.

2 Activity time

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).

3 Punctuation

Basic punctuation  

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 (,)  

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.

Colons (:)  

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!

Semicolons (;)  

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 (!)  

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 (’)  

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!

4 Later today…

About Computer Lab 4  

In Computer Lab 4 we’ll look at the commands needed to include graphics in a document.