\documentclass[12pt,oneside]{article}
\usepackage{geometry}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
%\usepackage{pdfpages}
\usepackage{enumerate}
\usepackage[all]{xy}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage{appendix}
%\usepackage{caption}
\usepackage{subcaption}
\usepackage{color}
\usepackage{verbatim}
\usepackage{mathtools}
\usepackage{tikz-cd}
\usepackage[section]{placeins}
\usepackage{showkeys}
\usepackage{hyperref}
\usepackage{enumitem}
\usepackage{multicol}
\hypersetup{
colorlinks=true,
allcolors=blue,
}
%ENVIRONMENTS
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{lemma}{Lemma}
\newtheorem{remark}{Remark}
\newtheorem{conjecture}{Conjecture}
\newtheorem{example}{Example}
\newtheorem{proposition}{Proposition}
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\newtheorem{note}{Note}
%OPERATORS
\DeclareMathOperator{\dist}{dist}
%SYMBOLS
\def\a{\alpha}
\def\b{\beta}
\def\m{\mu}
\def\n{\nu}
\def\u{\upsilon}
\def\l{\lambda}
\def\CC{\mathbb{C}}
\def\R{\mathbb{R}}
\def\Q{\mathbb{Q}}
\def\Z{\mathbb{Z}}
\def\N{\mathbb{N}}
\def\T{\mathbb{T}}
\def\H{\mathbb{H}}
\def\S{\Sigma}
\def\s{\sigma}
\def\e{\epsilon}
\def\B{\mathcal{B}}
\def\O{\Omega}
\def\o{\omega}
\def\C{\mathcal{C}}
\def\U{\mathcal{U}}
\def\A{\mathcal{A}}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{A Hands-on Introduction to Creating Mathematical Documents with \LaTeX}
\author{John Adamski}
\date{\today}
\maketitle
\begin{abstract}
Have you ever wondered how professional mathematical documents are created? How the equations and symbols can be positioned and formatted so beautifully? The answer is that these documents are created very differently from Word documents. They are created using a mark-up language (code) called \LaTeX ~and then compiled to produce the final document. In this workshop, I will give a brief overview of \LaTeX, explain different options for how to work with \LaTeX ~files, and share some samples for attendees to play with and use to create their own documents. Everyone is highly encouraged to bring a laptop or tablet to this event.
\end{abstract}
\tableofcontents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Latex is a mark-up language}
A lot of document editing programs like Microsoft Word and Google Docs are WYSIWYG -- What You See Is What You Get. In those programs, you type and create the final document directly. If you want to skip a line, you just skip a line. \LaTeX ~does not work this way. \LaTeX ~is a mark-up language (like HTML) that you use to create a plain text file that is later compiled to produce your final document. In other words, you do not create the final document; you create a set of instructions for how you would like the final document to be created. And the beauty of it is that you do not need to (and sometimes cannot) worry about the tiny details of formatting -- this is largely handled automatically by the compiler.
By default, everything we type into the plain text {\tt .tex} file will be printed on the final document except for the nine characters below.
\begin{verbatim}
\ { } & _ ^ % ~ #
\end{verbatim}
Those are special charcters that let the compliler know that what follows is not content to be printed, but instructions for the compiler. More on that later.
\subsection{Spaces, newlines, and paragraphs}
Notice that no matter how many spaces I put in my {\tt .tex} file, the printed document includes only one. You do not control the space between characters, the compiler handles this, and it does it well (extra space after periods, hyphenated line-breaks, etc.).
Notice
that
newlines
are
not
printed
how
you
type
them.
If you want to start a newline, you need to put \verb(//( at the end the line, and then start a new line below.\\
Just \\
like\\
this.
If you want to start a new paragraph, just put a blank line in your code.
Like this. Skipping more lines in your code\ldots
will not have any effect. If you want to insert more space between sections of text, use the command \verb(\vspace{1in}(, where the argumanet 1in can be replaced with any number of any of the following units.
\begin{center}
\begin{tabular}{ ll }
cm & Centimeters\\
em & The width of the letter M in the current font\\
ex & The height of the letter x in the current font\\
in & Inches\\
pc & Picas (1pc = 12pt)\\
pt & Points (1in = 72pt)\\
mm & Millimeters
\end{tabular}
\end{center}
See that? $\uparrow$ That's a table. The \verb({ll}( argument lets the compiler know that my table has two columns and that each column should be left-justified. Within the table, the \verb(&( sign is used to separate columns, and the newline command \verb(\\( is used to start a new row. You can learn more about tables by googling ``latex tables''{\tt latex tables}\footnote{Duh. But really, the internet is very helpful. You will find answers to pretty much any \LaTeX ~question you have on url{https://tex.stackexchange.com/}.}. Notice that since I didn't leave a blank line after the table, a new paragraph was not started.
That requires a blank line.
\subsection{Comments}
Whenever we write code, it is good style to insert comments. Anything in a line of code following a \verb(%( sign is entirely ignored by the compiler. %This text will not print.
%This entire line will not print.
We insert comments in our code for our own benefit.
For example, it can be to remind us what a block of text is.
%troubleshooting
Commenting out some of your code can also help you when debugging (there will be bugs). Just insert \verb(%( signs at the beginning of any line you wish to have the compile ignore. This way you do not have to delete it. It will still be there when you want to try including it again.
%Aha!
\section{Sections and environments}
I think you can see by example that we use the \verb(\section{title}( and \verb(\subsection{title}( commands to spilt our document into sections and subsections. Numbering of sections is automatic. If you don't want a section or subsection to have a number, then use the \verb(\section*{title}( and \verb(\subsection*{title}( commands. The \verb(*( will suppress the number.
One of the most useful features of \LaTeX ~is the ability to \verb(\begin( and \verb(end( different environments. Right now, we are not in any environment and my text is rendered in the usual way.
\begin{center}
But I can have my text centered by entering a new envirnment for that.
\end{center}
There are even environments for theorems, definitions, proofs, etc.
\begin{theorem}[My silly theorem]
This is a silly theorem.
\end{theorem}
\begin{proof}
Don't you see? It's silly!
\end{proof}
\begin{definition}
This is the definition environment.
\end{definition}
You can even make your environments like these. To see how this is done, scroll to the top and look at the block of code labelled \verb(%ENVIRONMENTS(.
\subsection{Math environment}
The one you've been waiting for. To enter/ext in-line math mode, we use the \verb($( sign. Here is an example: $\sin^2\theta + \cos^2\theta = 1$. This is good for smaller things, short equations or referencing variables $x, y, z$. For bigger equations, you will want to use the equation environment.
\begin{equation}
\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi}{6}
\end{equation}
Within the math environment, you have access to many many many many symbols. \href{https://www.cmor-faculty.rice.edu/~heinken/latex/symbols.pdf}{Here} is a reference for some of the symbols you can use. \href{https://detexify.kirelabs.org/classify.html}{Here} is a web app called Detexify that lets you draw the symbol you want and tell you what the \LaTeX command for tha symbol is.
By default, exponents are assumed to be one digit/character/symbol. Things like $3^2$ and $e^x$ works just as expected. But if your exponent is more than a single character, you will need to use brackets \verb({}( around your exponent so that \LaTeX knows to put all of that stuff in the exponent position. Suppose you want to raise 2 to the 10th power. You cannot write $2^10$ as you would with a calclator\footnote{Maybe here is a good time to mention that \LaTeX is not checking your math, or doing anything of the sort. It will not let you know when you leave out parentheses or anything like that. It is just printing symbols.}. You must write $2^{10}$.
In general, attaching an underscore \verb(_( to a symbol with cause the next symbol to be a subscript, ad attaching a carot \verb(^( will cause the next symbol to be a superscript.
\begin{equation*}
T(x) = \sum_{n = 1}^\infty \frac{f^{(n)}(x_0)}{n!}(x - x_0)^n
\end{equation*}
It is even possible for subscripts and superscripts to have subscripts/superscirpts.
\begin{equation*}
x_{\alpha_0}^{{\beta_0}^{2^{10}}}
\end{equation*}
But you should probably reconsider your choice of notation if you find yourself typing such things.
Here are some additional equations that demonstrate some other \LaTeX commands.
\begin{align*}
(x + y)^2 &= x^2 + xy + xy + y^2 \\
&= x^2 + 2xy + y^2
\end{align*}
Notice that the \verb(&( symbol is used to separate columns, just as it was used within the \verb(\tabular{}( environment. It can also be used to create matrices.
\begin{equation*}
\left[\begin{array}{ccc}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{array}\right]^T =
\left[\begin{array}{ccc}
1 & 4 & 9 \\
2 & 5 & 8 \\
3 & 6 & 9
\end{array}\right]
\end{equation*}
\begin{equation*}
f(x) = \left\{\begin{array}{ll}
3x + 4 & \mbox{ if } x<1 \\
\ln x & \mbox{ if } 1 \leq x < 4 \\
\sin x & \mbox{ if } x \geq 4
\end{array}\right.
\end{equation*}
The \verb(\mbox{}( command can be used to print regular text within a math environment. When you try to write regular text in a math environment \textit{without} using \verb(\mbox{}(, it looks very weird.
\begin{equation*}
This is some regular text
printed inside math mode
\end{equation*}
\begin{equation*}
12 \equiv 5 \pmod 7
\end{equation*}
\begin{equation*}
\emptyset \subseteq A \subset A \cup B
\end{equation*}
\begin{equation*}
\overline{A \cap B} = \overline{A} \cup \overline{B}
\end{equation*}
\begin{equation*}
|X| < \infty \Rightarrow |\mathcal{P}(X)|= 2^{|x|}
\end{equation*}
\begin{equation*}
\lim_{x \to a}f(x) = f(a)
\end{equation*}
\begin{equation*}
\frac{d}{dx} \int f(x) \;dx = f(x)
\end{equation*}
\begin{equation*}
\int_1^x \frac{1}{x} \;dx = \ln x
\end{equation*}
\subsection{Math fonts}
You can changee the font of letters using the following commands.
%\renewcommand{\labelenumi}{\roman{enumi}}
\begin{enumerate}%[itemsep=2ex]
\item \verb(\mathbb{Z}( $\rightarrow \mathbb{Z}$\\
This is the font for all the familiar sets of numbers: $\N, \Z, \Q, \R, \CC$
\item \verb(mathcal\{P}( $\rightarrow \mathbb{P}$\\
This is a caligraphy font that makes letters just a little fancy: $\mathcal{A, B, C, D, E, }\ldots$
\end{enumerate}
\subsection{Parentheses}
Sometime we want parentheses to be big. For example, when the expression they contain is big. If we use \verb(\left(( and \verb(\right)(, then the parentheses will be scaled to match the size of what appears between the two commands. See the difference below.
\begin{equation*}
(\frac{\pi}{3}) \mbox{ vs. } \left( \frac{\pi}{3} \right)
\end{equation*}
\section{Packages}
Scroll to the top of the code and notice there are several lines of the form \verb(\usepackage{}(. This is a declaration that tells the compiler to
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{thebibliography}{99}
%\bibitem{}
%\newblock
%\newblock
%\end{thebibliography}
\end{document}