\documentclass[12pt]{article}


\usepackage{amsfonts, amsmath, ams symb, bm} %Math fonts and symbols

\usepackage{dcolumn, multirow} % decimal-aligned columns, multi-row cells


\usepackage{graphicx, subfigure, float} % graphics commands   

%\graphicspath{ \input{501.TA} }   % this is tricky. getting the file directory right is worth practising.

\usepackage{textcomp}

\usepackage[margin=1in]{geometry} % sets page layout

\usepackage{setspace}% allows toggling of double/single-spacing

\usepackage{verbatim}% defines environment for un-evaluated code

\usepackage{natbib}% defines citation commands and environments.

%\usepackage{url} % allows you to add URL's that can be clicked and take you to the website




\usepackage{chngcntr}
\counterwithin*{section}{part}
% this code allows you to reset the section counter. If you have multiple chapters for example it allows you to start section 1 for chapter two rather than continuing the counter. 

%\usepackage{url}% allows including urls with \url{} field.

\singlespace % set document spacing to single

\bibpunct[, ]{(}{)}{,}{a}{}{,} % sets the punctuation of the bibliography entires.

\newcolumntype{d}[1]{D{.}{.}{#1}} % defines a decimal-aligned column

% notice that some of the packages have been taken out of the document using the % command this is because occassionally some packages will interfere with others. You may get a error despite your code working well. If after you have checked you code and you seen no problems then go through and see if it works without certain packages. Here the package colorlinks=true is causing problems




\date{}

\usepackage[colorlinks=false]{hyperref}% allows you to use hyperlinks
%\usepackage[colorlinks=true]{hyperref}
%\hypersetup{colorlinks=true} 

\begin{document}

% This marks the shift from the preamble to the beginning of the document. Above you pre-load all the things you will need. Google for the packages all should be included in the program. 

\begin{titlepage}
	\centering
	\vspace*{3cm}
	{\scshape\LARGE Introduction to \LaTeX  \par} 
	{\vspace{0.5cm}}
	{\scshape\Large Brendan Skip Mark \par}
	\vspace{1cm}


	 {\normalsize bmark2@binghamton.edu \par}
	\vspace{2cm} 
	
	
% below is some exampe of changing font sizes locally	
\Huge S
\huge T
\LARGE A
\Large T
\large I
\normalsize S
\small T
\footnotesize I
\scriptsize C
\tiny S \\
\vspace{4cm}

 \includegraphics[width=7cm]{BULogo}  

	\vfill

\end{titlepage}
	
% recap - the title page environment is different from the document environment
% text sizes can be seen in code above
% spaces vertically included above
% including graphics included above but need to look at the packages added on and the filepath



%below is the document environment.

\part{The Program}

\section{ Giving Credit Where It Is Due}

I would like to thank Kerem Ozan Kalkan who ran that Latex workshop at ICPSR 2015 for a lot of this code and many of the examples. I'd recommend sitting in on this class if you forget everything about \LaTeX by the time you go. \\

\hspace{0.5cm} I would also like to thank Mert Moral who has taught me quite a bit about \LaTeX and helped me fix an error in this document that was preventing it from compiling. Whether it is for \LaTeX, STATA, R or any other problem one of the best resources you have are your fellow colleagues. Run problems by them or ask myself, Dave, or another person in the department. Most people are readily willing to help when you run into trouble or get stuck. 

\section{A shortcut to some FAQs}
For those who are having trouble with Latex a useful guide for beginners can be found \href{http://mirrors.rit.edu/CTAN/info/beginlatex/html/chapter5.html}{CLICK HERE} which goes through a lot of the basics and is highly recommended 

\section{Introduction and Download Guide}

A lot of this has been given in the readme file that Dave provided. Here is a quick recap

\subsection{Distribution of \LaTeX} (note everyone often signals that they use \LaTeX \ by using this font for Latex)

% the \hspace command adds space horizontally

\hspace{1cm}  {Windows:}

\ \ \ \ \ \ \ \ \ \  \href{http://miktex.org/download}{(MiKTeX Hyperlink)} or \href{https://www.tug.org/protext/}{(proTeX Hyperlink)}  guides you through the installation 

\ \ \ \ \ \ \ \ \ \  \href{http://www.tug.org/texlive/}{(TeXLive Hyperlink)}

\hspace{1cm} {Max:}


\ \ \ \ \ \ \ \ \ \  \href{http://www.tug.org/mactex/}{(MacTex Hyperlink)}

\ \ \ \ \ \ \ \ \ \ \ \href{http://www.tug.org/xetex/}{(XeTex Hyperlink)} has additional font support

\vspace{1cm}
These are the "machines" that typeset in \LaTeX

\vspace{1cm}

\subsection{Text Editors} 

This is the main part of \LaTeX which you will be working in. This is where you will enter the text and compile your document. This is a GUI (graphical user interface) that translates the commands you type into a finalized version which can be turned into a pdf or .tex file. \\

For Mac there is a free version which is the one I am using called \href{http://pages.uoregon.edu/koch/texshop/}{(TexShop Hyperlink)} (Mac only) this is included in the package from MacTex (see above) \\

For Windows users the most common text editor is \href{http://www.winedt.com}{(WinEdt hyperlink)} it is \$40 for student licenses and may be used for free for a short trial period. \\

% note here that the $ has a special meaning in Latex. If you type $40 it will not run. Instead you need to preface it with a \ 
%The same can be said of the  & % $ # _ { } ~ ^ \ symbols to get them in Latex we need to enter
%    \& \% \$ \# \_ \{ \}
% \ is also a special symbol and to have a \ in your text you need to type  $\backslash$ in your file.

Finally you will need a pdf viewer like adobe acrobat or preview on mac.

\part{Parts of the  \LaTeX  \ document}

\LaTeX documents have two main parts: the preamble and the body. The preamble sets up all the packages you will be using (this is similar to the library() command in R). This is where you pull up packages, set titles, fonts, and organize how the document will look. 
Below you can see an example of what the preamble looks like. We will go through each of these but the best source for questions about each package is google! Googling a package and looking around for questions about it or descriptions of it will often be the best source of information. There are too many packages to cover and each template you find will likely have different packages. Also note there are many different packages and commands which accomplish the same thing. 



\section{Preamble}




The preamble is everything in between $\backslash$documentclass[]\{\} and $\backslash$begin\{document\}  \\

to begin a .tex file we start with the \{documentclass\}[12pt]\{artticle\} function.  \\
\varespilon is a cool symbol 

This tells \LaTeX what kind of environment it will create. Next we load a number of packages with the usepackage command. \\

Below is an example of what a preamble in a document might look like. 
%
%\begin{verbatim}

\documentclass[12pt]{article}} %there are many document classes including article, book, 
report, slides, letter, memoir, and beamer 

\usepackage{amsfonts, amsmath, amssymb, bm} % this brings up a bunch of math 
symbols which you can use. It essentially allows latex to understand math notation
\usepackage{dcolumn, multirow} % this lets you create multi-column tables and 
aligns the text based on the decimal location
\\usepackage[colorlinks=true]{hyperref} % this refers to the color of the hyperlinks 
you insert into the text

\usepackage{graphicx, subfigure, float} % allows you to insert graphics.
\usepackage[margin=1in]{geometry} % sets the margins of the document
\usepackage{setspace}% allows you to switch between single and double spaced
\usepackage{verbatim}% defines environment for un-evaluated code
% "The verbatim environment is a paragraph-making environment that gets LaTeX 
to print exactly what you type in. 

\usepackage{natbib}% defines citation commands and environments.
% note there are a number of citation environments one being APSA or harvard style
 %(see http://www.ctan.org/tex-archive/macros/latex/contrib/harvard/)


\singlespace % set document spacing to single or double spaced. 
\bibpunct[, ]{(}{)}{,}{a}{}{,} % sets the punctuation of the bibliography entires.
\newcolumntype{d}[1]{D{.}{.}{#1}} % defines a decimal-aligned column

%\end{verbatim}

%note that the \begin{verbatim} and \end{verbatim} commands are used to tell latex that everything should be compiled exactly as it is written. No more special commands or \ necessary. Everything in between these two commands will be replicated exactly. For example the above code if you typed it in on its own would fail to comply. However, after the verbatim command it appears at it should.
 
the end of the preamble begins when we type $\backslash$begin\{document\}. This marks a shift towards the beginning of the body, which is the second part of a .tex document


\section{Body}

This is where your graphics, papers, and all of the meat of your document goes. Remember that at the end of a document you must type $\backslash$end\{document\}. In this .tex file you can see that all of this is included in the body. This is what we actually see when everything is compiled. 

\section{Compiling a document}

Compiling a document translates all of the code you see into a pdf. This is a necessary step as the code alone is useless if it doesn't compile. This necessitates a warning and best practices suggestion: compile early and often. There is nothing more frustrating than writing an entire \LaTeX\ file and hitting compile only to see numerous errors. Compiling at each stage of the document takes little time and will save you numerous headaches. Another suggestion is to ensure that the template you start with compiles properly before you begin. \\

In TeXShop we can compile a document by clicking the Typeset button in the top left.  \\

Note that you will want to be working in pdflatex. ``pdflatex'' compiles your document as a pdf and can typeset a lot of the extensions (such as .jpg) your figues will be saved under. ``latex'' will compile your document into a .dvi file which needs to be converted to ps and then saved as a pdf. Long story short pdflatex saves you a lot of time. \\

\LaTeX\ may often return errors and stop compiling the document. Sometimes you can force \LaTeX\ to compile the document by entering q when the errors come back (or holding enter). As long as it is not a fatal error \LaTeX\ will ignore any non-essential errors. It may also help to ``Trash Aux Files'' before trying to compile again.  \\

The most common errors occur because you are using \verb| [  ] instead of { } or [}, |it may also occur because you open an environment but do not close it. Or you fail to add \verb| \end{document} | at the end of your file. The console can provide useful information about where you errors are. \\

You can also try entering the code from the body of your document into programs like LaTeXiT which checks the code for errors. These programs act like a spelling check in microsoft word. Mixed results as they word imperfectly. \\ 


\part {Useful commands}




\begin{itemize}
\item $\backslash$$\backslash$ and $\backslash$newline - move whatever comes after these to a new line. Make sure there is a line to end. If you simply type $\backslash$$\backslash$ you will get an error
\item $\backslash$newpage will move text to the next page
\item $\backslash$newpage moves onto the next page
\item quotation marks are a bit different. Use the \textasciigrave  \  symbol under the  key to create the left open quotation. To close a quotation use two single quotation marks. This will look like this in your command file \textasciigrave\textasciigrave ' '
% note that to show the ` symbole we need to use the package textcomp and the command for producing the symbol is \textasciigrave
\item each symbol we use in math has its unique code. For a list of common symbols and their commands see \href{https://www.artofproblemsolving.com/wiki/index.php/LaTeX:Symbols}{Symbols}. An example of this is  \(epsilon\) which is entered by typing $\backslash$epsilon which produces the symbol $ \epsilon $. You need a \$ before and after this for the command to work 
\item to create new sections and subsections use the $\backslash$section $\backslash$subsection and $\backslash$subsubsection commands
\item you will sometimes want to manually insert spaces between items. This can be done with the $\backslash$ command. A single $\backslash$ command produces a space. Alternatively you can use to $\backslash$hspace\{\} or $\backslash$vspace\{\} commands within the brackets enter a distance such as 1cm or 2cm. 
\item sectioning can be useful. in \LaTeX\ we type the \verb| \section{section 1} | command. We can also use subsections and subsubsections. If you use the \verb| \subsection | command it will automatically generate a number next to it. However, if you would prefer no numbers you can add an asterisk as such: \verb| \subsection*{} |. Below I will briefly show the code for both.



\begin{verbatim}

\section*{Section 1}
\subsection{Subsection 1}
\subsubsection{Subsection 1}

\end{verbatim}

This will produce the following:


\section*{Section 1}
\subsection{Subsection 1}
\subsubsection{Subsection 1}

Note that in order to reset the counter for sections we can use the $\backslash$usepackage\{chngcntr\} and  $\backslash$counterwithin*\{section\}\{part\} commands in the preamble. This allows you to reset the section numbering everytime you start a new part which is done by entering the $\backslash$part command

\item $\backslash$footnote\{\} puts a footnote with text between the brackets at the bottom of the page. If you would prefer to use endnotes you can use the endnotes.sty package to convert footnotes to endnotes.

\end{itemize}

\part{Useful environments}

There are a lot of useful environments that can make your life a lot easier. Whenever you open an environment make sure to write the command to close it immediately. Also be careful when you keep environments open for too long as these can cause problems compiling your code.

\begin{itemize}
\item Enumerate uses numbers and letters. 
\end{itemize}

\begin{verbatim} 
The code for enumerate is as follows 

\begin{enumerate}
\item First Bullet Point
\end{enumerate} 

This produces the following 

\end{verbatim}

\begin{enumerate}
\item First Bullet Point
\end{enumerate} 

You can also enumerate  environments. This code for example has multiple new enumerations. One thing to be careful of is to keep track of where enumerate begins and ends. If you miss one it will prevent the document from compiling.

\begin{verbatim}


\begin{enumerate}
\item First item
\begin{enumerate}
\item First sub-item
\begin{enumerate}
\item First sub-sub-item
\begin{enumerate}
\item First sub-sub-sub-item.
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}

\end{verbatim}

This produces the following

\begin{enumerate}
\item First item
\begin{enumerate}
\item First sub-item
\begin{enumerate}
\item First sub-sub-item
\begin{enumerate}
\item First sub-sub-sub-item.
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}

Please note that the same can be done for itemize the only part of the code that changes is replacing the word enumerate with itemize. \\

You can change the itemize symbol by entering the symbol you want in the [] after the $\backslash$item command. Try some of these 

\begin{verbatim}

\item[$\circ$]
\item[$\bullet$] 
\item[$\star$]
\item[$\blacklozenge$]
\item[$blacksquare$]  
  
\end{verbatim}

%\item The Verbatim Command is very useful. Look through this document's .tex file to see how often I use it. It tells \LaTeX to replicate exactly what is posted
$\bullet$ The Verbatim Command is very useful. Look through this document's .tex file to see how often I use it. It tells \LaTeX to replicate exactly what is posted

\newpage
\part{ Text size and spacing}

%\item You can alter the size of text within the document. \\
$\bullet$ You can alter the size of text within the document. \\

\Huge S
\huge T
\LARGE A
\Large T
\large I
\normalsize S
\small T
\footnotesize I
\scriptsize C
\tiny S \\

\normalsize
This is done by using the following code

\normalsize 
\{$\backslash$tiny\}  \tiny tiny \\
\normalsize
\{$\backslash$scriptsize\} \scriptsize scriptsize \\
\normalsize
\{$\backslash$footnotesize\}  \footnotesize footnotesize \\
\normalsize
\{$\backslash$small\}  \small small \\
\normalsize
\{$\backslash$normalsize\}  \normalsize normalsize \\
\normalsize
\{$\backslash$large\}  \large large \\
\normalsize
\{$\backslash$Large\}  \Large Large \\
\normalsize
\{$\backslash$LARGE\}  \LARGE LARGE \\
\normalsize
\{$\backslash$huge\}  \huge huge \\
\normalsize
\{$\backslash$Huge\}  \Huge Huge \\

\normalsize
$\bullet$ You can use the $\backslash$doublespace command to make text double spaced \\
\doublespace
``When his father told him about his alarm at having forgotten even the most impressive happenings of his childhood, Aureliano explained his method to him [...] with an inked brush he marked everything with its name: table, chair, clock, door, wall, bed, pan. He went to the corral and marked the animals and plants: cow, goat, pig, hen, cassava, caladium, banana. Little by little, studying the infinite possibilities of a loss of memory, he realized that the day might come when things would be recognized by their inscriptions but that no one would remember their use. Then he was more explicit. The sign that he hung on the neck of the cow was an exemplary proof of the way in which the inhabitants of Macondo were prepared to fight against loss of memory: "This is the cow. She must be milked every morning so that she will produce milk, and the milk must be boiled in order to be mixed with coffee to make coffee and milk." Thus they went on living in a reality that was slipping away, momentarily captured by words, but which would escape irremediably when they forgot the values of the written letters.'' Gabriel G{\' a}rcia M{\' a}rquez - One Hundred Years of Solitude 3.14 \\

\singlespace

This is a wonderful quote not just because it is from one of my all time favorite books, but also because it is exactly how you should think of and annotate your .tex .do and .R files. Label everything because like Aureliano you will forget it all, even the simplest of commands. I cannot stree how important this is in any software you will work in this semester. There are countless times when a past .do file has saved me hours of re-creating code and countless times when poor annotation on a .do file has cost me hours trying to recreate what I had done in the past. 

\part {Tables and Tabular Materials}

These go in their own environments. Pay attention because for many of the homework assignments you will need to include a table of some sort. \\

the ampersand (\&) separates the contents of each cell and each line is ended with $\backslash$$\backslash$  \\

we use the c command to center something, l to left-center, and r to right-center \\

For example if we wanted to tabulate something we might use this code

\begin{verbatim}

\begin{center}
\begin{tabular} { l c r}
first cell & second cell & cell3 \\
second line & middle cell & 6th cell \\
you & get the & point
\end{tabular}
\end{center}

\end{verbatim}

This code would produce the following output

\begin{center} % this tells Latex the table will be in the center of the page
\begin{tabular} {  l   c   r  } % this tells latex the first column will be left-centered the second centered and the third column right-centered
\hline % hline creates a line 
first cell & second cell & cell3 \\
second line & middle cell & 6th cell \\
you & get the & point \\
\hline
% this is what is in the table. Each cell is separated by the & symbol and each new row is determined by the \\ command


\end{tabular}
\end{center} 

\vspace{.5cm}

Some useful commands for tables 

\begin{itemize}
\item{multiple columns and rows} $\backslash$multicolumn and $\backslash$multirow commands can \\combine columns and rows. For the $\backslash$multirow command you will need to add $\backslash$usepackage\{multirow\} to your preamble \\

\item{multi-page tables} $\backslash$usepackage\{longtable\} can be used when your table takes up two or more pages \\

\item{table positioning} positioning tables is easy when you put them in a float table environment.  \\
\begin{itemize}
\item{commands}  h (approximately here) , t (top of page), b (bottomg of page) , p (put table in special page) , ! override internal \LaTeX parameters, H (place table in this exact spot). 

\end{itemize}
\end{itemize}

Ok lets create a table!

\begin{verbatim}

\begin{table}[ht]
\caption{Nonlinear Model Results}
\centering
\begin{tabular}{c c c c}
\hline\hline
Case & Method\#1 & Method\#2 & Method\#3 \\ [0.5ex] % inserts table %heading
\hline
1&50&837&970 \\
2&47&877&230 \\
3&31&25 &415 \\
4 & 35 & 144 & 2356 \\
5 & 45 & 300 & 556 \\ [1ex]
\hline
\end{tabular}
%\label{table:nonlin}
\end{table}

\end{verbatim}



\begin{table}[ht]
\caption{Nonlinear Model Results}
\centering
\begin{tabular}{c |c c c}
\hline\hline
Case & Method\#1 & Method\#2 & Method\#3 \\ [0.5ex] % inserts table %heading
\hline
1&50&837&970 \\
2&47&877&230 \\
3&31&25 &415 \\
4 & 35 & 144 & 2356 \\
5 & 45 & 300 & 556 \\ [1ex]
\hline
\end{tabular}
%\label{table:nonlin}
\end{table}

Let's go through some of the code here. For the most part this is the only code you will need to create tables for your homework.
\begin{itemize}
\item{$\backslash$hline} this creates a horizontal line.
\item{\&} This tells \LaTeX to move to a new cell
\item{ c lc c c} this centers every cell and creates a vertical line in between the first and second column
\item{caption}  is how we label the table.
\item{t} says to put the graph at the top of the page
\item{centering} puts the table in the middle of the document
\end{itemize}



\part{Including graphs and other graphics} 

Including graphics such as a graph you created or a picture can be accomplished by loading the $\backslash$usegraphics{} command in the preamble. The easiest way to make sure that the directories line up is by including the graphic in the same directory as the .tex file. If this is done then you can simply insert in the document $\backslash$includegraphics[options]\{graphich name\} in your file. \\

If your .tex file is in a different directory than you .tex file then you can load the $\backslash$graphicsdirectory\{c:user/documents/\} package and include the directory (note you can drag the folder into the brackets for the correct directory). Best practices would be to make sure these files are in the same location as directories can be easy to mess up and moved files can cause problems.  \\
Some useful options include

$\bullet$  [width=2cm] or [height=3cm] allows you to adjust the scaling of the picture \\
$\bullet$  [width=textwidth] creates an image the same width as the text. 
$\bullet$  \textbf{keepaspectratio} keeps the original dimensions of the figure\\
$\bullet$  \textbf{angle} allows you to rotate the image \\

%note that the command keepaspectratio presents a problem for compiling. You can ignore this problem by pressing q and it compiles just fine. 

\section{figure command}

You can include figures by using the \textbf{figure} command. The figure environment is useful for creating a title, and automatically numbering your figures. Graphics can be included without the \textbf{figure} command but they cannot be labelled automatically without it. \\

Here is a sample of what the \textbf{figure} environment and syntax looks like

\begin{verbatim}

\begin{figure}[h]
\caption{Pugs are wonderful dogs}
\centerline{\includegraphics[keepaspectratio]{pug}}
\end{figure}

\end{verbatim} 

This will produce the following. Getting figures to properly align in the document can be tricky. So play around with the various float commands. \\


\begin{figure}[h]
\caption{Pugs are wonderful dogs}
\centerline{\includegraphics[width=\textwidth]{pug}}
\end{figure}


\newpage

\part{Equations}
\LaTeX provides a ton of flexibility for writing equations. However, there is a big startup cost. Learning the symbols and the way \LaTeX interprets them will take time. Once you have it down however, it will make it much easier to put equations in your papers and other documents. \\

A good online tutorial with plenty of examples can be found here \url{http://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf}  \\

One useful application for Mac users is called Equation Maker. It has an easy to use palette and it converts the math symbols to latex language for you. You can copy the code right into latex and it is a great way to learn. However, it is not free. \\

Let's go through some equations and the syntax behind them. \\

If I were to enter the code: \\

\begin{verbatim}
$ Y*= \beta_1x^2_2 + \beta_2x_2 + \gamma_1W 
+ \varepsilon_{1}, if \ Y* >0,  \ 0  \ \ otherwise $
\end{verbatim}

We get this equation in \LaTeX: \\ \\

$ Y*= \beta_1x^2_2 + \beta_2x_2 + \gamma_1W 
+ \varepsilon_{1}, if \ Y* >0,  \ 0  \ \ otherwise $ \\

Or if we wanted to look at say the error structure of a bivariate probit model we might show it like this: \\

\begin{verbatim}

\left (
\begin{matrix}
\varepsilon_{1}   \\ 
\varepsilon_{2}  
\end{matrix}
\right ) ~ N \left (
\begin{matrix}
 0 \\ 
 0 
\end{matrix}
\right ), \left (
\begin{matrix}
 1 & \rho  \\ 
 \rho & 1 
\end{matrix}
\right )

\end{verbatim}

Which would produce this output: \\ \\
$
\left (
\begin{matrix}
\varepsilon_{1}   \\ 
\varepsilon_{2}  
\end{matrix}
\right ) ~ N \left (
\begin{matrix}
 0 \\ 
 0 
\end{matrix}
\right ), \left (
\begin{matrix}
 1 & \rho  \\ 
 \rho & 1 
\end{matrix}
\right )
$ \\ \\


Or if we wanted to replace some of the variables with their variable names we might do something like this: 

\begin{verbatim}
$ Domestic \ Discontent = \alpha_{1}+\beta_{1}HumanRights + \beta_{2}Austerity 
+ \gamma Z \ + \varepsilon  $
\end{verbatim}

Which would produce: \\

$ Domestic \ Discontent = \alpha_{1}+\beta_{1}HumanRights + \beta_{2}Austerity 
+ \gamma Z \ + \varepsilon  $  \\ 

There are a ton of math symbols and practice and google will be your best friends for figuring this out. 

\part{Bibliography} This may be one of the most useful functions of \LaTeX. Even if you decide to use microsoft word to write your document you may want to consider using BibTex for your bibliography. BibTex creates a file that saves all of your citations. \\

I use the natbib package (see the preamble). Create a master .bib file. This is where all of your references should be stored. BibTex will take out the ones it need in any given document. This means you can autoformat your bibliography and spend much less time on this (with fewer mistakes) once you have entered a citation.

\begin{itemize}
\item{you} only need to type each reference once. Once you have it in your .bib file it can be included in any future document by simply typing its label
\item{you} can alter you citation style easily and BibTex automatically changes every citation in a paper.
\item{if} you cite multiple papers by the same authors it automatically orders them and adds ``Arrow (1972a)" and does the same in your bibliography.
\item{your} bibliography is automatically compiled, ordered, and put in the right citation style by simply typing $\backslash$bibliography\{research\}. BibTex takes all of the information from you master .bib file and does all the work \\

\end{itemize}

\section*{Creating a .bib file} 
\subsection*{Mac}  On a Mac you can place you bibliography file in the following folder \verb| ~/Library/texmf/bibtex/bib/ |
\subsection*{PC} On a PC, using MikTex, you can put your bibliography file in the following folder:\\ \verb| C:\Program Files\ Miktex 2.9 \bibtex\bib\ or  | \\ \verb| C:\Program Files\texlive\2012\texmf-dist\bibtex\bib | \\(or appropriate path where you latex is)  \\ \\

I am using a program called BibDesk which is quite useful. You can attach the article you are citing to the citation. This makes it easy to organize and find every article you cite. It also makes it easy to enter bibliographical information as we will see. \\

You will need three lines of code to use the natbib package. First you will need to include \verb| \usepackage{natbib} | in your preamble. Next you will need \verb| \bibliographstyle | and finally you will need \verb| \bibliography{bibliography} |. Without all three parts you cannot compile your bibliography. Calling the package forward is straightforward. The bibliography style tells \LaTeX\ which style you want your bibliography to take (APA, Chicago, MLA). This will work as follows: \\

One of my favorite articles from Will's class was Olson. \citet{olson1993dictatorship} argued that leaders give up their power in exchange for money. A good development argument which meshes well with \citet{bates2001prosperity} who says that when leaders are broke they give up their power in exchange for money. Both of which are the foundation of many development arguments made in political science. \\

Some common natbib citations include \\ \\
$\bullet$ \verb| \citep{olson1993dictatorship} | produces \citep{olson1993dictatorship} \\
$\bullet$ \verb| \citet{olson1993dicatorship} | produces \citet{olson1993dictatorship} \\
$\bullet$ \verb| \citep[See][569]{olson1993dictatorship} | produces \citep[See][569]{olson1993dictatorship} \\
$\bullet$ \verb| \citeyearpar{olson1993dictatorship} | produces \citeyearpar{olson1993dictatorship} \\

You can find a list of all the common natbib references at \href{http://merkel.zoneo.net/Latex/natbib.php}{natbib} \\

In order to include the bibliography and citations you must first compile using \LaTeX\ then compile using BibTex and finally compile again using \LaTeX\. Thus there are three steps. Compiling with BibTex can also give you useful information about what is wrong with citations. 

\section*{Some useful tips}


Google scholar is a very useful resource. It can give you bibtex citations (always check these as they are hit or miss and you will have to enter your own citekey). \\



Find someone else's .bib file and steal all their citations! No use in starting from scratch. \\

you can find a number of useful \LaTeX\ files at \url{http://spia.uga.edu/faculty_pages/monogan/computing/latex/} including a master bib file created by Jamie Monogan (called master bib) and an APSR bib style entitled apsr.bst (place this in /bibtex/bib folder).  \\

Keep a consisten citekey. I use authors last name, year, first non-article work. So olson1993dictator is a citekey. \\

Tagging you citations with keywords for broad literatures will come in handy down the road. So if an article talks about development and you tag it for development then creating a lit review on development articles becomes much easier as they are all in one place with that tag. \\

This is just the tip of the iceberg! Hopefully this is enough to do all of your assignments but there is an almost endless number of packages and commands to learn. Good luck! 




\bibliographystyle{polsci}
\bibliography{brendan}
\end{document}
