Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Project: math480-2016
Views: 2158
1
% this is a comment -- it is a line starting in %
2
3
% the pre-eamble is everything from \documentclass to \begin{document}
4
\documentclass[12pt]{article} % the 12pt makes the font bigger
5
\title{Math 480: Lectures 11 -- Latex (2 of 3)} % document title
6
\author{William Stein} % who wrote this
7
\date{April 20, 2016}
8
9
\usepackage{amssymb}
10
11
\usepackage{hyperref} % make it so there is a \url{} command and links work (in pdf!)
12
13
% include support for putting pdf's and png's in our file
14
\usepackage{graphicx}
15
16
% Package for the "newtheorem" command
17
\usepackage{amsthm}
18
\newtheorem{exercise}{Exercise}[section] % exercise environment
19
20
\begin{document}
21
% this is the body of the document
22
23
% This is a command that says: "put the title block here".
24
% Try copying this command and putting it somewhere else and get multiple titles
25
\maketitle
26
27
\tableofcontents
28
29
% Use \section{...} to make a new section.
30
\section*{Reminders\label{reminders}}
31
32
{\bf Some reminders:} % md the {\bf ...} makes it bold
33
34
\begin{enumerate}
35
\item Start screencast!
36
\item You should open {\tt lectures/2016-04-20/2016-04-20.tex} in your project
37
\item \label{reminder-homework} Homework and peer grading due Friday at 6pm. (Questions?)
38
\end{enumerate}
39
40
\section{Math formulas}
41
\LaTeX is massively different than Microsoft Word. You focus
42
entirely on the content and structure of what you are
43
writing, not on how it looks. Also, the result is much more
44
professional looking. And you can define functions, e.g.,
45
46
\newcommand{\hello}[1]{Hello #1, hello #1 !! }
47
48
\hello{World} - I say \hello{to you}!
49
50
\subsection{Some basics}
51
Google ``latex symbols''\footnote{Look in the tex file for how I did those quotes and this footnote.} for tables giving how to typeset
52
interesting symbols, like this:
53
$$
54
\varphi, \Xi, \partial, \hookleftarrow, \bigoplus
55
$$
56
57
Consider $\varphi + \Xi^3$.
58
59
Top hit (and I'm having dinner with them on Friday):\\ \url{https://www.artofproblemsolving.com/wiki/index.php/LaTeX:Symbols}
60
61
This webpage explains a lot of math typesetting. Here's
62
some key things:
63
\begin{itemize}
64
\item Braces: $\{ x : x \in \mathbb{Q}\}$
65
\item Powers: $x^{2+3}$, $x^2+3$, $x^(2+3)$
66
\item Subscripts: $x_2, x_5, x_{2+3}$
67
\item Both: $x^{2+3}_{5}$
68
\item A fraction: $\frac{2+3 \hello{10}}{5}$
69
\item An integral: $\int_0^{\pi+e^i} \sin(x) dx$
70
\item A ``displayed'' integral: $$\int_0^{\pi} \sin(x) dx$$
71
\end{itemize}
72
73
\url{http://detexify.kirelabs.org/classify.html}
74
75
\subsection{Using Sage}
76
77
Given any object {\tt obj} in a Sage worksheet you
78
can (try to) do {\tt latex(obj)} to see how to typeset
79
obj. You already learned about sagetex, which uses
80
this under the hood, on Monday.
81
82
$$
83
x + \frac{1}{6} x^{3} + {(-\frac{1}{40})} x^{5} + {(-\frac{55}{1008})} x^{7} + \mathcal{O}\left(x^{8}\right)
84
$$
85
86
$$
87
\displaystyle \left(\begin{array}{rrr}
88
1 & -2 & \frac{1}{2} \\
89
1 & 0 & 0 \\
90
-2 & 0 & 1
91
\end{array}\right)
92
$$
93
94
\begin{exercise}
95
Use Sage to find a latex formula for the first few terms
96
of the Taylor series of $\tan(x)$ about
97
zero.\footnote{Hint: use {\tt latex(tan(x).series(x, 10))} in a worksheet, then copy/paste.}
98
\end{exercise}
99
100
$$
101
your series here!
102
$$
103
104
105
\begin{exercise}
106
Use Sage to Find a latex formula for a matrix using Sage. Use the command {\tt matrix} to make a matrix.
107
\end{exercise}
108
109
$$
110
your matrix here!
111
$$
112
113
114
115
116
\subsection{Use Some random webpage}
117
118
If you do a Google search for {\tt latex formula editor}
119
you'll find (many) kind-of-ugly websites with
120
various programs that
121
let you graphically construct an equation, which show
122
you the latex code.
123
124
This is an unusual new demo, where they use machine learning
125
to recognize handwriting (it is pretty impressive):\\
126
\url{http://webdemo.myscript.com/#/demo/equation}
127
128
$$
129
\frac{\Omega +\alpha ^{3}} {2}
130
$$
131
132
\section{Sectioning and cross referencing\label{a-label}}
133
This is Section \ref{a-label}. The next section is Section \ref{graphics}.
134
You can reference anything, e.g., reminder \ref{reminder-homework}
135
from Section \ref{reminders}.
136
137
\begin{exercise}
138
Try reordering the enumerate list above in some random way and or the sections
139
(or adding new ones), then recompile and see all the cross reference numbers
140
get updated.
141
\end{exercise}
142
143
144
\section{Including graphics\label{graphics}}
145
146
You can take any pdf, png, or jpg file, put it in the
147
same directory as your tex file (+New, drag and drop),
148
and display them as follows:
149
150
\begin{center} % this centers it
151
\includegraphics[width=.6\textwidth]{svr.jpg}
152
\end{center}
153
154
\hello{\includegraphics[width=.1\textwidth]{svr.jpg}}
155
156
$$x^{\includegraphics[width=.1\textwidth]{a.pdf}} + 1$$
157
158
\begin{exercise}
159
Upload and insert an image of your choice below. It must
160
be png or pdf.
161
\end{exercise}
162
163
% Copy paste the includegraphics thing above here, change
164
% the name from image to the name of your file:
165
166
167
168
Sage can also produce pdf's of plots.
169
E.g., if {\tt g = plot(sin) + plot(cos)}, then
170
{\tt g.save('a.pdf')} will create a file {\tt a.pdf}
171
that you can include. This is a little more tedious
172
than Sagetex, but you have more control.
173
174
\begin{exercise}
175
Create a plot and save it to a file
176
as above in a Sage worksheet, then include it below:
177
\end{exercise}
178
179
% Copy paste the includegraphics thing above here, change
180
% the name from image to the name of your file:
181
182
183
184
185
\end{document}
186
187