\documentclass{beamer}

\usepackage{beamerthemesplit}

%\usepackage{beamerthemeCopenhagen}

\usepackage{pgf}
\usepackage{color}
\usepackage{amsmath}
\usepackage{graphicx}
%\usepackage{colortbl}


% Shading
\definecolor{light}{gray}{.80}
\newcommand{\Hilite}[1]{\colorbox{yellow}{#1}}
\newcommand{\Shade}[1]{\colorbox{light}{#1}}

\newcommand\ignore[1]{}


\title[Beginning \LaTeX]{Introduction to \LaTeX\ \\ Document Preparation System}
\author[McCarthy]{Diana McCarthy}
\institute % [sussex]
{
 % \inst{1}%
  University of Sussex, UK
  
}

\date[March 2009]{March 2009}%Nov 2008]{November 2008}


\newcommand{\blue}{\textcolor{blue}}


% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
% \AtBeginSubection[]
% {
%   \begin{frame}<beamer>
%     \frametitle{Outline}
%     \tableofcontents[currentsection,currentsubsection]
%   \end{frame}
% }




\begin{document}

\frame{\titlepage}

\frame{\tableofcontents}


\section{Motivation}

\begin{frame}[fragile] % need fragile for verbatim in beamer!

\frametitle{What is \LaTeX\ and Why Bother?}

\begin{itemize}
\item use for high-quality typesetting of documents
\item will make bibliographies, glossaries, tables of content etc\ldots
\item used widely in scientific world
\item excellent for typesetting equations
\item required for many conference and journal submissions
\item format is specified in commands
\item run \LaTeX\ on file to get document (e.g. pdf file)
\item allows you to focus on content

\end{itemize}
\end{frame}




\begin{frame}[fragile]
\frametitle{Input and Output Files}

\begin{columns}[t] % top vertically aligned
  \begin{column}{5cm}%{0.5\textwidth}% [T]
{\small
\begin{verbatim}
\documentclass{article}
\title{I can use \LaTeX\ }
\author{Diana McCarthy}
\begin{document}
\maketitle
\section{Introduction}
\LaTeX\ formats documents
\section{Conclusion}
Try using \LaTeX
\end{document}
\end{verbatim}
}

 \end{column}
  \begin{column}[T]{4cm} %{0.5\textwidth}% [T]{4cm}%{0.3\textwidth} [T]

\scalebox{0.3}{\includegraphics{mydoc.pdf}}
%\rotatebox{270}{\scalebox{0.5}{\includegraphics{mydoc.pdf}}}


  \end{column}
\end{columns}

\end{frame}

% output from programs into documents
\section{Writing \LaTeX\: Basics}
\subsection{Commands}
\begin{frame}[fragile]
\frametitle{\LaTeX\ commands}


\verb+\acommand+

\vspace{0.25cm}

\verb+\anothercommand{argument}+

\vspace{0.25cm}

\verb+\yetanothercommand[options]{argument}+

\vspace{0.25cm}

\verb+% a comment. I can say what I like here!+

\end{frame}

\subsection{Document Structure}
\begin{frame}[fragile]
\frametitle{Overall structure of a \LaTeX\ document:}


\begin{verbatim}
\documentclass[...]{...}
% preamble
  ...
\begin{document}
% body of the document
  ...
\end{document}
\end{verbatim}
\end{frame}

\begin{frame}[fragile]
\frametitle{The preamble:}


\begin{verbatim}
\documentclass[a4paper,12pt]{article}

% the next line is only needed if you plan
% to embed a PostScript figure in the text
\usepackage{graphics}

\title{A \LaTeX\ File}
\author{Diana McCarthy}
% \date{if you are unhappy with the default}
\end{verbatim}
Document classes: article, report, book, beamer, usthesis\\
and options:
	10pt, 11pt,  twocolumn, a4paper, a5paper \ldots

\end{frame}



\begin{frame}[fragile]

\frametitle{The body:}
\begin{verbatim}
\begin{document}
\maketitle

\section{Introduction}
Some text...
\section{The Middle}
Some more ...
\section{Conclusion}
The final part
\end{document}
\end{verbatim}
\end{frame}



\subsection{Controlling Appearance}
%\begin{frame}<beamer>
%     \frametitle{Outline}
%     \tableofcontents[currentsection,currentsubsection]
%   \end{frame}


%\subsubsection{Making Lists}
\begin{frame}[fragile]
\frametitle{Numbered Lists}

\begin{verbatim}
\begin{enumerate}
\item blah
\item di blah
\end{enumerate}
\end{verbatim}
Looks like:-
\begin{enumerate}
\item blah
\item di blah
\end{enumerate}
\end{frame}

\begin{frame}[fragile]
\frametitle{Bullet Point Lists}

\begin{verbatim}
\begin{itemize}
\item blah
\item di blah
\end{itemize}
\end{verbatim}
Looks like:-
\begin{itemize}
\item blah
\item di blah
\end{itemize}
\end{frame}



%\subsubsection{Fonts, Symbols, Quotations and Footnotes}
\begin{frame}[fragile]
\frametitle{Changing Fonts}
\begin{center}
\begin{tabular}{|l|l|}  \hline
\verb+{\bf bold text}+ &  {\bf bold text} \\
\verb+{\it italics}+  & {\it italics} \\
\verb+{\sf sans serif}+ & {\sf sans serif} \\
%\verb+{\tt monospaced typewriter} + & {\tt monospaced typewriter} \\
\verb+{\tiny tiny text}+ & {\tiny tiny text} \\
\verb+{\large large text}+ & {\large large text}\\ \hline
\end{tabular}
\end{center}
\end{frame}


\begin{frame}[fragile]
\frametitle{Symbols and Quotations}
\begin{center}
\begin{tabular}{|l|l|}  \hline
\verb+$ \rightarrow $+ & $\rightarrow$   \\
%\verb+$\pounds$+  & $\pounds$ \\
\verb+$\sum$+ & $\sum$ \\
\verb+\'o+ & \'o \\
\verb+\"o+ & \"o\\ \hline
\end{tabular}
\end{center}
\begin{verbatim}
\begin{quote}
\LaTeX\ The best thing since sliced bread [Diana McCarthy].
\end{quote}
\end{verbatim}
So the quote in amongst text looks like:
\begin{quote}
\LaTeX\ The best thing since sliced bread [Diana McCarthy].
\end{quote}

\end{frame}


\begin{frame}[fragile]
\frametitle{Reproducing text verbatim:}

Either like this:

\verb+\begin{verbatim}+
\begin{verbatim}
{\LARGE \bf Reproducing text verbatim:}
\end{verbatim}
\verb+\end{verbatim}+\\ 

\vspace{0.5cm}

Or like this: 

\begin{verbatim}
\verb+{\LARGE Reproducing text verbatim:}+
\end{verbatim}

\end{frame}




%\subsection{Adding Structure}

\subsection{Adding Structure: Sections}
\begin{frame}[fragile]
\frametitle{Sections, sub-sections, subsubsections}


\begin{verbatim}
\section{Experiments}
\label{Iwashere}
However this contains...
\subsection{Experiment A}
which contains...
\section{Discussion}
Look at section \ref{Iwashere} for more details.
\section{Conclusion}


\end{verbatim}
\end{frame}


\subsection{Adding Tables, Figures and Equations}

\begin{frame}[fragile]
\frametitle{Tables}
{\small
\begin{verbatim}
\begin{table}[!h] %tbp
\begin{center}
\begin{tabular}{|l|r|} \hline
Number of students & 20 \\  \hline
Location \& time & JMS 1B01 \& 2pm\\ \hline
\end{tabular}
\caption{\LaTeX\ course}
\end{center}
\end{table}
\end{verbatim}
}
{\tiny
\begin{table}[!h] %tbp
\begin{center}
\begin{tabular}{|l|r|} \hline
Number of students & 20\\ \hline
Location \& time & JMS 1B01 \& 2pm\\ \hline
\end{tabular}
\caption{\LaTeX\  course}
\end{center}
\end{table}
}
\end{frame}



\begin{frame}[fragile]
\frametitle{Including Pictures}
{\small
\begin{verbatim}
\begin{figure}[!h]
\begin{center}
\rotatebox{270}{\scalebox{0.1}{\includegraphics{stickman.pdf}}}
\caption{My Stickman}
\end{center}
\end{figure}
\end{verbatim}
}


\begin{figure}[!h]
\begin{center}
\rotatebox{270}{\scalebox{0.1}{\includegraphics{stickman.pdf}}}
%\scalebox{0.1}{\includegraphics{face.pdf}}
%\caption{My bar chart}
\caption{My Stickman}
\end{center}
\end{figure}
\end{frame}



\begin{frame}[fragile]
\frametitle{Equations}
{\small
\begin{verbatim}
\begin{equation}
\sum_{n_{jw} \in N_{w}} \frac{n_{jw}}{\log(\pi^2)}
\label{foo}
\end{equation}
\end{verbatim}
gets:
\begin{equation}
\sum_{n_{jw} \in N_{w}} \frac{n_{jw}}{\log(\pi^2)}
\label{foo}
\end{equation}


}
\end{frame}

\begin{frame}[fragile]
\frametitle{Equations: unnumbered and in text}
or
\verb+\[\sum_{n_{jw} \in N_{w}} \frac{n_{jw}}{\log(\pi^2)}\]+
gives
\[\sum_{n_{jw} \in N_{w}} \frac{n_{jw}}{\log(\pi^2)}\]
or
\verb+$\sum_{n_{jw} \in N_{w}} \frac{n_{jw}}{\log(\pi^2)}$+
gives
$\sum_{n_{jw} \in N_{w}} \frac{n_{jw}}{\log(\pi^2)}$
\end{frame}

\section{Running \LaTeX\ }

\frame{
%\begin{frame}[fragile]
\frametitle{Editing and Running \LaTeX: TeXnicCentre}
\begin{itemize}
\item Start -- All Programs -- Applications -- TeXnicCentre -- TeXnicCentre
\item open file.tex
\item write your \LaTeX\
\item choose ``Project'' and ``create with active file as main file''
\item press Ctrl+F5 %(press again and it should work) 
%\item (manual sequence for unix is latex bibtex latex latex)
\item view the pdf
\item edit file.tex as necessary 
\item Ctrl+F5 to produce a new version of the pdf
\end{itemize}
%\end{frame}
}


\section{BIB\TeX}
\begin{frame}[fragile]
\frametitle{Citations and Bibliography}

Using BIB\TeX

\begin{itemize}
\item store your references in a .bib file in the specified format:
{\footnotesize % tiny scriptsize footnotesize small
\begin{verbatim}
@BOOK{Lamport,
    Title   = {{\LaTeX\}: A Document Preparation System},
    AUTHOR   = {Lamport, Leslie},
    PUBLISHER      = {Addison-Wesley},
    ADDRESS        = {Reading, Massachusetts},
    YEAR           = {1994},
    Keywords       = {Latex documentation}
}
\end{verbatim}
}
\end{itemize}
\end{frame}



\begin{frame}[fragile]
\frametitle{Using your bib file}
\begin{enumerate}

\item include the package needed for the style
e.g. plain, apa
\begin{verbatim}
\usepackage{plain} 
      %  before \begin{document}
...
\begin{document}
\end{verbatim}
\item cite references using \verb+\cite{Lamport}+

\item specify the style
\begin{verbatim}
\bibliographystyle{plain} 
       %  before \bibliography{} cmd
\end{verbatim}
\item specify the bibliography file in your document where you want it to appear
\begin{verbatim}
\bibliography{my} 
\end{verbatim}
\end{enumerate}
\end{frame}



\frame{
\frametitle{Running \LaTeX with BIB\TeX}
\begin{itemize}
\item choose ``Project'' and ``create with active file as main file''
\item select use BIB\TeX
\item press Ctrl+F5 (press again and it should work)
\item view the pdf
\end{itemize}

You end up with an output file which including the bibliography:
\bibliographystyle{plain} 
\begin{thebibliography}{1}

\bibitem{Lamport}
Leslie Lamport.
\newblock {\em {LaTeX}: A Document Preparation System}.
\newblock Addison-Wesley, Reading Massachusetts, 1994.

\end{thebibliography}
}



\begin{frame}[fragile]
\frametitle{The source}
The  source stored in the my.bbl file. You can insert this directly into your latex source:

\begin{verbatim}
\bibliographystyle{plain} 
\begin{thebibliography}{1}

\bibitem{Lamport}
Leslie Lamport.
\newblock {\em {LaTeX}: A Document Preparation System}.
\newblock Addison-Wesley, Reading Massachusetts, 1994.

\end{thebibliography}
\end{verbatim}
\end{frame}



\section{Miscellaneous}
\begin{frame}[fragile]
\frametitle{Unix: Running, Viewing and Printing \LaTeX :}


\begin{verbatim}
% latex myproposal.tex
% xdvi myproposal.dvi
% dvips myproposal.dvi
% dvips -P <printer> myproposal.dvi
% dvips -o myproposal.ps myproposal.dvi
% ps2pdf myproposal.ps myproposal.pdf
% pdflatex myproposal.tex
\end{verbatim}

% ghostview myproposal.ps

%$ lp -d <printer> myproposal.ps 


%$ ps2pdf myproposal.ps myproposal.pdf

%$ pdflatex myproposal.tex



\end{frame}

\begin{frame}[fragile]

\frametitle{Unix: Running \LaTeX with BIB\TeX}


\begin{itemize}
\item run latex
\begin{verbatim}
% latex myproposal.tex
\end{verbatim}
\item run bibtex
\begin{verbatim}
% bibtex myproposal
\end{verbatim}
\item then run latex twice more to get all references in
\begin{verbatim}
% latex myproposal
% latex myproposal
\end{verbatim}
\end{itemize}
\end{frame}




\begin{frame}[fragile]
\frametitle{Miscellaneous Tips}
\begin{description}

%\item[spell check] \verb+detex my.tex | spell | more+

\item[user commands]  \verb+\newcommand{\myt}[1]{\textit{#1}}+

\item[commenting chunks] \verb+\newcommand\ignore[1]{}+

%\item[debugging]  \verb+\newcommand{\mydebug}[1]{\message{^^J^^J#1^^J^^J}}+

%\item[new lines] \verb+\\+

\item[footnotes] \verb+\footnote{Add something.}+
\item[useful packages]
\verb+\usepackage{times} \usepackage{epsfig}+

%\item[landscape] dvips -t landscape
\end{description}
\end{frame}



\section{Exercises}
%\subsection{Get Workshop Files}
\frame{
\frametitle{Getting Files for this Workshop}

\begin{itemize}
\item login
\item create a new folder for your \LaTeX\ files
\item Google \textbf{Diana McCarthy latex}
\item select 
{\small
http://www.informatics.sussex.ac.uk/research/groups/nlp/

mccarthy/teach/latex/
}

\item Either:
\begin{enumerate}
\item download beginlatex2009.zip and  extract the contents\\
 e.g. use IZArc

%(
%or download
%{\small
%http://www.informatics.sussex.ac.uk/research/groups/nlp/
%
%mccarthy/teach/latex/beginlatex2009.zip
%})


or
\item  download the individual files
\end{enumerate}
\end{itemize}

}

%\subsection{Run \LaTeX}

\frame{ 

\frametitle{Exercise: Running and Viewing \LaTeX}
\begin{itemize}
\item Start -- All Programs -- Applications -- TeXnicCentre -- TeXnicCentre

\item open mydoc.tex and have a look
\pause
\item choose ``Project'' and ``create with active file as main file''
\item select use BibTex 
\item press Ctrl+F5 %(press again and it should work) 
%\item (manual sequence for unix is latex bibtex latex latex)
\item view the pdf
%\pause
\item write your name as author and a sentence in the introduction 
\item press Ctrl+F5 to see the change
\end{itemize}
}


\frame{
\frametitle{Exercises}
\begin{enumerate}

\item adapt mydoc.tex to add some  new sections and subsections

\item add a reference to a section from a different section

\item add a list

\item add a table with a caption, e.g. the first few rows of the 2 times table

\item add a reference to this table in the text

\item add a citation to one of the books in my.bib to your document

\item make an equation looking like $\sum_{x = 0} \frac{x^2}{x}$

(Hint: you can look at the source code in beginlatexslides.tex to see how to do it if you get stuck)


\item If you have time: close everything, put error.tex in a new folder and fix it


\end{enumerate}
}



\ignore{
\begin{frame}<beamer>
     \frametitle{Outline}
     \tableofcontents[currentsection,currentsubsection]
   \end{frame}
}






\end{document}



