Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Project: Math 152 - Winter 2017
Views: 17362% this is a comment -- it is a line starting in %12% the pre-eamble is everything from \documentclass to \begin{document}3\documentclass[12pt]{article} % the 12pt makes the font bigger4\title{Math 152: Intro to Mathematical Software -- Lecture 7: LaTeX (part 2)} % document title5\author{Kiran Kedlaya (guest lecturer: Alina Bucur) \\6(based on lectures by William Stein, University of Washington)} % who wrote this7\date{January 25, 2017}89\usepackage{amssymb}1011\usepackage{hyperref} % make it so there is a \url{} command and links work (in pdf!)1213% include support for putting pdf's and png's in our file14\usepackage{graphicx}1516% Package for the "newtheorem" command17\usepackage{amsthm}18\newtheorem{exercise}{Exercise}[section] % exercise environment1920\begin{document}21% this is the body of the document2223% This is a command that says: "put the title block here".24% Try copying this command and putting it somewhere else and get multiple titles25\maketitle2627\tableofcontents2829% Use \section{...} to make a new section.30% The * prevents it from being automatically numbered.3132\section{Announcements\label{announcements}}3334{\bf Some announcements:} % md the {\bf ...} makes it bold3536\begin{enumerate}37\item You should open {\tt lectures/2017-01-25/2017-01-25.tex} in your project to follow along.38\item \label{reminder-homework} HW 2 peer grading due Thursday, January 26 at 8pm.39\item HW 3 due Tuesday, January 31 at 8pm.40\end{enumerate}4142\section{Math formulas}43\LaTeX\ is massively different than a typical word processor (e.g., Microsoft Word). You focus entirely on the content and structure of what you are44writing, not on how it looks. Also, the result is much more45professional-looking. And you can define functions, e.g.,4647\newcommand{\hello}[1]{Hello #1, hello #1 !! }4849\hello{World} - I say \hello{to you}!\\50\hello{Kiran}5152\subsection{Some basics}53Google ``latex symbols''\footnote{Look in the tex file for how I did those quotes and this footnote.} for tables\footnote{what is a table?} giving how to typeset54interesting symbols, like this:55$$56\varphi, \Xi, \partial, \hookleftarrow, \bigoplus57$$5859Consider $\varphi + \Xi^3$.6061Top hit (San Diego company interested in math education! Ask me about them later):\\ \url{https://www.artofproblemsolving.com/wiki/index.php/LaTeX:Symbols}6263This webpage explains a lot of math typesetting. Here are some key things:64\begin{itemize}65\item Braces: $\{ x : x \in \mathbb{Q}\}$66\item Powers: $x^{2+3}$, $x^2+3$, $x^(2+3)$67\item Subscripts: $x_2, x_5, x_{2+3}$68\item Both: $x^{2+3}_{5}$69\item A fraction: $\frac{2+3 \hello{10}}{5}$70\item An integral: $\int_0^{\pi+e^i} \sin(x) dx$71\item A ``displayed'' integral: $$\int_0^{\pi} \sin(x) dx$$72\end{itemize}7374\url{http://detexify.kirelabs.org/classify.html}7576\subsection{Using Sage}7778Given any object {\tt obj} in a Sage worksheet you79can (try to) do {\tt latex(obj)} to see how to typeset80obj. You already learned about sagetex, which uses81this under the hood, on Monday.8283$$84x + \frac{1}{6} x^{3} + (-\frac{1}{40}) x^{5} + (-\frac{55}{1008}) x^{7} + \mathcal{O}\left(x^{8}\right)85$$8687$$88\displaystyle \left(\begin{array}{rrr}891 & -2 & \frac{1}{2} \\901 & 0 & 0 \\91-2 & 0 & 192\end{array}\right)93$$9495\begin{exercise}96Use Sage to find a \LaTeX\ formula for the first few terms97of the Taylor series of $\tan(x)$ about98zero.\footnote{Hint: use {\tt latex(tan(x).series(x, 10))} in a worksheet, then copy/paste.}99\end{exercise}100101$$102your series here!103$$104105106\begin{exercise}107Use Sage to find a \LaTeX\ formula for a matrix using Sage. Use the command {\tt matrix} to make a matrix.108\end{exercise}109110$$111your matrix here!112$$113114115116117\subsection{Use Some random webpage}118119If you do a Google search for {\tt latex formula editor}120you'll find (many) kind-of-ugly websites with121various programs that122let you graphically construct an equation, which show123you the latex code.124125This is an unusual new demo, where they use machine learning126to recognize handwriting (it is pretty impressive):\\127\url{http://webdemo.myscript.com/#/demo/equation}128129$$130\frac{\Omega +\alpha ^{3}} {2}131$$132133\section{Sectioning and cross referencing\label{a-label}}134This is Section \ref{a-label}. The next section is Section \ref{graphics}.135You can reference anything, e.g., reminder \ref{reminder-homework}136from Section \ref{announcements}.137%Fix the typo here!138139\begin{exercise}140Try reordering the enumerate list above in some random way and or the sections141(or adding new ones), then recompile and see all the cross reference numbers142get updated.143\end{exercise}144145146\section{Including graphics\label{graphics}}147148You can take any pdf, png, or jpg file, put it in the149same directory as your tex file (+New, drag and drop),150and display them as follows. (Photo taken by William Stein.)151152\begin{center} % this centers it153\includegraphics[width=.6\textwidth]{svr.jpg}154\end{center}155156\hello{\includegraphics[width=.1\textwidth]{svr.jpg}}157158% Newly added feature: if LaTeX encounters any errors while processing159% your source file, the errors are marked in place. This isn't perfect,160% but this example is spot on:161162$$x^{\includegraphics[width=.1\textwidth]{a.pdf}} + 1$$163164% Fix the typo and see what happens!165166\begin{exercise}167Upload and insert an image of your choice below. It must168be png or pdf.169\end{exercise}170171% Copy paste the includegraphics thing above here, change172% the name from image to the name of your file:173174175176Sage can also produce pdf's of plots.177E.g., if {\tt g = plot(sin) + plot(cos)}, then178{\tt g.save('a.pdf')} will create a file {\tt a.pdf}179that you can include. This is a little more tedious180than Sagetex, but you have more control.181182\begin{exercise}183Create a plot and save it to a file184as above in a Sage worksheet, then include it below. (Remember, you can use the ``Plots'' menu in a worksheet to see some examples of plotting syntax.)185\end{exercise}186187% Copy paste the includegraphics thing above here, change188% the name from image to the name of your file:189190191192193\end{document}194195196