% Things to do
% List colors available through xcolor in appendix
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb} % AMS stands for American Mathematical Society and this adds necessary functionality for typesetting math.
\usepackage[usenames,dvipsnames]{xcolor} % The xcolor package adds additional colors that can be called by name
\usepackage{graphicx} % graphicx enables you to add graphics to your document
\usepackage[siunitx]{circuitikz}
\usepackage{tikz,pgfplots} % Tikz is a package for making diagrams
\usepackage[colorinlistoftodos]{todonotes} % Allows you to add comments or reminders that show up on the printed document. (Unlike these kind of comments which do not)
\usepackage[colorlinks, linkcolor=red, urlcolor=blue, citecolor=red]{hyperref}
\usepackage[numbers, square]{natbib} % Package for including a bibliography
\usepackage{fancybox}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{epsfig}
\usepackage{perpage} % for footnotes reset counter
\usepackage[shortlabels]{enumitem}
% Chemistry
\usepackage[version=3]{mhchem}
\usepackage{chemfig}
%
\graphicspath{ {} }
\usetikzlibrary{shadows,arrows,mindmap,trees}
%----------------------------------------------------
% Custom Commands
%----------------------------------------------------
\newcommand{\doubleint}{\int \!\!\!\int}
\newcommand{\bc}[1]{\begin{center} #1 \end{center}}
\newcommand{\fig}[1]{\begin{figure} #1 \end{figure}}
\newcommand{\vertical}[1]{\begin{align*} #1 \end{align*}}
\definecolor{cqcqcq}{rgb}{0.75,0.75,0.75}
\newcommand{\axes}{
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.8888888888888888cm,y=0.8888888888888888cm]
\draw [color=cqcqcq,dash pattern=on 2pt off 2pt, xstep=0.8888888888888888cm,ystep=0.8888888888888888cm] (-2.5,-2.5) grid (6.5,6.5);
\draw[->,color=black] (-2.5,0) -- (6.5,0);
\foreach \x in {-2,-1,1,2,3,4,5,6}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0,-2.5) -- (0,6.5);
\foreach \y in {-2,-1,1,2,3,4,5,6}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-2.5,-2.5) rectangle (6.5,6.5);
\end{tikzpicture}}
%----------------------------------------------------
\renewcommand{\floatpagefraction}{0.1}
%To use symbols for footnotes
\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
%To change footnotes back to numbers
%\renewcommand*{\thefootnote}{\arabic{footnote}}
\pgfplotsset{width=7cm,compat=1.8}
%\newcommand{\comment}[1]{}
\title{Introduction to \LaTeX{}}
\author{Mr. Rusty Laracuenti}
\date{Updated September 29, 2015}
%
% MDFRAMED TESTING
%
\surroundwithmdframed[linewidth=.5pt, backgroundcolor=Peach!30, roundcorner=5pt, nobreak=true]{verbatim}
%\newmdenv[linecolor=red,frametitle=Infobox]{infobox}
\mdfsetup{
linewidth=.5pt,
innerleftmargin=5pt,
innerrightmargin=5pt,
innertopmargin=2pt,
innerbottommargin=2pt,
}
% END TESTING
\MakePerPage{footnote} % Reset footnote counter everypage
%
% Defining custom title page
%
\makeatletter
\def\@maketitle{
\raggedright
\begin{center}
\includegraphics[width = 8cm]{logo} \\[1cm]
{\Huge \bfseries \@title }\\[4ex]
{\Large \@author}\\[4ex]
\@date\\[8ex]
%\includegraphics[width = 40mm]{frog}
\end{center}}
\makeatother
% END TITLE PAGE
\begin{document}
\maketitle
\begin{abstract}
This is an initial attempt to create a compact introduction to Overleaf and \LaTeX{} in general. Topics and examples are tailored to meet the needs of The Hudson School. \LaTeX{} is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. \LaTeX{} is the de facto standard for the communication and publication of scientific documents.
\end{abstract}
\newpage
\tableofcontents
\listoffigures
% \listoftables
\newpage
% _____ _ _ _______ _____ ____
% |_ _| \ | |__ __| __ \ / __ \
% | | | \| | | | | |__) | | | |
% | | | . ` | | | | _ /| | | |
% _| |_| |\ | | | | | \ \| |__| |
% |_____|_| \_| |_| |_| \_\\____/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
% Perhaps a banner for each major section...
This document was created using the standard \textit{article} class suitable for most academic articles and reports. In Overleaf there are two main windows. The window on the left displays your raw \LaTeX{} source code. The window on the right is the preview window. If the preview window is set to auto then the window will be updated in real time, however, there is a slight delay. The preview window shows you what your finished document will look like after you have exported it to a PDF.
In Overleaf, clicking on an object or section in the preview window will automatically move your cursor to the corresponding place in the source code window. The source code window can be viewed as raw source code or as ``Rich Text.'' Rich text mode shows a more familiar version of the document similar to typing into a standard word processor.
Everything in \LaTeX{} is done with commands. Commands always start with a backslash and are case sensitive. Certain commands can only be used with the inclusion of certain packages or within certain environments. The point of \LaTeX{} is to take the focus off of the formatting of documents so the user can concentrate on the content. This being said, once you have settled on a format or template, making small stylistic changes can be difficult.
This document was created in \LaTeX{} for a reason. It is much easier to start with a working example and make adjustments than to create from scratch. When viewing this document on Overleaf you can view the source code and output simultaneously. This means any special formatting, tables, and math that you see can be copied and imported into your own document. Importing these examples into your \LaTeX{} document is as simple as copying the source code and pasting it into your document. You can then change the values and adjust as needed.
When viewing this document as a PDF most of the example source code is included verbatim in the peach colored boxes. As a PDF, you can also click on hyperlinks to be taken directly to that page on the internet. Clicking on an item in the table of contents will also bring you to that specific section.
%\subsection*{Why \LaTeX?}
% Professional
% Suitable for large documents
% Speed - no more formatting.
% Free
% Portability and backwards compatibility
% Collaboration
% ____ _____ _____ _____ _____
% | _ \ /\ / ____|_ _/ ____|/ ____|
% | |_) | / \ | (___ | || | | (___
% | _ < / /\ \ \___ \ | || | \___ \
% | |_) / ____ \ ____) |_| || |____ ____) |
% |____/_/ \_\_____/|_____\_____|_____/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The Basics}
This is by no means meant to be a comprehensive introduction to \LaTeX{}. There are many document classes and thousands of packages. Extensive documentation is also available freely online. You can only use one document class per document but you can import as many packages as you need. Packages add extra features and capabilities to your document.\footnote{Some packages may not play well with others and some have to be loaded in a particular order. The packages loaded in the preamble of your lab template should be sufficient for most cases.}
The bare minimum code needed to create a \LaTeX{} document is as follows:
\begin{verbatim}
\documentclass{...}
...your preamble goes here...
\begin{document}
...your text goes here...
\end{document}
\end{verbatim}
The entire text of the final product is located between the \verb|\begin{document}| and the \verb|\end{document}| command. The space between \verb|\documentclass{}| and \verb|\begin{document}| is called the preamble. The preamble is where you tell \LaTeX{} what kind of document to create. Some well known document classes include article, book, exam, letter, and beamer. The document class governs the overall format of the document such as fonts and default margins.
The preamble is also where you import your packages. Certain packages are mandatory to enable certain features such as the ability to add images to your document. You can take a look at the preamble of this document to see what packages are included and for what reason.\footnote{Some of these packages are only necessary for this document and may not be included in your lab template.}
\subsection{Special Characters}
Certain characters in \LaTeX{} have special meaning. \LaTeX{} interprets these symbols as an action to be executed. When \LaTeX{} does not recognize your symbol as a legitimate command you will get an error and the document will not compile. Any of the following characters will cause this to happen.
\begin{verbatim}
# $ % & ~ _ ^ \ { }
\end{verbatim}
There is, of course, a way around this. Placing a backslash before most of the characters will cause them to be displayed as ordinary symbols. The need to talk about \$\$ or \% understandably comes up often. This works for all of the symbols except for the backslash since the double backslash is, in itself, a command. To get a $\backslash$ to appear in your document type \verb|$\backslash$|. In most cases if you really just need a slash in your document a forward slash (/) will usually suffice.
\subsection{Bold, Italic, and Underline}
\textbf{Bold}, \textit{italic}, and \underline{underline} each have a command. Overleaf makes it even easier by enabling keyboard shortcuts for boldfaced and italic type. Highlighting a word and pressing \fbox{Ctrl} + \fbox{B} or \fbox{Ctrl} + \fbox{I} causes the word to be made bold and italicized, respectively. The raw commands are
\begin{verbatim}
\textbf{bold text}
\textit{italic text}
\underline{underlined text}
\end{verbatim}
\subsection{Sections, Subsections}
\LaTeX{} automatically handles section numbering and formatting. This allows the user to concentrate on content rather than formatting. As new sections are added \LaTeX{} will adjust section numbering accordingly. The code for creating sections and subsections is as follows:
\begin{verbatim}
\section{Name of Section}
\subsection{Name of Subsection}
\end{verbatim}
It is also possible to create sections without numbering them. This is achieved by putting an asterisk after the section command.
\begin{verbatim}
\section*{Name of Section Without Numbering}
\end{verbatim}
\subsection*{Subsection without Numbering}
The next numbered section will be numbered as if this section doesn't exist. Sections without numbers, by default, will not appear in the table of contents.
\subsection{Spacing}
\LaTeX{} also handles spacing of words, paragraphs and equations automatically. This can be confusing, at first, to someone familiar with a word processor. This is better illustrated with an example:
\begin{verbatim}
This
is
the
beginning of a
\LaTeX{}
tutorial.
\end{verbatim}
Produces \dots
\begin{center}
This
is
the
beginning of a
\LaTeX{}
tutorial.
\end{center}
Now, suppose for some odd reason you did in fact want the text to show as written. To force \LaTeX{} to end a line you use a double backslash. To achieve the text as it looks you need to manually end each line.
\begin{verbatim}
This \\
is \\
the \\
beginning of a \\
\LaTeX{} \\
tutorial.
\end{verbatim}
Produces \dots \\
\\
This \\
is \\
the \\
beginning of a \\
\LaTeX{} \\
tutorial. \\
To tell \LaTeX{} to start a new paragraph simply leave a blank line between your paragraphs in the source code. Basically, type it as you normally would with an extra line between each paragraph.
\begin{verbatim}
This is paragraph one.
Followed by paragraph two.
And finally, paragraph three.
\end{verbatim}
If you want to manually add extra horizontal or vertical space into a document the easiest way is to use the \textit{hspace} and \textit{vspace} commands. Refer to section \ref{sec:figures} for other possible units of measure that \LaTeX{} understands.
\begin{verbatim}
\hspace{2cm}
\vspace{1in}
\end{verbatim}
To equally space multiple objects horizontally or vertically use the hfill and vfill commands, respectively. For example,
\begin{verbatim}
\noindent This \hfill That \hfill The Other Thing \\
\end{verbatim}
\noindent Produces \dots \\
\noindent This \hfill That \hfill The Other Thing \\
Spacing and typesetting in math mode is governed by a different set of rules. This is covered in section \ref{sec:spacing_math}.
% ______ _____ _____ ______ _ _ _______ _____ _
% | ____|/ ____/ ____| ____| \ | |__ __|_ _| /\ | |
% | |__ | (___| (___ | |__ | \| | | | | | / \ | |
% | __| \___ \\___ \| __| | . ` | | | | | / /\ \ | |
% | |____ ____) |___) | |____| |\ | | | _| |_ / ____ \| |____
% |______|_____/_____/|______|_| \_| |_| |_____/_/ \_\______|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The Essentials}
\label{sec:examples}
% tutorials cornell:http://pages.physics.cornell.edu/sps/latex.html
\subsection{Figures and Images}
\label{sec:figures}
Similar to section numbering \LaTeX{} will automatically adjust numbering for figures. To include images you have to include the package graphicx by placing \verb|\usepackage{graphicx}| in your preamble. In order to keep things simple the image should be in the same folder as the main \LaTeX{} document. In Overleaf files can be uploaded by pressing the project button on the top toolbar next to the Overleaf logo.
As a general rule, files and folders should be named with no spaces. An image is inserted into a document by using the \textit{includegraphics} command. The \textit{includegraphics} command accepts a number of parameters to adjust the size and appearance of the image.
If the name of our image file is cartoon.jpg, the command to include this image scaled to 8cm width is as follows:\footnote{Notice the absence of the file extension and that graphics are by default aligned on the left of the page.}
\begin{verbatim}
\includegraphics[width=8cm]{cartoon}
\end{verbatim}
\includegraphics[width=8cm]{cartoon}
In addition to width one can specify length, scale, angle of rotation, and the resolution of the image. \LaTeX{} understands a number of different units including, but not limited to,
\begin{description}
\item[mm]{Millimeters}
\item[cm]{Centimeters}
\item[in]{Inches}
\item[pt]{A pt is approximately a third of a millimeter}
\end{description}
We have included an image but in order to number it we must tell \LaTeX{} that it is indeed a figure. Environments are used to change the formatting of a block of text without affecting the format of the overall document. In order to turn our cartoon into a figure we use the figure environment to give it a number handled by \LaTeX{}. To center our figure we use the center environment.
%Talk about nesting
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=5cm]{cartoon}
\caption{A funny physics cartoon}
\label{fig:toon}
\end{center}
\end{figure}
Figures can be referred to later by cross-referencing. The \textit{label} command allows you to reference the figure later even if the number and page have changed. Such as refer to Figure \ref{fig:toon} on page \pageref{fig:toon}.
\begin{verbatim}
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=5cm]{cartoon}
\caption{A funny physics cartoon}
\label{fig:toon}
\end{center}
\end{figure}
\end{verbatim}
With the \textit{ref} and \textit{pageref} command you can refer to the figure later with \verb|\ref{fig:toon}| and \verb|\pageref{fig:toon}|
\subsection{Lists}
Environments are available for making different kinds of lists including bulleted lists and numbered lists. The \textit{enumerate} environment is used to create a numbered list.
\begin{verbatim}
\begin{enumerate}
\item Item 1
\item Item 2
\end{enumerate}
\end{verbatim}
\begin{enumerate}
\item Item 1
\item Item 2
\end{enumerate}
\noindent A bulleted list can be created with the \textit{itemize} environment.
\begin{verbatim}
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
\end{verbatim}
\begin{itemize}
\item Item 1
\item Item 2.
\end{itemize}
\noindent A list of definitions can be achieved with the \textit{description} environment.
\begin{verbatim}
\begin{description}
\item[Word] Definition
\item[Concept] Explanation
\item[Idea] Longer explanation
\end{description}
\end{verbatim}
\begin{description}
\item[Word] Definition
\item[Concept] Explanation
\item[Idea] This is what will happen if your definitions are rather lengthy and take up multiple lines.
\end{description}
\subsection{Tables}
Tables are made using the \textit{tabular} environment. Tables can also be numbered and cross-referenced as figures such as Table \ref{tab:circuitgrid} on page \pageref{tab:circuitgrid}.
% Possibly change to table of common commands
\begin{table}[h!]
\begin{center}
\begin{tabular}{| l || c | c | c |}
\hline
Circuit & Voltage & Resistance & Current \\[2pt] \hline
Circuit 1 & 10 V & 10 Ohms & 1 Amps \\ \hline
Circuit 2 & 50 V & 5 Ohms & 10 Amps \\ \hline
Circuit 3 & 20 V & 2 Ohms & 20 Amps \\ \hline
Circuit 4 & 9 V & 3 Ohms & 3 Amps \\ \hline
\end{tabular}
\end{center}
\caption{Table created using the \textit{tabular} environment.}
\label{tab:circuitgrid}
\end{table}
\begin{verbatim}
\begin{table}[h!]
\begin{center}
\begin{tabular}{| l || c | c | c |}
\hline
Circuit & Voltage & Resistance & Current \\[2pt] \hline
Circuit 1 & 10 V & 10 Ohms & 1 Amps \\ \hline
Circuit 2 & 50 V & 5 Ohms & 10 Amps \\ \hline
Circuit 3 & 20 V & 2 Ohms & 20 Amps \\ \hline
Circuit 4 & 9 V & 3 Ohms & 3 Amps \\ \hline
\end{tabular}
\end{center}
\caption{Table created using the tabular environment.}
\label{tab:circuitgrid}
\end{table}
\end{verbatim}
\begin{table}[h!]
\begin{center}
\begin{tabular}{| l c c c |}
\hline
Circuit Number & Voltage & Resistance & Current \\[2pt] \hline
Circuit 1 & 10 V & 10 Ohms & 1 Amps \\
Circuit 2 & 50 V & 5 Ohms & 10 Amps \\
Circuit 3 & 20 V & 2 Ohms & 20 Amps \\
Circuit 4 & 9 V & 3 Ohms & 3 Amps \\ \hline
\end{tabular}
\end{center}
\caption{A table with fewer gridlines.}
\label{tab:circuit}
\end{table}
Creating tables in \LaTeX{} can be daunting as you can tell by the code for Table \ref{tab:circuitgrid} . There are, however, online table generators that will create the \LaTeX{} table code for you and are more user friendly. A quick google search for ``\LaTeX{} table generator'' yielded
\begin{center}
\url{http://www.tablesgenerator.com/}
and
\url{http://truben.no/table/old/}
\end{center}
You can always create a table in any way you like and import as a picture with the \textit{includegraphics} command.
\subsection{Comments}
Comments, generally, are used to leave notes for yourself within the source code. They do not appear in the official document. Most programming languages have a way of excluding certain text from being executed as normal code.
As projects get large, commenting becomes increasingly necessary. A percentage sign is used to designate comments or code which should not be executed.
\begin{verbatim}
% Find evidence to support this section
\end{verbatim}
Comments are also useful for organizing sections of a larger project to make the code easier to read.
%\fbox{Start using comments right away to organize your code and your thoughts}
\begin{verbatim}
%---------------------------------------------------
% Section: Introduction
%---------------------------------------------------
\end{verbatim}
Another good use for comments is to have a section of common commands and unusual or hard to remember syntax as comments in a default blank document file that you keep handy. This way you can keep certain commands handy in every new document you create, eliminating the need to search or refer to this document each time. It is always a good idea to leave yourself some notes especially when you have to walk away from a project for the night.
%
% Finish...
%
There is a special package which enables you to leave comments that are visible on the published document. You are able to leave comments inline with your text or in the \todo{As the command implies this may be useful for keeping track of things left unfinished.} margin of the document.
Comments can be added to the margins of the document using the \textit{todo} command, as shown in the example on the right. You can also add inline comments and specify a color.
\todo[inline, color=green!40]{\dots or for teachers to leave comments on student drafts.}
\begin{verbatim}
\todo{As the command implies this may be useful for
keeping track of things left unfinished.}
\todo[inline, color=green!40]{\dots or for
teachers to leave comments on student drafts.}
\end{verbatim}
\todo[inline, color=LimeGreen]{Hmm \dots this may be a good time to talk a bit about color \dots}
\subsection{Colors}
% http://en.wikibooks.org/wiki/LaTeX/Colors
% Cite this later
If you don't specify a color the comment defaults to the orange seen in the margin comment. Default colors that can be called by name without the need for additional packages are white, black, red, green, blue, cyan, magenta, and yellow.
The package \textit{xcolor} will allow you to specify an additional sixty eight colors by name. Please see the appendix for a complete list of colors available in the xcolor package.
Colors such as
{\color{Aquamarine} Aquamarine},
{\color{Maroon} Maroon},
{\color{LimeGreen} Lime Green},
and
{\color{Fuchsia} Fuchsia} (assuming you can remember how to spell it)
become available. This is achieved by placing the following line in the preamble.
\begin{verbatim}
\usepackage[usenames,dvipsnames]{xcolor}
\end{verbatim}
Colors can be used to highlight text with the use of the \textit{colorbox} command. The opacity of colors can be changed by adding an exclamation point and a number afterwards. The second set of color boxes are set to fifty percent opacity.
\begin{center}
\colorbox{Aquamarine}{Aquamarine}
\colorbox{Maroon}{Maroon}
\colorbox{LimeGreen}{Lime Green}
\colorbox{Fuchsia}{Fuchsia}\\
\colorbox{Aquamarine!50}{Aquamarine}
\colorbox{Maroon!50}{Maroon}
\colorbox{LimeGreen!50}{Lime Green}
\colorbox{Fuchsia!50}{Fuchsia}\\
\end{center}
\begin{verbatim}
\begin{center}
\colorbox{Aquamarine}{Aquamarine}
\colorbox{Maroon}{Maroon}
\colorbox{LimeGreen}{Lime Green}
\colorbox{Fuchsia}{Fuchsia}\\
\colorbox{Aquamarine!50}{Aquamarine}
\colorbox{Maroon!50}{Maroon}
\colorbox{LimeGreen!50}{Lime Green}
\colorbox{Fuchsia!50}{Fuchsia}\\
\end{center}
\end{verbatim}
\subsection*{Custom Colors}
Colors can also be defined manually by their RGB value. That is their percentage of red, green, and blue. All colors can be defined in this way. Black is the absence of any color and white is the inclusion of all colors. You can define your own custom color names to use later with their RGB values as well.
%
\definecolor{pukegreen}{rgb}{0.53, 0.66, 0.42}
\definecolor{poopbrown}{rgb}{0.59, 0.44, 0.09}
%
\begin{verbatim}
\definecolor{pukegreen}{rgb}{0.53, 0.66, 0.42}
\definecolor{poopbrown}{rgb}{0.59, 0.44, 0.09}
\end{verbatim}
\noindent
Now
\colorbox{pukegreen}{pukegreen} and
\colorbox{poopbrown}{poopbrown} can be called by name when needed.\footnote{An extensive list of colors and their RGB values is available at \url{http://latexcolor.com}}
% \footnote{latexcolor.com}
% An extensive list of colors and their RGB values is available at
% \begin{center}
% http://latexcolor.com/
% \end{center}
\subsection{Boxes and Frames}
There are many methods for creating boxed text and equations in \LaTeX{}. One of the simplest ways is the \textit{framebox} command.
\begin{verbatim}
\begin{center}
\framebox{$e=mc^2$}
\end{center}
\end{verbatim}
\begin{center}
\fbox{$e=mc^2$}
\end{center}
The \textit{framebox} command can be used \framebox{in line with text} or in the center environment as demonstrated above. Here it is used in the equation environment so it can be numbered and referenced later.
\begin{verbatim}
\begin{equation}
\framebox{$\vec{F}=m\vec{a}$}
\label{eq:newton2nd}
\end{equation}
\end{verbatim}
\begin{equation}
\framebox{$\vec{F}=m\vec{a}$}
\label{eq:newton2nd}
\end{equation}
You can specify the width of a \framebox[3cm]{frame box} by adding a width parameter in square brackets. To create a colored box use the \fcolorbox{Fuchsia}{white}{fcolorbox} command.
\begin{verbatim}
\framebox[3cm]{framebox}
\fcolorbox{Fuchsia}{white}{fcolorbox}
\end{verbatim}
Where fuchsia is the color of the frame and white is the color of the background.
It is possible to change both the thickness of the box and distance between the box and its contents. Issuing the following commands will change the look of all frame boxes from that point on.
\setlength{\fboxsep}{3mm}
\setlength{\fboxrule}{1mm}
\begin{verbatim}
\setlength{\fboxsep}{3mm}
\setlength{\fboxrule}{1mm}
\end{verbatim}
All \framebox{frame boxes} now appear like this by default. The setting also affects \fcolorbox{orange}{blue!50}{color boxes}. All of our boxes have contained only one line of text although it is possible to create an itemized or numbered list within a box. Notice the \textit{itemize} environment has changed to \textit{Bitemize}.
\begin{verbatim}
\begin{center}
\fbox{Dr. Seuss Titles: \hspace{1cm}
\begin{Bitemize}[t]
\item Green Eggs and Ham
\item The Lorax
\item The Cat in the Hat
\end{Bitemize}}
\end{center}
\end{verbatim}
\begin{center}
\fbox{Dr. Seuss Titles: \hspace{1cm}
\begin{Bitemize}[t]
\item Green Eggs and Ham
\item The Lorax
\item The Cat in the Hat
\end{Bitemize}}
\end{center}
Once you realize that the rest of your document after this point has been affected you may want to set these values back to their default settings which appears to be
\begin{verbatim}
\setlength{\fboxsep}{3pt}
\setlength{\fboxrule}{0.5pt}
\end{verbatim}
\setlength{\fboxsep}{3pt}
\setlength{\fboxrule}{0.5pt}
This document also uses two additional packages for creating boxes and frames: \textit{fancybox}\footnote{For more information, see the fancybox documentation at \url{http://mirrors.ctan.org/macros/latex/contrib/fancybox/fancybox-doc.pdf}} and \textit{mdframed}\footnote{For more information, see the mdframed documentation at \url{http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/mdframed/mdframed.pdf}}. The \textit{fancybox} package allows four additional types of boxes. These are shadow box, double box, oval box and a thicker version of an oval box.
\begin{verbatim}
\begin{center}
\shadowbox{This}
\doublebox{that}
\ovalbox{and}
\Ovalbox{the other thing.}
\end{center}
\end{verbatim}
\begin{center}
\shadowbox{This,}
\doublebox{that}
\ovalbox{and}
\Ovalbox{the other thing.}
\end{center}
\begin{mdframed}[backgroundcolor=Magenta!40,shadow=true,roundcorner=5pt,frametitle={Package: mdframed}]
The other package, called mdframed, is useful for aesthetically pleasing boxes that hold a lot of text.
The mdframed package is extensive and adds a lot of options for creating boxes. In this document it was used to set up a default box for the verbatim environment. The verbatim environment is how the raw latex code is put into the document without it being executed as commands. The properties of the box need to be edited only once in the preamble to change their appearance throughout the document. This could be incredibly useful if you wanted to have all of your equations wrapped in the same kind of box.
\end{mdframed}
\noindent Previous box created with the following options:
\begin{verbatim}
\begin{mdframed}[backgroundcolor=Magenta!40,shadow=true,
roundcorner=5pt,frametitle={Package: mdframed}]
...the text...
\end{mdframed}
\end{verbatim}
%cite mdframed documentation
%boxes for figures, images, whatnot
\newpage
\begin{center}
\includegraphics[width=\textwidth]{fractal_city2}
\end{center}
% __ __ _______ _ _
% | \/ | /\|__ __| | | |
% | \ / | / \ | | | |__| |
% | |\/| | / /\ \ | | | __ |
% | | | |/ ____ \| | | | | |
% |_| |_/_/ \_\_| |_| |_|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The Good Stuff}
Have you ever wondered how text books and some websites get their equations to show up perfectly? There are numerous environments for typesetting math in \LaTeX{}. The most common are the math environment, the displaymath environment and the equation environment. The math environment allows you create equations and functions inline with your text. The displaymath environment will center an equation on its own line. The equation environment is used to display important equations you may wish to reference later.
There are short hand methods to enable the math and displaymath environments. Inline math and the displaymath environments are activated by \$ and \$\$ respectively. Recall that environments must have a beginning and an end command so you must wrap the single dollar signs around your inline equation and the double dollar signs around your displaymath equation.
The equation environment is used to create numbered equations similar to figures that can be referenced later. There is no shorthand command to enable this environment and must be invoked with the usual \verb|\begin{environment}| and \verb|\end{environment}| commands. In this case, of course, you would use \verb|\begin{equation}| to enable the equation environment.
% To typeset multiple equations such as a derivation you would use the align and the align* environment with numbering and without numbering, respectively.
\subsection{Spacing and Text}
\label{sec:spacing_math}
\LaTeX{} usually handles spacing in math mode without any issues but certain symbols may need a little help adjusting to our aesthetic convention. Refer to table \ref{table:math_space} for a list of spacing commands in math mode.
\begin{table} [!ht]
\begin{center}
\includegraphics[width=\textwidth]{math_space}
\caption{Spacing in Math Mode.\protect\footnotemark}
\label{table:math_space}
\end{center}
\end{table}
% Move so footnote shows up on correct page.
\footnotetext{\url{http://texblog.org/2014/04/09/whitespace-in-math-mode/}}
%
Manual spacing is needed in certain quirky situations especially when dealing with text in math mode. When using inline math mode it is usually sufficient to exit in and out of math mode for text but in display math mode this wouldn't be possible. Text just does not display $properly in math mode$.
Suppose you want to list two solutions as,
$$
x=4 \quad \text{and} \quad x=-2
$$
\begin{verbatim}
$$
x=4 and x=-2
$$
\end{verbatim}
\noindent produces \dots \\
$$
x=4 and x=-2
$$
\noindent To achieve what you want use the \textit{text} command to make the text appear normal font and manual spacing to give it some room.
\begin{verbatim}
$$
x=4 \quad \text{and} \quad x=-2
$$
\end{verbatim}
\noindent Or to assume $n$ is an odd integer,
$$
\text{then} \; n=2k+1, \, \text{where} \, k \in \mathbb{Z}
$$
\noindent use\dots \\
\begin{verbatim}
$$
\text{Then} \; n=2k+1, \, \text{where} \, k \in \mathbb{Z}
$$
\end{verbatim}
Similar to text mode, putting equation elements on separate lines is not going to override the automatic spacing such as equation \ref{eq:euler}.
%\footnote{The only environments that allow for multiple line equations are the align and eqnarray environments.}
\begin{verbatim}
\begin{equation}
e
^{i\pi}
=
-1
\end{equation}
\end{verbatim}
\noindent Still produces \dots
\begin{equation}
e
^{i\pi}
=
-1
\label{eq:euler}
\end{equation}
\subsection{Subscripts, Superscripts and Fractions}
Typesetting math in \LaTeX{} is similar to entering an equation into an online solver like Wolfram Alpha. Subscripts are created with an underscore and superscripts are created with a ``carrot.'' The formula for the slope of a line is $ {m=(y_2-y_1)/(x_2-x_1)} $.\footnote{To keep an inline math equation from breaking across multiple lines place an extra set of \{ \} around the equation.} The code is as follows:
\begin{verbatim}
$ {m=(y_2-y_1)/(x_2-x_1)} $
\end{verbatim}
The same equation using the displaymath mode looks like:
$$ m=(y_2-y_1)/(x_2-x_1) $$
The only difference in the code here is \$\$ instead of \$. Typesetting the equation in this way requires the use of the parentheses to prevent the math gods from turning over in their graves. The difference between $x/2$ and $ \frac{x}{2}$ is the use of \textit{frac} command. To format a fraction with a horizontal division symbol use the following syntax within your chosen math environment.
\begin{verbatim}
\frac{Numerator}{Denominator}
\end{verbatim}
$$
m = \frac{y_2-y_1}{x_2-x_1}
$$
\noindent Fractions can, of course, be nested as well...
\begin{verbatim}
x=\frac{1+\frac{1}{n}}{n!}
\end{verbatim}
$$
\text{produces,} \quad x=\frac{1+\frac{1}{n}}{n!}
\label{eq:nested_frac}
$$
The presence of the curly brackets should not be overlooked as they are used frequently in all areas of \LaTeX{}. They are used like standard parentheses in all situations where you want a command to apply to multiple characters. There is a major difference between $e^2x$ and $e^{2x}$ but the difference in the code is subtle and a matter of remembering to use curly brackets.
\begin{verbatim}
$e^2x$ vs. $e^{2x}$
\end{verbatim}
Keep in mind that fractions and certain symbols will either appear distorted or create additional space in your paragraph when using inline math mode. By default \LaTeX{} will prioritize line spacing and adjust the equation accordingly. $ m = \frac{y_2-y_1}{x_2-x_1}$ is the default formatting for inline equations. The best practice is to keep inline math mode reserved for special characters and simple one line equations. The command \textit{displaystyle} can be used to change this default behavior. $ \displaystyle m=\frac{y_2-y_1}{x_2-x_1} $ is how inline math equations will look once the \textit{displaystyle} command has been used within math mode. Notice the line spacing has been adjusted to allow the equation to display properly. To enable this for a single equation use the command in math mode,
\begin{verbatim}
$ \displaystyle m=\frac{y_2-y_1}{x_2-x_1} $
\end{verbatim}
To enable this for every inline equation by default place the following line in the preamble of the document.
\begin{verbatim}
\everymath{\displaystyle}
\end{verbatim}
\subsection{Numbering and Alignment}
\label{sec:alignment}
To refer to our slope equation later we can number and label it using the equation environment in the same way as tables and figures.
\begin{equation}
m = \frac{y_2-y_1}{x_2-x_1}
\label{eq:slope}
\end{equation}
Equation \ref{eq:slope} is the equation for the slope of a line between two points $ (x_1,y_1)$ and $ (x_2,y_2) $.
Note that the equation environment is for assigning a single number to an equation or a derivation.\footnote{Using the split environment within the equation environment will allow for multiple lines.} The code for equation \ref{eq:slope} is as follows:
\begin{verbatim}
\begin{equation}
m = \frac{y_2-y_1}{x_2-x_1}
\label{eq:slope}
\end{equation}
\end{verbatim}
Care should be taken when assigning labels to equations, figures, and tables. The purpose of the \textit{label} and \textit{ref} commands is that \LaTeX{} automatically takes care of the numbering as changes are made. Therefore, it is foolish to label our tables as table1 or table2. A better method is to be descriptive. Such as the label given to equation \ref{eq:slope}: ``eq:slope.'' As another example, the keyword ``eq:einstein'' is an easy way to refer to equation \ref{eq:einstein}.
\begin{align}
e=mc^2
\label{eq:einstein}
\end{align}
For equations on multiple lines or derivations use the align environment with the use of \& to define where they are aligned vertically. The align environment, by default, will number each equation. To avoid this, similar to section numbering, use an asterisk after align in the declaration. To align equations vertically with respect to the equal sign:
\begin{verbatim}
\begin{align*}
x^2-x-20 &= 0 \\
(x-5)(x+4) &= 0 \\
x &= 5, -4
\end{align*}
\end{verbatim}
\begin{align*}
x^2-x-20&=0 \\
(x-5)(x+4)&=0 \\
x&=5, -4
\end{align*}
If no \& is used the environment will default to aligning the equations on the right. The align environment will give a unique number to each equation. The previous result using the align environment with numbering looks like:
\begin{align}
x^2-x-20&=0 \\
(x-5)(x+4)&=0 \\
x&=5, -4
\end{align}
This is not a good use of the align environment since these are not equations that are distinct and need to be referred to separately. In most situations you may want only the result to be numbered. If only one of these lines is to be numbered then the command \textit{nonumber} should be used before the end line command. For example:
\begin{verbatim}
\begin{align}
x^2-x-20 &= 0 \nonumber \\
(x-5)(x+4) &= 0 \nonumber \\
x &= 5, -4 \label{eq:quad_solution}
\end{align}
\end{verbatim}
\noindent produces \dots
\begin{align}
x^2-x-20 &= 0 \nonumber \\
(x-5)(x+4) &= 0 \nonumber \\
x &= 5, -4 \label{eq:quad_solution}
\end{align}
There is a subtle but important distinction to be made between the numbering styles of the equation and the align environments. The equation environment is used to create a single numbered equation even if this equation spans multiple lines. Using the split environment within the equation environment will allow for multiple lines aligned vertically by \& as in the align environment. In the previous example referring to Equation \ref{eq:quad_solution} refers specifically to the solution and not the problem. You can give the group of equations a number using the equation environment as follows:
\begin{verbatim}
\begin{equation}
\begin{split}
x^2-x-20 &= 0 \\
(x-5)(x+4) &= 0 \\
x &= 5, -4
\label{eq:quad_problem}
\end{split}
\end{equation}
\end{verbatim}
\begin{equation}
\begin{split}
x^2-x-20 &= 0 \\
(x-5)(x+4) &= 0 \\
x &= 5, -4
\label{eq:quad_problem}
\end{split}
\end{equation}
A more useful example of this type of numbering is to number an equation or result that is shown as a derivation.
% An integration example... perhaps in the next section.
%
% Finish how numbering works with examples
%
% Expand a lot
%
%
\subsection{Special Symbols and Greek Letters}
Greek letters can be used in math mode simply by typing their names preceded by a backslash. Lowercase greek letters like $ \alpha, \beta, \gamma, \theta, \text{ and } \epsilon $ are typed in \textbf{math mode} as follows:
\begin{verbatim}
$ \alpha, \beta, \gamma, \theta, and \text{and} \epsilon $
\end{verbatim}
Uppercase greek letters that differ from our normal uppercase letters are produced by capitalizing the first letter in the name of the symbol. For instance, alpha, beta and epsilon are simply A, B, and E respectively. Uppercase gamma and theta are unique and $ \Gamma \text{ and } \Theta $ are produced as follows:
\begin{verbatim}
$ \Gamma $ and $ \Theta $
\end{verbatim}
\section{The Bibliography}
Although \LaTeX{} has its own embedded environment for writing bibliographies it is beneficial in the long run to use BibTeX.\footnote{For more information on BibTeX visit \url{http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management} } BibTeX is a tool and a system for generating a list of references from a database of sources. The database lives in a text file which can be centralized and therefore maintained by a person, a class, or an entire department. More than one file can be used so the sources can be compartmentalized or organized by subject. This means a source only has to be typed once.
\subsection{Setup}
The database is formatted and housed in a separate \fbox{*.bib} file. The bibliography will automatically generated and formatted using only the sources cited in the document.
%\todo{No more formatting bibliographies? What will we do with all that extra time?}
Each source in the database must be given a unique reference number in order to be cited. Remembering a reference number for each source may not be feasible if not planned out in advance. With a little foresight you can systematize the naming convention to make things easier. An example of such a system is to use the first three letters of the authors last name and the last two digits of the year of publication for the reference number.
% perhaps lastnameXXXX would be better
% Examples
% Overleaf shows you a list once you start typing
Once cited, the source will automatically be included in the bibliography. To cite the source of a quote or a specific paragraph you use the \textit{cite} command and the reference number as follows. There are numerous options for formatting the type of citation. Once a format has been set to default there is no need to manually format each citation.
\begin{verbatim}
\cite{roy01}
\end{verbatim}
This is used when you want the citation to appear visible. For more information on finite element analysis refer to \cite{roy01}. To include a general source in your bibliography without attributing it to a particular passage, idea or equation you use the \textit{nocite} command in the same manner. It is probably good practice to keep all your \textit{nocited} sources in a logical place. One such place could be towards the end of the document before the bibliography in a section separated by comments.
%\todo[color=SkyBlue]{An obvious reiteration of the suggestion to start using comments to organize your code and your thoughts. You can thank me later.}
\begin{verbatim}
%------------------------------------------------
% Sources to be included even if not cited
%------------------------------------------------
\nocite{source1}
\nocite{source2}
\nocite{source3}
%------------------------------------------------
\end{verbatim}
\noindent An example entry in the database for citing a book:
\begin{verbatim}
@book{strang2007computational,
title={Computational science and engineering},
author={Strang, Gilbert},
volume={1},
year={2007},
publisher={Wellesley-Cambridge Press Wellesley}
}
\end{verbatim}
\subsection{Building the Database}
Google Scholar has a way to export citations in BibTeX form. This must be enabled in the settings for Google Scholar before the option will appear. If you are signed into the google system there should be no need to sign into Google Scholar separately.
Search for a source and simply click "Import into BibTeX" underneath the article summary on the search page. Copy that text into your class database and adjust the reference number to conform to the agreed upon system.
There are many online resources that can export citations in BibTeX form and even create a *.bib file for you upon request. It is left to the reader to discover what works best for them.
%Create .bib file to be referenced and examples of the common types of citations
%Cite useful websites throughout the document
% Research MLA, APA, Chicago, ACS, ASA etc...
% __ ______ ____ _____ ____ ____
% \ \ / / __ \ / __ \| __ \ / __ \ / __ \
% \ \ / / | | | | | | | | | | | | | | |
% \ \/ /| | | | | | | | | | | | | | | |
% \ / | |__| | |__| | |__| | |__| | |__| |
% \/ \____/ \____/|_____/ \____/ \____/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The Advanced Stuff}
\subsection{Custom Commands}
New commands are easily created in \LaTeX{}. New commands, of course, cannot conflict with existing \LaTeX{} commands. Custom commands are useful for a variety of reasons. Commands can be declared anywhere in the document but for obvious reasons you should keep these tucked away someplace safe like the preamble of your default document. The command must be declared before it can be used. The syntax is simple:
\begin{verbatim}
\newcommand{New_Command}{Old_Command}
\end{verbatim}
A skillful administrator might create new commands for commonly used phrases or even paragraphs in official correspondences.
\begin{verbatim}
\newcommand{\accepted}{Our usual spiel.}
\newcommand{\yadayada}{Our closing spiel.}
\end{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\declined}{Thank you for applying to THIS University. After completing a careful review of your application and supporting credentials, our Admissions Committee has concluded that we are unable to offer you acceptance to the university. This year we received nearly a gazillion applications for limited places, making the competition keen and our task difficult. Regrettably, we cannot accommodate all students interested in THIS University.}
\newcommand{\accepted}{Congratulations on your admission to THIS University! As a member of the Class of 2017, you will join a dynamic student community in a place of endless opportunities. THIS University offers an unparalleled setting for the next chapter of your life.}
\newcommand{\yadayada}{I look forward to receiving your response to our offer of admission. You can find out more in the enclosed materials, including information on housing and dining, instructions for accepting your offer, and the list of Final Requirements. If we may furnish additional information, please let us know. I wish to extend you a warm welcome and best wishes for your success at THIS University.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\noindent Writing a typical letter would then be as simple as
\begin{verbatim}
Dear So and So, \\
\accepted \\
\yadayada \\
From,\\
VIP
\end{verbatim}
%\vspace{1cm}
% \fbox{\begin{minipage}{\textwidth}
% Dear So and So, \\
% \accepted \\
% \yadayada \\
% From, \\
% VIP
% \end{minipage}}
% Adapted from GW University acceptance letters
%\vspace{1cm}
\noindent Commands can also accept arguments such as
\begin{verbatim}
\newcommand{\lamb}[1]{#1 had a little lamb}
\newcommand{\hadlittle}[2]{#1 had a little #2}
\end{verbatim}
and typing
\begin{verbatim}
\lamb{Mary} and \hadlittle{John}{dog}.
\end{verbatim}
\newcommand{\lamb}[1]{#1 had a little lamb}
\newcommand{\hadlittle}[2]{#1 had a little #2}
\noindent Produces, \lamb{Mary} and \hadlittle{John}{dog}.
The need to type \verb|\begin{environment}| and \verb|\end{environment}| can get tedious if you use a certain environment often enough. It is possible to define a custom command that will wrap your input in a particular environment. An editor with auto-complete is the preferred method but in a pinch:
\begin{verbatim}
\newcommand{\bc}[1]{\begin{center} #1 \end{center}}
\end{verbatim}
\noindent Allows you to use
\begin{verbatim}
\bc {some centered text.}
\end{verbatim}
\noindent Instead of
\begin{verbatim}
\begin{center}
some centered text.
\end{center}
\end{verbatim}
\noindent to achieve \bc{some centered text.}
%entire documents created this way?
\subsection{Tikz Package}
The Tikz package is useful for drawing diagrams, graphs, and so many other things. Learning the ins and outs of the tikz package, however, is a daunting task. The user manual is over a thousand pages, but the capabilities are quite amazing.
The good news is that there are user friendly programs for creating diagrams that can export the tikz code for you. One of these is the open source program, GeoGebra.\footnote{Visit \url{https://www.geogebra.org/} for more information.}
% Before I learned about \LaTeX{}, as a teacher, creating tests and quizzes was a nightmare. Now I have an easy to use template and I can create a great looking test in minutes. Diagrams still remained a major hurdle to overcome. In the past I have even resorted to drawing something by hand and scanning it as an image.
With Geogebra, creating plots and graphs is simple and its export to tikz dialog is also easy to use. The code is not easy on the eyes but the diagram is great.
One thing that is fairly common is the need to insert blank coordinate axes. So why not make it a new command \dots
\begin{verbatim}
\newcommand{\axes}{
Tikz code from Geogebra
}
\end{verbatim}
\begin{figure}[!hbp]
\begin{center}
\axes
\end{center}
\caption{A custom blank graph with GeoGebra.}
\label{fig:graph}
\end{figure}
Now inserting a blank graph into a document is as easy as typing \verb|\axes| to make Figure \ref{fig:graph}. With a bit of skill you could add arguments to the command to adjust the range and domain.
The \textit{circuitikz} package with the \textit{suinitx} options adds the ability to create circuit diagrams with relative ease as in Figure \ref{resistor}. This is done by adding the following line to the preamble.
\begin{verbatim}
\usepackage[siunitx]{circuitikz}
\end{verbatim}
\subsection{Octave and Matlab}
Matrices can be tedious to type in \LaTeX{} to say the least. The code for the matrix in Figure \ref{math:laplacian} is as follows.
\begin{verbatim}
$$
\begin{bmatrix}
2 & -1 & 0 & -1 & 0 & 0 & 0 & 0 & 0 \\
-1 & 3 & -1 & 0 & -1 & 0 & 0 & 0 & 0 \\
0 & -1 & 2 & 0 & 0 & -1 & 0 & 0 & 0 \\
-1 & 0 & 0 & 3 & -1 & 0 & -1 & 0 & 0 \\
0 & -1 & 0 & -1 & 4 & -1 & 0 & -1 & 0 \\
0 & 0 & -1 & 0 & -1 & 3 & 0 & 0 & -1 \\
0 & 0 & 0 & -1 & 0 & 0 & 2 & -1 & 0 \\
0 & 0 & 0 & 0 & -1 & 0 & -1 & 3 & -1 \\
0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 2 \\
\end{bmatrix}
$$
\end{verbatim}
\begin{figure} [htp]
$$\begin{bmatrix}
2 & -1 & 0 & -1 & 0 & 0 & 0 & 0 & 0 \\
-1 & 3 & -1 & 0 & -1 & 0 & 0 & 0 & 0 \\
0 & -1 & 2 & 0 & 0 & -1 & 0 & 0 & 0 \\
-1 & 0 & 0 & 3 & -1 & 0 & -1 & 0 & 0 \\
0 & -1 & 0 & -1 & 4 & -1 & 0 & -1 & 0 \\
0 & 0 & -1 & 0 & -1 & 3 & 0 & 0 & -1 \\
0 & 0 & 0 & -1 & 0 & 0 & 2 & -1 & 0 \\
0 & 0 & 0 & 0 & -1 & 0 & -1 & 3 & -1 \\
0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 2 \\
\end{bmatrix}
$$
\caption{\LaTeX{} code generated with Octave.}
\label{math:laplacian}
\end{figure}
\clearpage
\rule{\linewidth}{1pt}
%--------------------------------------------------------
% Appendix with common commands and examples
%--------------------------------------------------------
% '\hspace' and '\vspace' to adjust spacing by specified unit.
% _ _ ____ _____ _____ _______ ______
% | \ | |/ __ \ / ____|_ _|__ __| ____|
% | \| | | | | | | | | | | | |__
% | . ` | | | | | | | | | | | __|
% | |\ | |__| | | |____ _| |_ | | | |____
% |_| \_|\____/ \_____|_____| |_| |______|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\cite{latex_bibliography_2015}
%\cite{beamer_theme}
\nocite{str07}
%\nocite{chen2013}
\nocite{roy01}
\nocite{beamer_theme}
%\nocite{latex_bibliography_2015}
% to start bibliography on a separate page
\newpage
% \begin{center}
% \begin{figure}
% \begin{tikzpicture}
% \tikzset{venn circle/.style={draw,circle,minimum width=6cm,fill=#1,opacity=0.4}}
% \node [venn circle = red] (A) at (0,0) {$A$};
% \node [venn circle = blue] (B) at (60:4cm) {$B$};
% \node [venn circle = green] (C) at (0:4cm) {$C$};
% \node[left] at (barycentric cs:A=1/2,B=1/2 ) {$A \cap B$};
% \node[below] at (barycentric cs:A=1/2,C=1/2 ) {$A \cap C$};
% \node[right] at (barycentric cs:B=1/2,C=1/2 ) {$B \cap C$};
% \node[below] at (barycentric cs:A=1/3,B=1/3,C=1/3 ){$A \cap B \cap C$};
% \end{tikzpicture}
% \caption{A Venn Diagram}
% \label{fig:venn}
% \end{figure}
% \end{center}
\begin{figure}
\begin{center}
\begin{circuitikz} \draw
(0,0) to[resistor] (0,4)
to[resistor] (4,4)
to[resistor] (4,0)
to[resistor] (0,0)
to[resistor] (0,-4)
to[resistor] (4,-4)
to[resistor] (4,0)
to[resistor] (8,0)
to[resistor] (8,4)
to[resistor] (4,4)
(8,0) to[resistor] (8,-4)
to[resistor] (4,-4)
;
\end{circuitikz}
\caption{Diagram with circuitikz and tikz package.}
\label{resistor}
\end{center}
\end{figure}
\begin{figure}
\begin{center}
\begin{tikzpicture}[scale=4.5,cap=round,>=latex]
% draw the coordinates
\draw[->] (-1.5cm,0cm) -- (1.5cm,0cm) node[right,fill=white] {$x$};
\draw[->] (0cm,-1.5cm) -- (0cm,1.5cm) node[above,fill=white] {$y$};
% draw the unit circle
\draw[thick] (0cm,0cm) circle(1cm);
\foreach \x in {0,30,...,360} {
% lines from center to point
\draw[gray] (0cm,0cm) -- (\x:1cm);
% dots at each point
\filldraw[black] (\x:1cm) circle(0.4pt);
% draw each angle in degrees
\draw (\x:0.6cm) node[fill=white] {$\x^\circ$};
}
% draw each angle in radians
\foreach \x/\xtext in {
30/\frac{\pi}{6},
45/\frac{\pi}{4},
60/\frac{\pi}{3},
90/\frac{\pi}{2},
120/\frac{2\pi}{3},
135/\frac{3\pi}{4},
150/\frac{5\pi}{6},
180/\pi,
210/\frac{7\pi}{6},
225/\frac{5\pi}{4},
240/\frac{4\pi}{3},
270/\frac{3\pi}{2},
300/\frac{5\pi}{3},
315/\frac{7\pi}{4},
330/\frac{11\pi}{6},
360/2\pi}
\draw (\x:0.85cm) node[fill=white] {$\xtext$};
\foreach \x/\xtext/\y in {
% the coordinates for the first quadrant
30/\frac{\sqrt{3}}{2}/\frac{1}{2},
45/\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
60/\frac{1}{2}/\frac{\sqrt{3}}{2},
% the coordinates for the second quadrant
150/-\frac{\sqrt{3}}{2}/\frac{1}{2},
135/-\frac{\sqrt{2}}{2}/\frac{\sqrt{2}}{2},
120/-\frac{1}{2}/\frac{\sqrt{3}}{2},
% the coordinates for the third quadrant
210/-\frac{\sqrt{3}}{2}/-\frac{1}{2},
225/-\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
240/-\frac{1}{2}/-\frac{\sqrt{3}}{2},
% the coordinates for the fourth quadrant
330/\frac{\sqrt{3}}{2}/-\frac{1}{2},
315/\frac{\sqrt{2}}{2}/-\frac{\sqrt{2}}{2},
300/\frac{1}{2}/-\frac{\sqrt{3}}{2}}
\draw (\x:1.25cm) node[fill=white] {$\left(\xtext,\y\right)$};
% draw the horizontal and vertical coordinates
% the placement is better this way
\draw (-1.25cm,0cm) node[above=1pt] {$(-1,0)$}
(1.25cm,0cm) node[above=1pt] {$(1,0)$}
(0cm,-1.25cm) node[fill=white] {$(0,-1)$}
(0cm,1.25cm) node[fill=white] {$(0,1)$};
\end{tikzpicture}
\end{center}
\caption{Unit Circle with Tikz}
\label{fig:unit_circle}
\end{figure}
% \begin{figure}
% \begin{center}
% \begin{tikzpicture}
% \path[mindmap,concept color=black,text=white]
% node[concept] {Computer Science}
% [clockwise from=0]
% child[concept color=green!50!black] {
% node[concept] {practical}
% [clockwise from=90]
% child { node[concept] {algorithms} }
% child { node[concept] {data structures} }
% child { node[concept] {pro\-gramming languages} }
% child { node[concept] {software engineer\-ing} }
% }
% child[concept color=blue] {
% node[concept] {applied}
% [clockwise from=-30]
% child { node[concept] {databases} }
% child { node[concept] {WWW} }
% }
% child[concept color=red] { node[concept] {technical} }
% child[concept color=orange] { node[concept] {theoretical} };
% \end{tikzpicture}
% \caption{A tikz mindmap from \url{www.texample.net}.}
% \end{center}
% \end{figure}
% \begin{figure}
% \begin{center}
% \begin{tikzpicture}[transform shape,line width=0.2pt]
% \foreach \x in {1,...,16}{%
% \pgfmathparse{(\x-1)*45+floor(\x/9)*22.5}
% \node[draw,circle,inner sep=0.15cm] (N-\x) at (\pgfmathresult:3.5cm) [thick] {};
% }
% \foreach \x [count=\xi from 1] in {2,...,16}{%
% \foreach \y in {\x,...,16}{%
% \path (N-\xi) edge[-] (N-\y);
% }
% }
% \end{tikzpicture}
% \end{center}
% \caption{A fully connected graph from \url{www.texample.net}.}
% \label{fig:connect_graph}
% \end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% _____ ____ _ _ _____ _____ ______ _____
% / ____|/ __ \| | | | __ \ / ____| ____|/ ____|
% | (___ | | | | | | | |__) | | | |__ | (___
% \___ \| | | | | | | _ /| | | __| \___ \
% ____) | |__| | |__| | | \ \| |____| |____ ____) |
% |_____/ \____/ \____/|_| \_\\_____|______|_____/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\nocite{latex_homepage}
% \nocite{latex_labels}
% \nocite{latex_align_eqn}
\nocite{latex_color}
\nocite{latex_wiki_boxes}
\nocite{tug_org}
\nocite{fancybox_doc}
\nocite{beamer_theme}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliographystyle{plainnat}
\bibliography{physics,sample,science}
\newpage
\appendix
\section{Examples by Subject}
\subsection{Calculus}
%https://www.sharelatex.com/learn/Integrals,_sums_and_limits
To write a definite integral use the \textit{int} command and a subscript and superscript for the limits. The fundamental theorem of calculus can be written as
\begin{verbatim}
\int_a^b f(x) \; dx = F(b)-F(a)
\end{verbatim}
\begin{mdframed}[roundcorner=5pt,frametitle={The Fundamental Theorem of Calculus\cite{lar09}}]
If a function $f$ is continuous on the closed interval $[a,b]$ and $F$ is an antiderivative of $f$ on the interval $[a,b]$, then
\begin{equation}
\int_a^b f(x) \; dx = F(b)-F(a)
\label{eq:fund_theorem}
\end{equation}
\end{mdframed}
%$$ \int_{0}^{\pi} \sin(\theta) \; d\theta $$
\begin{mdframed}[roundcorner=5pt,frametitle={Problem 1}]
\begin{equation}
\begin{split}
\int_{0}^{\pi} \sin(\theta) \; d\theta &= -\cos(\theta) \; \Big|_0^{\pi} \\
&= -\cos(\pi)-(-\cos(0)) \\
&= 2 \label{eq:int_sin}
\end{split}
\end{equation}
\end{mdframed}
% \begin{equation}
% \begin{split}
% \int\limits_{0}^{\pi} \sin(\theta) \; d\theta &= -\cos(\theta) \Big|_0^{\pi} \\
% &= -\cos(\pi)-(-\cos(0)) \\
% &= 2 \label{eq:int_sin}
% \end{split}
% \end{equation}
\begin{mdframed}[roundcorner=5pt,frametitle={Integration by Parts}]
\begin{equation}
\int udv = uv-\int vdu
\end{equation}
\end{mdframed}
$$ \lim_{x \to \infty} f(x)$$
$$ \sum_{n=1}^{\infty} \frac{1}{n^2}$$
\subsection{Physics}
\begin{center}
\begin{tikzpicture}[scale=5]
\draw[thick,color=green] (0,0) -- node[below] {$F_x$} (1,0);
\draw[thick,color=red] (1,0) -- node[right] {$F_y$} (1,0.57735);
\draw[thick,color=black] (1,0.57735) -- node[above] {$\vec{F}$} (0,0);
\filldraw[fill=blue!20!white,draw=blue] (0,0) -- (0.3,0) arc (0:30:0.3);
\node[color=blue] at (0.33,0.1) {$\theta$};
\draw (0.95,0) -- (0.95,0.05) -- (1,0.05);
\end{tikzpicture}
\end{center}
% Section about vectors
% \begin{minipage}{0.5\textwidth}
% %\includegraphics[width=\textwidth]{pic1}
% \end{minipage}
\begin{minipage}{0.45\textwidth}
\begin{tikzpicture}[scale=5]
\draw[thick,color=green] (0,0) -- node[below] {$F_x$} (1,0);
\draw[thick,color=red] (1,0) -- node[right] {$F_y$} (1,0.57735);
\draw[thick,color=black] (1,0.57735) -- node[above] {$\vec{F}$} (0,0);
\filldraw[fill=blue!20!white,draw=blue] (0,0) -- (0.3,0) arc (0:30:0.3);
\node[color=blue] at (0.33,0.1) {$\theta$};
\draw (0.95,0) -- (0.95,0.05) -- (1,0.05);
\end{tikzpicture}
\end{minipage}
%
% Fix so they are side by side
%
\begin{minipage}{0.45\textwidth}
\[
F_x=\vec{F}\cos{\theta}
\]
\[
F_y=\vec{F}\sin{\theta}
\]
\end{minipage}
%
\begin{mdframed}[roundcorner=5pt,frametitle={Kinematics Equations in 2-D}]
$$ \langle x(t), y(t) \rangle = \langle x_o+v_{xo}t+\frac{1}{2}a_xt^2, y_o+v_{yo}t+\frac{1}{2}a_yt^2 \rangle$$
$$ \langle x^{\prime}(t), y^{\prime}(t)\rangle = \langle v_{xo} + a_xt, v_{yo}+a_yt \rangle$$
$$ \langle x^{\prime\prime}(t), y^{\prime\prime}(t)\rangle = \langle a_x, a_y \rangle $$
\end{mdframed}
\begin{mdframed}[roundcorner=5pt,frametitle={Projectile Motion},nobreak=true]
Assuming no air resistance the kinematics equations reduce to:
\begin{equation}
\begin{split}
\langle x(t), y(t) \rangle = \langle x_o+v_{xo}t,\; y_o+v_{yo}t-\frac{1}{2}gt^2 \rangle \\[2ex]
\langle x^{\prime}(t), y^{\prime}(t)\rangle = \langle v_{xo},\; v_{yo}-gt \rangle \\[2ex]
\langle x^{\prime\prime}(t), y^{\prime\prime}(t)\rangle = \langle 0, \; -g \rangle
\end{split}
\end{equation}
\end{mdframed}
\subsection{Chemistry}
Two packages, \textit{mhchem}\footnote{Documentation for \textit{mhchem} package can be found at \url{http://mirror.utexas.edu/ctan/macros/latex/contrib/mhchem/mhchem.pdf}} and \textit{chemfig}\footnote{Documentation for the \textit{chemfig} package can be found at \url{http://ftp.math.purdue.edu/mirrors/ctan.org/macros/generic/chemfig/chemfig_doc_en.pdf}}, were created specifically for creating chemical formulas and diagrams. Although chemical equations can be typeset in math mode without additional packages the amount of repetitive typing is tedious.
The package \textit{mhchem} uses simple syntax to automate the typesetting of chemical equations. The command \textit{ce} is used to denote a chemical equation and can be used in both text mode and math mode. The code for \ce{H2O} is \verb|\ce{H2O}|.\footnote{Note that the `H' and `O' are capitalized; A useful template with examples can be found at \url{http://www.latextemplates.com/template/chemical-equations}}
\begin{verbatim}
\ce{CO2 + C -> 2CO} \\[2ex]
\ce{SO4^2- + Ba^2+ -> BaSO4} \\[2ex]
\ce{CH4 + 2O2 -> CO2 + 2H2O}
\end{verbatim}
\begin{center}
\ce{CO2 + C -> 2CO} \\[2ex]
\ce{SO4^2- + Ba^2+ -> BaSO4} \\[2ex]
\ce{CH4 + 2O2 -> CO2 + 2H2O}
\end{center}
Bonds can be represented with the \textit{bond} command.\\[2ex]
\noindent
\ce{C6H5-CHO} \hfill
\ce{C6H5=CHO} \hfill
\ce{C6H5#CHO} \vspace{0.5cm}
Chemical rings can be created with the chemfig package. A single bond is created with a dash (-), a double bond with an equals sign (=), and a triple bond with a tilde ($\sim$). An arbitrary ring with 6 vertices and starting with the letter A is as follows.
\begin{verbatim}
\chemfig{A*6(=B-C=D~E=F-)}
\end{verbatim}
\begin{center}
\chemfig{A*6(=B-C=D~E=F-)}
\end{center}
\begin{figure}[hb]
\begin{center}
\chemfig{C(-[:0]C(-[:90]H)(-[:270]H)(-[:0]H))(-[:90]H)(-[:180]H)(-[:270]H)}
\caption{Branched Molecules}
\label{chem:methane}
\end{center}
\end{figure}
\subsection{Biology}
%
%
% Topic specific examples of special symbols
%
%
%\listoftodos
\end{document}
___ ___
___ /__/\ / /\
/ /\ \ \:\ / /:/_
/ /:/ \__\:\ / /:/ /\
/ /:/ ___ / /::\ / /:/ /:/_
/ /::\ /__/\ /:/\:\ /__/:/ /:/ /\
/__/:/\:\ \ \:\/:/__\/ \ \:\/:/ /:/
\__\/ \:\ \ \::/ \ \::/ /:/
\ \:\ \ \:\ \ \:\/:/
\__\/ \ \:\ \ \::/
\__\/ \__\/
___ ___ _____
/ /\ /__/\ / /::\
/ /:/_ \ \:\ / /:/\:\
/ /:/ /\ \ \:\ / /:/ \:\
/ /:/ /:/_ _____\__\:\ /__/:/ \__\:|
/__/:/ /:/ /\ /__/::::::::\ \ \:\ / /:/
\ \:\/:/ /:/ \ \:\~~\~~\/ \ \:\ /:/
\ \::/ /:/ \ \:\ ~~~ \ \:\/:/
\ \:\/:/ \ \:\ \ \::/
\ \::/ \ \:\ \__\/
\__\/ \__\/