% LaTeX Article Template
\documentclass[12pt]{article}
\usepackage{amsthm,amsmath,amsfonts,amssymb,latexsym,graphicx,multicol}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
% Set the beginning of a LaTeX document
\begin{document}
\title{\LaTeX Workshop \\ TUG 2020 Conference}
% Enter your title between curly braces
\author{Cheryl Ponchin and Sue DeMeritt} % Enter your name between curly braces
\date{July 2020} % Enter your date or \today between curly braces
%\pagenumbering{roman}
\maketitle
\clearpage
\tableofcontents
\clearpage
\begin{abstract}
\LaTeX\ is widely used in typesetting mathematics. In this workshop you
will review the basic \LaTeX\ commands as well as ways to use
\LaTeX\ to fit your needs.
\end{abstract}
\clearpage
\Large
\section{Creating a \LaTeX\ Document}
When creating a \LaTeX\ document, you begin with an input file that has a \texttt{.tex}
extension (i.e., \texttt{filename.tex}), with the editor of your choice.
Let's get started by typing the following in your input file.
\\
\verb+\documentclass[12pt]{article}+ \\
\verb+\usepackage{amsthm,amsmath,amsfonts,amssymb}+ \\
\verb+\begin{document}+ \\
\bigskip
\verb+\end{document}+\\
This sets your skeleton template. The information above the
\verb+\begin{document}+ is the preamble. This is where
you will add the usepackages that may be needed to produce the
document. There are many packages which are available, a few example of them are used in this document.
The first line (i.e., \verb+\documentclass[12pt]{article}+) sets the
documentclass style file for your paper. In this case we are using the ``article''
as the class file. You can alter this file and re-name it to suit your needs.
The other standard style files are ``report'',``book'', ``slides'',
and ``letter''. You can add options by using \verb+[ ]+ after the
\verb+\documentclass+. Common \texttt{documentclass} options are as
follows: 10pt/11pt/12pt (font size), letterpaper/a4paper (paper
size), twocolumn (using two columns), twoside (setting margins for
two-sided documents), landscape (orientation), and draft (which sets
the document in double spacing).
In \LaTeX\ when you start an environment there is always a beginning and
an end. This is either by using
\verb+\begin{something} ... \end{something}+ or by using
\verb+\somedefinition{}+. In this last example the command begins with
a \verb+\+ and takes arguments within \verb+{braces}+.
\section{Creating Numbered Section Headings}\label{sec:sections}
When you type your first section, \LaTeX\ automatically begins
numbering with 1 as the default style. The
next section will be numbered 2, and so on. The way to create a section heading is to type
the following \verb+\section{Text}+. If you want
to change the number to be in Roman numerals, type the following:
\begin{center}
\verb+\renewcommand{\thesection}{\Roman{section}}+.
\end{center}
\noindent The next time
you use \verb+\section{}+ the number will be in Roman numerals.
\renewcommand{\thesection}{\Roman{section}}
\section{Creating a Section That uses Roman\hfill\break Numeral Numbering}
\section{Still Using \texttt{Roman} Numbering for Sections}
The numbering will stay in Roman numerals until you change it back.
\begin{center}
\verb+\renewcommand{\thesection}{\arabic{section}}+
\end{center}
\renewcommand{\thesection}{\arabic{section}}
\section{Changing Numbering Back to \texttt{arabic}}
This section numbering goes back to arabic numbering because
\verb+\renewcommand{\thesection}{\arabic{section}}+ was typed before
we did our next section.
\clearpage
\subsection{Creating Subsection Headings }\label{sec:subsections}
When you type \verb+\subsection{}+ the default numbering will start with 1.1, then 1.2,
etc.
There is also a \verb+\paragraph{}+ and a \verb+\subparagraph{}+.
They look like this:
\paragraph{Paragraph}\label{para}
This is the paragraph.
\subparagraph{Subparagraph}\label{subpara}
This is the subparagraph.
\section{Creating Footnotes}
Creating a footnote\footnote{This is an example of a footnote.} is done by adding \verb+\footnote{}+ and putting the text you want between the braces. The default is automatically numbered starting with the number~1.
\clearpage
\section{Changing Font Styles}
Your text is now in the default of TimesRoman. You can simply change
the style of a
word or words. For example \textbf{boldface},
\textsf{SanSerif}, \textit{Italics}, \textsc{smallcaps}, and so on.
The code for the above: \verb+\textbf{boldface}+,\hfill\break
\verb+\textsf{SanSerif}+, \verb+\textit{Italics}+, and\hfill\break
\verb+\textsc{smallcaps}+.
\section{Marking the Margin of a Paragraph}\label{margins}
\marginpar{\rule[-17.5mm]{1mm}{18mm}} By typing
\verb+\marginpar{\rule[-17.5mm]{1mm}{18mm}}+ it will mark
the current paragraph with a line in the margin. You might want to do
this if you want to bring attention to a specific paragraph in your
paper.
You can also add words in the margin.\marginpar{See this statement.}
\verb+\marginpar{See this statement.}+
\clearpage
\section{Text in Columns}\label{sec:columns}
You can typeset a paper in regular paragraph form or you can
change the number of columns.
\begin{verbatim}
\begin{multicols}{2}
...
\end{multicols}
\end{verbatim}
\begin{multicols}{2}
Now you can continue typing as usual only the column will not be in
single column format, it will change to the amount of columns you
assign.
\end{multicols}
\begin{verbatim}
{\setlength{\columnseprule}{2pt}
\begin{multicols}{3}
...
\end{multicols}
}
\end{verbatim}
{\setlength{\columnseprule}{2pt}
\begin{multicols}{3}
Now you can continue typing as usual only the column will not be in
single column format, it will change to the amount of columns you
assign.
\end{multicols}
}
\begin{verbatim}
{\setlength{\columnseprule}{0pt}
\begin{multicols}{3}
...
\end{multicols}
}
\end{verbatim}
{\setlength{\columnseprule}{0pt}
\begin{multicols}{3}
\raggedright Now you can continue typing as usual only the column will
not be in single column format, it will change to the amount of
columns you assign.
\end{multicols}
}
\section{Creating a Table of Contents}\addcontentsline{toc}{subsection}{Text}
\label{sec:toc}
You can add a table of contents to your paper very easily. All you
need to do is add \verb+\tableofcontents+. The table of contents
will give you all the sections and subsections, etc., with their page
numbers. However, sometimes you need to add extra information to the
table of contents that you only want on the contents page and not in the main document. You do
this by adding \verb+\addcontentsline+. The following line is what would be used in the body of your document.
\noindent \verb+\section{Section Heading}+
\noindent \verb+\addcontentsline{toc}{subsection}{Text}+
Note: the table of contents
will appear in the paper where the \verb+\tableofcontents+ is in the
text.
\section*{Adding to Contents}\addcontentsline{toc}{section}{Adding to Contents}
The above section heading above was created by typsetting \verb+\section*{}+
when this is used, it gives the same definition of \verb+\section{}+ without the automatic
numbering. Because of this, the section will not automatically be
added to the contents page.
If you want to add this unnumbered section to the contents page, add
the follownig information.
\begin{verbatim}
\addcontentsline{toc}{section}{Text}
\end{verbatim}
\verb+\addcontentline+ is the definition, \verb+{toc}+ means the table of
contents page, the \verb+{section}+ means in the section format, and
the words \verb+{Text}+ is what
will be added on the contents page.
\section{Itemizing, Enumerating, and Nesting}\label{sec:itemizing}
Itemizing is a way to list items. The default symbol
for the itemizing is a bullet. For example,
\begin{verbatim}
\begin{itemize}
\item This is my first line.
\item This is my second line.
\item This is my third line
\end{itemize}
\end{verbatim}
creates the following:
\begin{itemize}
\item This is my first line.
\item This is my second line.
\item This is my third line
\end{itemize}
If you want to change the default symbol, you put the character (in \$
signs if necessary) inside two square brackets, for example
\begin{verbatim}
\begin{itemize}
\item[$\oplus$] This is my first line.
\item[$\curlyvee$] This is my second line.
\item[$\Cup$] This is my third line.
\end{itemize}
\end{verbatim}
creates the following:
\begin{itemize}
\item[$\oplus$] This is my first line.
\item[$\curlyvee$] This is my second line.
\item[$\Cup$] This is my third line.
\end{itemize}
You can use any symbol math or non-math instead of a
bullet. Just remember the math symbols need \$ signs and the non-math
symbols do not. But they all have to be with a [ and a ].
Enumerating is very similar to itemizing, however, as the name infers,
it numbers the lines instead of using bullets.
\clearpage
\begin{verbatim}
\begin{enumerate}
\item This is my first line.
\item This is my second line.
\item This is my third line.
\end{enumerate}
\end{verbatim}
creates the following:
\begin{enumerate}
\item This is my first line.
\item This is my second line.
\item This is my third line.
\end{enumerate}
Nesting is basically the same; it is a list within a list. For
example,
\begin{verbatim}
\begin{enumerate}
\item This is the first line. \label{itm:first}
\item This is my second line. \label{itm:second}
\begin{enumerate}
\item This is the first line of nesting.
\begin{itemize}
\item Here is the first line of another nesting.
\item Here is the second line of another nesting.
\end{itemize}
\item This is the second line of nesting.
\end{enumerate}
\item Now this is the third line of the original
enumeration.
\end{enumerate}
\end{verbatim}
creates the following:
\begin{enumerate}
\item This is the first line. \label{itm:first}
\item This is my second line. \label{itm:second}
\begin{enumerate}
\item This is the first line of nesting.
\begin{itemize}
\item Here is the first line of another nesting.
\item Here is the second line of another nesting.
\end{itemize}
\item This is the second line of nesting.
\end{enumerate}
\item Now this is the third line of the original enumeration.
\end{enumerate}
You can also label and reference your information by using
label after your item and then reference that
item where you want it in your document. For example see
Item~\ref{itm:first}.
\section{Theorems, Lemmas, etc.}\label{sec:theorems}
When you need to add a \label{pg:theorems} Theorem, Lemma,
Proposition, etc., you will need to create the appropriate environment.
For example:
\begin{verbatim}\newtheorem{theorem}{Theorem}\end{verbatim} and
\begin{verbatim}\newtheorem{lemma}{Lemma}\end{verbatim}
the above line(s) are needed in the preamble. Note: the usepackage \verb+amsthm+
will also be needed. To get your\linebreak Theorems, Lemmas, etc., type the
following:
\begin{verbatim}
\begin{theorem}
This is the first theorem.
\end{theorem}
\begin{theorem}
This is the second theorem.
\end{theorem}
\begin{lemma}
This is the first lemma.
\end{lemma}
\end{verbatim}
The output for the above code is:
\begin{theorem}
This is the first theorem.
\end{theorem}
\begin{theorem}
This is the second theorem.
\end{theorem}
\begin{lemma}
This is the first lemma.
\end{lemma}
You can add extra comments to the Theorem, etc.,
\begin{verbatim}
\begin{theorem}[Add this]
This is the third theorem.
\end{theorem}
\end{verbatim}
\begin{theorem}[Add this]
This is the third theorem.
\end{theorem}
\section{Basic Tables}
The following are some simple examples of the tabular environment.
The tabular environment is usually used to create tables. The
\verb+\begin{tabular}+ starts the environment and the
\verb+\end{tabular}+ ends the environment. The \verb+{lcr}+, for
instance, is the justification of the column(s). \verb+l+ is for left justified,
\verb+c+ is for centering the column and \verb+r+ is for right justified.
\begin{verbatim}
\begin{tabular}{lcr}
Mary & Joe & Jane \\
Joe & Jane & Mary \\
Jane & Mary & Joe
\end{tabular}
\end{verbatim}
\begin{tabular}{lcr}
Mary & Joe & Jane \\
Joe & Jane & Mary \\
Jane & Mary & Joe
\end{tabular}
\clearpage
\begin{verbatim}
\begin{tabular}{|l|c|r|}
Mary & Joe & Jane \\
Joe & Jane & Mary \\
Jane & Mary & Joe
\end{tabular}
\end{verbatim}
\begin{tabular}{|l|c|r|}
Mary & Joe & Jane \\
Joe & Jane & Mary \\
Jane & Mary & Joe
\end{tabular}
\bigskip
\begin{verbatim}
\begin{tabular}{|l|c|r|}
\hline
Mary & Joe & Jane \\
\hline
Joe & Jane & Mary \\
\hline
Jane & Mary & Joe \\
\hline
\end{tabular}
\end{verbatim}
\begin{tabular}{|l|c|r|}
\hline
Mary & Joe & Jane \\
\hline
Joe & Jane & Mary \\
\hline
Jane & Mary & Joe \\
\hline
\end{tabular}
\clearpage
\begin{verbatim}
\begin{tabular}{|l|c|r|}
\hline
Mary & Joe & Jane \\
\cline{1-2}
Joe & Jane & Mary \\
\cline{2-3}
Jane & Mary & Joe \\
\hline
\end{tabular}
\end{verbatim}
\begin{tabular}{|l|c|r|}
\hline
Mary & Joe & Jane \\
\cline{1-2}
Joe & Jane & Mary \\
\cline{2-3}
Jane & Mary & Joe \\
\hline
\end{tabular}
\section{Simple Mathematics and Creating Equations}
To create mathematics you put the math text in math mode. This is
done in the line of text by surrounding the math with dollar signs
(i.e., \$x\$), which give the output $x$. There are several ways to
put the mathematics in display form. One example is with double
dollar signs before the equation and after the equation
\verb+$$ x - y $$+. Below are several ways to create text in math
mode.
\begin{verbatim}
This is math in a line of text $a+b, a - b$.
\end{verbatim}
This is math in a line of text $a+b, a - b$.
\LaTeX\ does not care how many space are between the dollar signs,
the output will be the same.
\begin{verbatim}
$$\frac{1+2x}{x+y+xy}$$
\end{verbatim}
$$\frac{1+2x}{x+y+xy}$$
\subsection{Subscripts and Superscripts}
\begin{verbatim}
\begin{equation}\label{eq:xyz}
x_{1}, y^2, z^{i_1}
\end{equation}
\end{verbatim}
\begin{equation}\label{eq:xyz}
x_{1} + y^2 + z^{i_1}
\end{equation}
If you notice in the above example the equation is numbered. If you
number an equation you can refer to it later.
You do this by creating a label (i.e., \verb+\label{...}+. Later on
you can refer to that label \verb+\eqref{...}+ make sure the label and
reference match. This is very useful when you add and delete
equations throughout the paper. For example the following code
\verb+\eqref{eq:xyz}+ is used to produce \eqref{eq:xyz}. In this case
we use \verb+\eqref{}+ which produces () around the equation number.
You can also label and reference sections, subsections, etc. by using
\verb+\label{}+ and then using \verb+\ref{}+, as well as
\verb+\pageref{}+.
\subsection{Accents}
\begin{verbatim}
\begin{equation*}
\hat{a}, \acute{b}, \breve{c}, \vec{d}, \bar{e}
\end{equation*}
\end{verbatim}
\begin{equation*}
\hat{a}, \acute{b}, \breve{c}, \vec{d}, \bar{e}
\end{equation*}
In the above example \verb+\begin{equation*}+ was used this puts the
text in equation mode without the numbering. This is a good habit to
get into in case later on you want that equation numbered.
\subsection{Binomial Coefficients}
\begin{verbatim}
$$\binom{a}{b+c}$$
\end{verbatim}
$$\binom{a}{b+c}$$
In the above example \verb+$$+ were used. These are used for display
mode just like \verb+\begin{equation*}+.
\clearpage
\begin{verbatim}
\[\binom{\frac{n^2-1}{2}}{n+1}\]
\end{verbatim}
\[\binom{\frac{n^2-1}{2}}{n+1}\]
\subsection{Congruence}
\begin{verbatim}
$$a\equiv v \pmod{\theta}$$
\end{verbatim}
$$a\equiv v \pmod{\theta}$$
\begin{verbatim}
$$a\equiv v \bmod{\theta}$$
\end{verbatim}
$$a\equiv v \bmod{\theta}$$
\subsection{Delimiters}
\verb+\[+ and \verb+\]+ can also be used instead of a \$\$ sign for
display mode.
\begin{verbatim}
\[ \left(\frac{1+x}{2+y2}^2\right)\]
\end{verbatim}
\[ \left(\frac{1+x}{2+y2}^2\right) \]
\clearpage
\begin{verbatim}
$$\left|\frac{a+b}{2}\right|, \left\|A^2\right\|$$
\end{verbatim}
$$\left|\frac{a+b}{2}\right|, \left\|A^2\right\|$$
\begin{verbatim}
$$
M_{n,e}=\left(\frac{4G_nm_{n,e}}{\epsilon}\right)^2.
$$
\end{verbatim}
$$
M_{n,e}=\left(\frac{4G_nm_{n,e}}{\epsilon}\right)^2.
$$
\subsection{Operators}
\begin{verbatim}
$$\sin x \equiv \theta \equiv \alpha$$
\end{verbatim}
$$\sin x \equiv \theta \equiv \alpha$$
\begin{verbatim}
$$\lim_{x\rightarrow 0}f(x)=0$$
\end{verbatim}
$$\lim_{x\rightarrow 0}f(x)=0$$
\subsection{Ellipses}
\begin{verbatim}
$$F(x_1, x_2, \dots, x_n)$$
\end{verbatim}
$$F(x_1, x_2, \dots, x_n)$$
\subsection{Integral}
\begin{verbatim}
$$
\int_0^\pi \sin x, ab =2
$$
\end{verbatim}
$$
\int_0^\pi \sin x, ab =2
$$
\subsection{Sum}
\begin{verbatim}
$$\sum_n+x_2 + \dots + dx=2$$
\end{verbatim}
$$\sum_n+x_2 + \dots + dx=2$$
\clearpage
\subsection{Matrices}
\begin{verbatim}
$$
\begin{matrix}
a+b +c & uv & x-y & 27\\
a+b &u+v&z &234\\
\end{matrix}
$$
\end{verbatim}
$$
\begin{matrix}
a+b +c & uv & x-y & 27\\
a+b &u+v&z &234\\
\end{matrix}
$$
\begin{verbatim}
$$
\begin{pmatrix}
a+b +c & uv\\
a+b &u+v\\
\end{pmatrix}
\begin{pmatrix}
x-y & 27\\
z &234\\
\end{pmatrix}$$
\end{verbatim}
$$
\begin{pmatrix}
a+b +c & uv\\
a+b &u+v\\
\end{pmatrix}
\begin{pmatrix}
x-y & 27\\
z &234\\
\end{pmatrix}$$
\section{How to do Bibliographies}\label{sec:bibs}
One example of doing a bibliography is by adding it to the end of your
file. Use the command \verb+\cite{}+ with the label of your reference in between the
braces. For example, see~\verb+\cite{pon-dem}+. Your output will
show the references as they are presented.
\begin{verbatim}
\begin{thebibliography}{99}
\bibitem{pon-dem} Cheryl Ponchin and
Sue DeMeritt. \LaTeX\ 2019.
\end{thebibliography}
\end{verbatim}
\newcommand{\BIBTeX}{B{\small{IB}}\TeX}
You can also add bibliographies using \BIBTeX. You will use the term
\verb+\cite{}+ with the label of your reference in between the
braces in your .tex document. For example
(see~\verb+\cite{pon-dem}+).
An example of the entry in the .bib file (\verb+myrefs.bib+) is as
follows:
\begin{verbatim}
@misc{pon-dem,
author = "Cheryl Ponchin and
Sue DeMeritt",
title = "{\LaTeX\ Lessons for
Palo Alto, CA}",
year = "2019"
}
\end{verbatim}
The output will show up as~\cite{pon-dem} in your document.
\begin{verbatim}
\bibliographystyle{plain}
\bibliography{myrefs}
\end{verbatim}
\section{Getting an Output}
Now that you have a file (\texttt{filename.tex}) it would be nice to produce an
output. Depending on what editor you are using, the procedure of how
you do it might vary, however, the steps themselves are the same. The
following steps are:
\begin{enumerate}
\item \texttt{pdflatex filename}
\item \texttt{bibtex filename}
\item \texttt{pdflatex filename}
\item \texttt{pdflatex filename}
\end{enumerate}
You might be wondering why you had to use pdflatex more than once.
This is so your table of contents, section, subsections, etc., as well
as your bibliographies will appear properly. The first time you
pdflatex the paper it reads that you have sections, subsections, etc.,
then you would \BIBTeX\ the paper, if needed. The second and third
time you pdflatex your paper it places the sections and subsections in
the table of contents for the output. You will have a file called
\texttt{filename.pdf} which will be ready for viewing.
\bibliographystyle{plain}
\bibliography{myrefs}
% Set the ending of a LaTeX document
\end{document}