MAS116/MAS117 PRESENTATION LAB 5

Start a new document in your preferred editor, using the default preamble on the presentation materials webpage or one from a recent document. Make sure you include the AMS packages, as usual.

1. Citations and references

Here we look at how to cite books or internet pages. Citations are important for attributing results to the people who did them and allowing the reader to check material themselves. Citations should appear naturally in the text. Here are some examples.

The citations refer to entries in the bibliography at the end of this lab-sheet. Have a look.

Notice that the reference to the website in the bibliography in this document contains both the date it was visited and the date it was updated. This is to allow the reader to check out the exact pages that you are referring to.

Let’s create a bibliography to cite from.

(1)
Create a section in your document called ‘Recommended fiction’. In it, type the sentence ‘A friend recommended I read some books by Doris Lessing, starting with one of her most famous books.’
(2)
Enter the following at the end of your LaTeX document, just before the \end{document} command.
           \begin{thebibliography}{99}
               \bibitem{Lessing:Notebook}
                   D.~Lessing,
                   \emph{The Golden Notebook},
                   HarperCollins Publishers, 2012.
           \end{thebibliography}

(3)
Go back to your section on recommended fiction, and replace the word books with books~\cite{Lessing:Notebook}. Process your document twice and check that the citation has appeared. If you are using the hyperref package then your citation markers should be clickable links.

Note that the 99 just informs LaTeX of the widest number it is expecting for the citation label; you do not need to worry about it, it is not doing anything interesting.

(4)
Think of a favourite book and find its details by searching the web. Add this to the bibliography, then add a sentence to your section on recommended fiction, referencing this new book.
(5)
Change the order of the two \bibitems. Process the document twice.

It is good style to use the citation markers like footnote markers and not as a grammatical part of the sentence. So good style would be “If you look at Mirzakhani’s Wikipedia article [2] then…”; by contrast, bad style would be “If you look at [2] then…”.

You can refer to a specific part of the reference by using an optional parameter in square brackets in the \cite command. For instance “Wiles was the person who proved Fermat’s Last Theorem [1, Theorem 2.1].” is obtained with the following code.

    Wiles was the person who proved Fermat’s Last
    Theorem~\cite[Theorem~2.1]{Wiles:fermats-theorem}.

Use this feature to add a reference to a specific page or chapter of your book.

2. Tables

Creating tables with LaTeX is straightforward, and uses the tabular environment. Create a section called ‘Tables’, try the following. Note that the {llr} bit consists of lowercase ‘L’s and ‘R’s as it stands for ‘left left right’, as you will see.

    \begin{center}
        \begin{tabular}{llr}
            \hline
            Name & Location & Height (m)\\
            \hline
            Arts Tower & Bolsover Street & 78\\
            St.~Georges Church & Broad Lane & 43\\
            Hicks Building & Hounsfield Road & 40\\
            \hline\\
        \end{tabular}
    \end{center}

This should give you a table. Think about the following.

(6)
What do the & signs do here? What about the \\ commands? (The \\ command must not be used in normal paragraphs.)
(7)
Try changing the {llr} to {ccr}, or {llc}, or any other three-letter combination of l, c and r. Here c is for ‘centred’.
(8)
Change the parameters again to {l|lr}. What has changed? Change it back to llr. Most style guides recommend avoiding the use of vertical lines in tables.

If we want to put a caption on a table we need to ‘float’ it as we did with figures in the figure environment last time: here we use a table environment. Enclose the tabular environment you had above with the following code, where the ‘...’ represents the tabular environment.

    \begin{table}[tbh]
        \begin{center}
            ...
            \caption{The heights of some buildings at the
            University of Sheffield}
            \label{table:building-heights}
        \end{center}
    \end{table}

You can now refer to this table via Table~\ref{table:building-heights}. Try putting a mention of this table in your document.

Name Location Height (m)
Arts Tower Bolsover Street 78
St. Georges Church Broad Lane 43
Hicks Building Hounsfield Road 40
Table 1: The heights of some buildings at the University of Sheffield

This table is okay, but the default tables in LaTeX are a little too squashed. We can improve this with the booktabs package, which makes tables look more professional, like Table 1 in this document. In your preamble put the following code.

    \usepackage{booktabs}
        \newcommand{\otoprule}{\midrule[\heavyrulewidth]}

Now in your tabular environment, replace the first \hline with \toprule, the second with \otoprule and the bottom one with \bottomrule. Process the document, you should have a better looking table.

3. More LaTeX commands

Start a section ‘More commands’.

3.1. Text in maths. Start a subsection ‘Text in maths mode’. Enter the following code.

    Let
    \[
        x = u + v \quad\text{and}\quad y = u - v.
    \]

Process this and look at the result. Now remove the \quad commands and process it again. What do you notice? Now put \qquad where the \quad commands where. What difference does this make?

The term quad comes from traditional printing and it just means a space whose width is that of the letter ‘M’. In LaTeX the commands \quad and \qquad should only be used to separate maths from text in displayed maths.

3.2. Table of contents. Put \tableofcontents after your \maketitle command and process the LaTeX twice. Look at the beginning of your document. Try changing some of the \section{...} commands in your document to \section*{...}.

3.3. Correctly sized brackets. Compare the following two versions of the same expression:

(x y + 1)and (x y + 1).

You should see the left-hand version is clearly wrong: brackets need to be the correct size for the job. Enter the following code and process it. Then remove the \left and \right commands and compare the result.

    \[
        \left(\frac{x}{y} + 1\right)
    \]

Each \left command needs to have a corresponding \right command. Both need to be followed by a delimiter which will be something like (, \{, \langle or \vert. LaTeX will pick an appropriate size for the delimiters.

(9)
Typeset the following using \left and \right appropriately; note that you want w,z and not < w,z >.
sin (x) [y (x + w,z2) x + 7 ]

______________________________________________________________

Homework

Create a document with title ‘MAS116: Homework 5’ (or ‘MAS117’) and your name as author. Your task is to type up the question and a solution for Problem 1 of the Week 4 hand-in from the core maths module MAS106. The problem involves Fibonacci numbers.

You should create problem and solution environments by putting the following in your preamble.

    \theoremstyle{definition}
    \newtheorem{problem}{Problem}
    \newenvironment{solution}
        {\begin{proof}[Solution]}
        {\end{proof}}

In your document you should enter the problem and solution as follows.

    \begin{problem}
        (Type the question here.)
    \end{problem}
    \begin{solution}
        (Type solution here.)
    \end{solution}

Print and hand in your PDF and LaTeX files as usual.

Note the following.

References

[1]    A. Wiles, Modular elliptic curves and Fermat’s Last Theorem, Annals of Mathematics 141 (1995) 443–551.

[2]    Wikipedia contributors, Maryam Mirzakhani, Wikipedia. Visited 13 October 2022, updated 13 October 2022, https://en.wikipedia.org/wiki/Maryam_Mirzakhani.

[3]    J. C. Maxwell, A Treatise on Electricity and Magnetism Volume 1, Dover Publications Inc., 3rd edition, 2003.