MAS116/MAS117 PRESENTATION LAB 1
In this lab we will use LaTeX within a software bundle called MiKTeX (pronounced ‘mik-tek’) to create basic mathematical documents.
Log on to a university Windows machine, then check to see if MiKTeX is
installed on the computer by typing texworks
into the search box at the bottom
of the screen. If it’s not there, you need to install it from the Software Center on
the desktop.
The Software Center may take a minute or two to work properly. If it’s not responding, wait, then press F5.
Once MiKTeX is installed, start TeXWorks.
Delete any text that appears in the left-hand source pane and carefully type the text below.
\documentclass[11pt, a4paper]{amsart} \begin{document} Hello! Here is $f(x) = \frac{e^x}{1 - x}$ inline. Here it is bigger on a new line: \[ f(x) = \frac{e^x}{1 - x}. \] Here is an integral: \[ \int \cos(x) dx = \sin(x) + c. \] \end{document}
Click on the big green triangle, but make sure it says pdfLaTeX
and not pdfTeX
by the side. If you’re asked to save your file, make a folder in Documents
on your
U: drive called mas116_latex
(or mas117_latex
) and use the filename
lab_1.tex
.
A PDF document should appear; note that the first run might take several seconds.
If the green triangle has turned into a red cross and no PDF has appeared after a little wait, click on the red cross, check your typing carefully and try again. If you still have problems, ask for help.
You can use ctrl-T
as a keyboard shortcut for clicking the green triangle.
By comparing the source code (the text you typed) with the output, do some experimenting to answer the following questions, pressing the green traingle each time to see the result. Note down your answers.
$
-signs in the source code? Does it work
without them? What happens if you type f(x)
without $
-signs?
\[
and
\]
? (Try turning them into $
-signs or vice-versa.)
Here is an integral: \
[\int\cos(x)dx=\sin(x)+c.\]
\frac
command done?Here, you’ve created your first LaTeX file (pronounced ‘lay-tek’). LaTeX is a
mark-up language used for creating good quality mathematical documents. Every
LaTeX file starts with a \documentclass
command. We are using the American
Mathematical Society (AMS) ‘article’ class, hence amsart
.
The main content is put between \begin{document}
and \end{document}
commands. Maths must go inside $
-signs if it’s inline, or inside \[
…\]
if it needs
to be displayed large on its own line (called displayed mathematics or display
math). You will sometimes see $$...$$
for displayed mathematics but \[
…\]
is
preferred.
Let’s do some more experimenting.
\cos(x) \, dx
.
\int
command into \int_0^\pi
?
Finish off the calculation of the definite integral in your document
(including something like “”).
“Let . Then
completing the line by calculating the derivative of by hand and typing it in. Show the steps in your workings by including them as part of the line beginning “”.
“Because the derivative of is , it follows that
where the last line is finished as in question 6.
$
-signs and backslashes with the
and
in the previous question, as in $\cos(x)$
?Something that might improve things further is align equals signs, as in
One way to do this is to use the \begin{align*}
and \end{align*}
commands,
as in the following.
\begin{align*} \int_{0}^{\pi}\cos(x) \, dx &= [\sin x]_{0}^{\pi} \\ &= \sin \pi - \sin 0 \\ &= 0. \end{align*}
Here, the ampersand, &
, is placed before the symbol you want aligned, and a
double-backslash, \\
, is placed at the end of a line. Experiment with this on the
workings you had completed earlier on.
We will now give the document some structure. Between \begin{document}
and
the first paragraph, put the line \section{Differentiation}
. Before the second
paragraph, put the line \section{Integration}
. Your PDF output should now
have sections.
Let’s make things look even better with a title.
\begin{document}
command, put the command\title{Calculus examples}
, then process the file. Any change?
See below if not.
\title{}
command works differently to the \section
one.
Type \maketitle
after \begin{document}
. Now process the file.
This time it should work.
\author{(your name)}
under \title{Calculus examples}
,
and process the file again.
\date{September 1684}
just after
the \author{...}
command. What about using \date{\today}
instead?This document is pretty much finished. Add a new section called ‘Formulas’ and try to typeset the main three differentiation rules (product, quotient and chain) along with the formula for integration by parts. Look them up if you’ve forgotten them! _______________________________________________________________
In response to a homework question, a student handed in the following.
(chain rule)
Your job is to try and work out what question was asked, then write a much better solution using LaTeX, correcting errors and improving the solution above as much as possible. Be sure to read through the first lecture again before doing this.
Your document should have two sections, ‘Question’ (where you state your guess at the question) and ‘Solution’. Your solution doesn’t need to be long, but should include significantly more words than the badly written one above.
$\sin$
and $\cos$
in your
solution.
.tex
LaTeX file.
You must hand then in at the begining of next week’s computer lab.This homework counts towards the homework component of your module mark, as do all the weekly presentation homeworks. As such this must be all your own work: you must not plagiarise or collaborate with other students, and you must not use AI tools.
If you have problems then feel free to use the Discussion Board on Blackboard or Simon Willerton’s office hour.