% a line starting with "%" is a comment;
%that is, everything following "%" onthe same line has no impact on the generated .pdf
%%%%%%%% License for this document: GPL 3 %%%%%%%%%%%%%
%document on A4 sized paper with fontsize 12
\documentclass[12pt,a4paper]{article}
%font encoding (no need to pay attention to this)
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
%packages for mathematical symbols and environments
\usepackage{amsmath,amssymb,amsthm}
%decent margins
\usepackage{geometry}
\geometry{tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
%decent line spacing
\usepackage{setspace}
\onehalfspacing
% package that allows including grapics
\usepackage{graphicx}
%package for formatting urls
\usepackage{url}
%bibliography is done with natbib and uses the "Author (year)" style
\usepackage[authoryear]{natbib}
%avoids a faint print problem on some systems
\usepackage{ae,aecompl}
%define some mathematical environments
\newtheorem{lemma}{Lemma}
\newtheorem{proposition}{Proposition}
\newtheorem{example}{Example}
\newtheorem{assumption}{Assumption}
\newtheorem{result}{Result}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{definition}{Definition}
%%%%%%%%%%%%%Nice formatting of (sub)section headings (no need to pay attention)
\makeatletter
\renewcommand{\section}{\@startsection{section}{1}{0mm}{-1.5\baselineskip}{0.8\baselineskip}{\normalfont\large\centering}}
\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}{-0.1\baselineskip}{0.5\baselineskip}{\normalfont\bf\flushleft}}
\renewcommand{\section}{\@startsection{section}{1}{0mm}{-0.9\baselineskip}{0.5\baselineskip}{\normalfont\large\centering}}
\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}{-0.1\baselineskip}{0.3\baselineskip}{\normalfont\bf\flushleft}}
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname
\hspace{+0mm}\large{.}\hspace{+1.9mm}}
\renewcommand{\@seccntformat}[2]{\csname the#1\endcsname
\hspace{+0mm}\large{.}\hspace{+1.9mm}}
\makeatother
%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% Frontmatter %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% You have to fill in the right information below
\title{Your Title\thanks{If necessary, you can -- at this very point -- thank someone for his great comments to earlier versions of the paper.}}
\author{Your Name\thanks{In many papers you will see here the affiliation of the authors.}}
\date{\today} %you can use something like \date{August 17, 2017} to get a date that is not today's date
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%"\maketitle" inserts title, author and date into the document
\maketitle
%abstract
\begin{abstract}
This is the abstract. An abstract is a short summary that tells a potential reader quickly what you are doing allowing him to judge whether to read your paper or not. (abstract length is $\approx$ 100 words for a normal length paper)
\end{abstract}
%start of the first section; the label is used to reference the section later on
\section{Introduction}\label{sec:intro}
This document can be used as a template (in this case you want to delete all my text from here to the \verb|\bibliographystyle{chicago}| command. In the following, I will give some examples of how to cite and reference, and how to use mathematics in \LaTeX.\footnote{Ideally, you should look at the .pdf and the .tex file at the same time to see what the code generates.} I assume that you have read the ``Getting started'' part of the \LaTeX\ wikibook, see \url{https://en.wikibooks.org/wiki/LaTeX}.
\subsection{Literature Review}\label{sec:literature}
Some examples of citations in \LaTeX\ using BibTeX: The ``Chicago view'' of privacy is based on \cite{stigler1980introduction} and \cite{posner1981economics}. A page in a book is cited as \citet[p. 34]{solove2010privacy}.
All the cited articles, books etc. have to have an entry in the .bib file where you define the label used for citing and store all the information necessary for creating the reference list at the end of the document. You can usually copy and paste the entries for the .bib file from Google Scholar or JSTOR with occasional minor editing (and otherwise you do it by hand following Martin Osborne's guide; \url{https://www.economics.utoronto.ca/osborne/latex/BIBTEX.HTM}). To tell \LaTeX\ that there is a .bib file, you need to use the \verb|\bibliography{name .bib file}| command at the point where you want to have the reference list; see the end of this document. The layout of the reference list is determined by the \verb|\bibliographystyle{}| command; in this document I use the style ``chicago''.
The advantage of BibTeX is twofold: First, you spell the author names and the publication years correctly. Second, the reference list is automatically generated and formatted nicely.
Do not forget to run BibTeX (unless you like question marks instead of citations all over your document). To get the full output:
\begin{enumerate}
\item run \LaTeX
\item run BibTeX
\item run \LaTeX\ twice.\footnote{You do not have to run BibTeX again afterwards unless you insert a new citation.}
\end{enumerate}
\section{Maths}\label{sec:math}
Mathematics within a line of text is put between \$ marks. For example, \verb|$\frac{3}{4}$| yields the fraction $\frac{3}{4}$ or $\lim_{x\rightarrow \infty}e^{-x}=0$ is generated by\\ % "\\" forces a linebreak; you should normally not use it
\verb|$\lim_{x\rightarrow \infty}e^{-x}=0$|. Subindeces as in $x_1$ are written as \verb|$x_1$|. Here is how you use math environments:
\begin{definition}[Fixed Point]\label{def:fp}
Let $f: \,D\rightarrow R$ where $D\subseteq R$. If $f(x)=x$, then $x$ is called a \emph{fixed point} of $f$.
\end{definition}
You reference the definition as ``definition \ref{def:fp}'' (that is \verb|definition \ref{def:fp}| in the source file where \verb|def:fp| is the label of the definition above). Similarly, you can reference sections as \verb|section \ref{sec:intro}| which yields ``section \ref{sec:intro}''. Also subsection \ref{sec:literature} can be referenced using \verb|subsection \ref{sec:literature}|. The advantage of such references over writing ``section 1.1'' directly is that your references will automatically adjust if you change something in the structure of your document; for example, if you insert another section.
(Note that you have to compile \LaTeX\ twice before it gets a new reference properly formatted.)
Important (or long) equations can be displayed in an own line (and maybe numbered and referenced) like so:
\begin{equation*}
x^2+px+q = 0,
\end{equation*}
\begin{equation}
\label{eq:pq} %the equation number can be referenced with \ref{eq:pq}
x_{1/2}=\frac{p}{2}\pm \sqrt{(p/2)^2-q}.
\end{equation}
\subsection{Results}\label{sec:results}
A mathematical result, like a proposition or a lemma, is written in a similar environment as a definition.
\begin{proposition}\label{prop:fp01}
Let $f: \,[0,1]\rightarrow[0,1]$ be an increasing function. Then, $f$ has a fixed point.
\end{proposition}
\section{Extensions}\label{sec:ext}
This section gives examples of specialized uses that are probably unimportant if you try \LaTeX\ for the first time.
\subsection{Importing graphics }
\label{sec:importing-graphics}
You can include a graphic with the command \verb|\includegraphics{filename}| if the graphic is in the same folder as your .tex document (recommended file formats are png, eps or pdf). Usually it is a good idea to place the graphic in a ``figure environment'' as here.
\begin{figure}[h]
\centering
\includegraphics[scale=0.6]{Vprime} %"scale" adjusts the size of the graphic, here to 60% of the size in the original file; note that Vprime.png has to be in the same folder as this .tex document
\caption{A nice figure}
\label{fig:zigzag}
\end{figure}
We can reference the figure as figure \ref{fig:zigzag} using its label. Note that \LaTeX\ will place the figure at the top of the next page if there is not enough space on the current page (while moving the text that seemingly follows the figure in the .tex file to fill up the remaining space).
\subsection{Tables}
\label{sec:tables}
Sometimes you need to have a nicely formatted table. I will give only a simple example and you can check \url{https://en.wikibooks.org/wiki/LaTeX/Tables} if you need something more complicated. The table itself is created in a ``tabular environement''. In order to give the table a caption and to be able to reference it, the tabular environment is put into a ``table environment''.
\begin{table}[h]\centering
\begin{tabular}{l | r c} % "l" stands for left aligned column, "r" and "c" give right aligned and centered columns; "|" creates a visible vertical line
top left & top center & top right \\ \hline % "&" separates cells, "\\" ends a line, "\hline" puts a visible horizontal line in the table
mid left & mid center & mid right \\
bottom left & bottom center & bottom right
\end{tabular}
\caption{A simple table}
\label{tab:ourTable}
\end{table}
\subsection{Generating graphics}
\label{sec:generating-graphics}
If you need to create nice looking graphs, something like figure \ref{fig:zigzag} for example, you can produce these inside your \LaTeX\ document using a package called ``tikz'' (do not forget to add \verb|\usepackage{tikz}| to the preamble if you want to try). Jacques Cr\'emer wrote an excellent introduction to tikz; see \url{http://cremeronline.com/LaTeX/minimaltikz.pdf}.
\subsection{More maths}
\label{sec:more-maths}
Putting two equations nicely formatted one below the other.
\begin{eqnarray}\label{eq:aplus}
\alpha^+_h &=&\frac{\alpha p}{(1-\alpha)/2+\alpha p}\\
\alpha^-_h &=&\frac{\alpha (1-p)}{(1-\alpha)/2+\alpha(1-p)}. \label{eq:aminus}
\end{eqnarray}
Sometimes an equation is too long to be displayed on a single line.
\begin{multline}\label{eq:longEq}
\frac{3}{4}\left(\frac{\beta+\gamma}{\rho}+\theta e^\eta\right)^3 + (\frac{\beta+\gamma}{\rho}+\theta e^\eta)^3\\
=\sqrt{x}+\mathbb{E}_\theta \left[\log(\theta )*\sigma^2 \right]+\frac{3+1}{x}+\frac{\alpha -\frac{2+p}{5}}{(1-\alpha)/2+\alpha(1-p)}.
\end{multline}
The first line of the previous equation also illustrates when to use normal paranthesis like ``(\dots)'' and when you need the command ``\verb|\left(|\dots\verb|\right)|'' (the latter adjusts the size of the paranthesis).
If you do not reference an equation later on, there is no point in having it numbered.
\begin{eqnarray}\nonumber
\alpha^+_h &=&\frac{\alpha p}{(1-\alpha)/2+\alpha p}\\
\alpha^-_h &=&\frac{\alpha (1-p)}{(1-\alpha)/2+\alpha(1-p)} \label{eq:aminus}
\end{eqnarray}
and for a single equation
\begin{equation*}
\alpha^+_h =\frac{\alpha p}{(1-\alpha)/2+\alpha p}.
\end{equation*}
\subsubsection{Occasionally used symbols}
$\sim$, $\equiv$, $\approx$, \\
$\Rightarrow$, $\Leftrightarrow$, $\nearrow$,\\
$\succeq$, $\preceq$, $\succ$, $\prec$,\\
$\Re$, $\mathbb{R}$, $\mathbb{N}$, $\in$, $\emptyset$, $\{\}$\\
$\hat{\alpha}_i$, $\bar{\alpha}^2$, $\underline{\alpha}$
\subsection{Special characters and symbols}
\label{sec:special-characters}
In case there are problems with typing special characters, here is how you can generate them directly:
\noindent S\o rensen, \ae, \aa, \O ster, \AA, \AE \\M\"uller, \"o, \"a, \"Ofter, \"U, \"A\\
\'e, \`e , \^{o}, \c{c}, \k{a}\\
45\textdegree, \$, \&, \#
\section{Conclusion}
All scientific writing should be done in \LaTeX.
\newpage %starts a new page
%\section*{name} creates a section without section number
\section*{Appendix}
\noindent\textbf{Proof of proposition \ref{prop:fp01}:} Let
\begin{equation} \label{eq:A}
A=\{x:\;x\leq f(x)\}.
\end{equation}
Note that $0\in A$ and therefore $A\neq\emptyset$. Let $x^*=\sup A$. Then $f(x^*)\geq x^*$ by the definition of $A$, see equation (\ref{eq:A}), and because $f$ is increasing. If $x^*=1$, then $f(1)=1$ and we are done. Hence, assume $x^*<1$ for the remainder.
Also $f(x^*)\leq x^*$: if not, i.e. $f(x^*)>x^*$, then $x^*+\varepsilon < f(x^*+\varepsilon )$ for some $\varepsilon \in(x^*,f(x^*) ]\cap [0,1]$ because $f$ is increasing which contradicts the definition of $x^*$. Hence, $x^*=f(x^*)$.\qed
\newpage
%% The following commands should be placed where you want the reference list to appear
%style of the bibliography
\bibliographystyle{chicago}
%name of the .bib file that has to be in the same folder as this .tex file
\bibliography{privacy}
\end{document}