%===========================================================================
%
%   LaTeX Training Materials
%
%   Part I: Introduction to LaTeX
%
%   Written by Gavin Baker <gavinb@cs.mu.oz.au>
%
%   And Glenn Moloney <glenn@physics.unimelb.edu.au>
%
%---------------------------------------------------------------------------
%
%   Copyright (c) 2003 Gavin Baker, Glenn Moloney 
%
%   Released under the GNU Free Documentation License
%
%===========================================================================

% Colour online/PDF
% \documentclass[pdf,slideColor,colorBG,nototal,latex-seminar]{prosper}

% B&W version for printing
\documentclass[pdf,nototal,latex-seminar]{prosper}

% Packages:
\usepackage{graphicx}

%% Can't use the color package - as it conflicts with
%% pstricks color - but only under some conditions!
%% Prosper uses pstricks colour - so we will stick to that :-)
%%
%%\usepackage{color}

\usepackage{listings}
\usepackage{my-listings}

%%\hypersetup{pdfpagemode=FullScreen}

%---------------------------------------------------------------------------
% Macros
%---------------------------------------------------------------------------

%% tex commands
\newcommand{\tc}[1]{\lstinline[style=intex]=\\#1=}
\newcommand{\ct}[1]{\lstinline[style=typing]=#1=}

\ifcolorBG
\newcommand{\emphcolor}{\yellow}
\newcommand{\conceptcolor}{\green}
\newcommand{\exercisecolor}{\cyan}
\else
\newcommand{\emphcolor}{\blue}
\newcommand{\conceptcolor}{\blue}
\newcommand{\exercisecolor}{\blue}
\fi

%% A colourful \emph{} command
\let\oldemph=\emph
\renewcommand{\emph}[1]{\oldemph{\emphcolor{}#1}}

%% For highlighting ``concepts'' in the text
\newcommand{\concept}[1]{\emph{\conceptcolor{}#1}}

%% Use a standard colour for exercises.
\newcommand{\exercise}[1]{\textbf{\exercisecolor{}Exercise#1:}}

%---------------------------------------------------------------------------
% Title page
%---------------------------------------------------------------------------

% Title declarations:

\title{Introduction to \LaTeX{}: \\
  A Document Preparation System}
\subtitle{\small\green(Produced in \LaTeX)}
\author{\cyan Glenn Moloney and Gavin Baker}
%%\email{gavinb@cs.mu.oz.au}
\institution{\cyan The University of Melbourne}
\slideCaption{Intro to \LaTeX\ / University of Melbourne}
%%\displayVersion

\begin{document}

%% I didn't like the default titlepage, so I made my own as slide 1
%% :-)
%%
%% \maketitle

%---------------------------------------------------------------------------
% Title page
%---------------------------------------------------------------------------

% Title declarations:

\begin{slide}{}
  \mbox{}
  
  \vspace*{4ex}
  \begin{center}
    {\Large\emphcolor\bfseries
    Introduction to \LaTeX{}: \\ A Document Preparation System}
  
  \vspace{3ex}
  {\small\green (Produced in \LaTeX)}

  \vspace{3ex}
  {\small\cyan Glenn Moloney and Gavin Baker}

  \vspace{1.5ex}
  {\small\cyan The University of Melbourne}
  \end{center}
\end{slide}

%---------------------------------------------------------------------------
% Overview
%---------------------------------------------------------------------------
\begin{slide}{Overview}

This course will cover:
{
  \begin{itemize}
  \item How \LaTeX\ works
  \item Document classes and styles
  \item Chapters, sections, etc
  \item Lists: \concept{enumerated} and \concept{bulleted}
  \item Basic Mathematics, tables and graphics
  \item Running \LaTeX
  \item And more...
  \end{itemize}
}
\end{slide}

%---------------------------------------------------------------------------
% Sales Pitch
%---------------------------------------------------------------------------
\begin{slide}{\LaTeX{} in Action}

  \begin{itemize}
  \item \LaTeX{} can produce sophisticated documents
  \item Let's look at a demonstration document...
  \end{itemize}
  % Show wilde.tex here

\end{slide}

%---------------------------------------------------------------------------
% LaTeX Philosophy
%---------------------------------------------------------------------------
\begin{slide}{What is \LaTeX{}}
{
  \LaTeX{} is very good at:
  \begin{itemize}
  \item Mathematics
  \item Long documents (books and theses)
  \item Complex typesetting
  \item Tables and Graphics
  \item Separating content from stylistic considerations
  \item Managing bibliographies and internal cross-references
  \end{itemize}
  
  \LaTeX{} is not a \concept{WYSIWYG} word processor!
}
\end{slide}

%---------------------------------------------------------------------------
% Simplest Example
%---------------------------------------------------------------------------
\begin{slide}{The Simplest Example}
  \begin{itemize}
  \item \LaTeX() files are simple text files, that can be edited with any
    text editor:
  \item Special \emph{commands} are embedded in the text
    \end{itemize}
  
  \begin{texlisting}
    \documentclass{article}
    
    \begin{document}
    It was a dark and stormy night.
    The wind howled through the trees,
    and blew cold
    and lonely down the
    empty streets of the city.
    \end{document}
  \end{texlisting}
\end{slide}

%---------------------------------------------------------------------------
% Anatomy of a LaTeX Document
%---------------------------------------------------------------------------
\begin{slide}{Anatomy of a LaTeX Document}

  \begin{itemize}
  \item All documents have a \concept{preamble}...
  \item ...followed by a \concept{body}
  \item The preamble declares:
    \begin{itemize}
    \item document class
    \item other used packages
    \item more...
    \end{itemize}
  \item The \concept{body} is the actual content
  \end{itemize}

\end{slide}

%---------------------------------------------------------------------------
% Document Class
%---------------------------------------------------------------------------
\begin{slide}{Document Class}
  \small
  \begin{texlisting}
    \documentclass[options]{class}
  \end{texlisting}

  \begin{itemize}
  \item First command of any document - required
  \item Place at start of preamble
  \item Declares what sort of document we wish to create
  \item Determines the ``look'' or style of the document
  \item There are many useful predefined classes,  including:
    \begin{itemize}
    \item \emph{report, article, letter, book \ldots}
    \end{itemize}
  \item Options may be specified, such as {\tt a4paper}
  \end{itemize}

  \begin{texlisting}
    \documentclass[a4paper,twocolumn]{report}
  \end{texlisting}
\end{slide}

%---------------------------------------------------------------------------
\begin{slide}{Installing the \TeX{} Live! CD}

  \small
  \begin{itemize}
  \item Insert the CD, and wait for the \TeX{} Live! window
  \item From the menu, select:
    \begin{itemize}
    \item \ct{Install -> Editors -> WinShell}
    \end{itemize}
  \item Select \ct{Yes} then answer \ct{Next} to all the prompts
  \item At the \ct{Finish} window, \emph{deselect} the option to run
    WinShell at end of install
  \item From the \TeX{} Live menu, select:
    \begin{itemize}
    \item \ct{Explore -> Select Text Editor}
    \end{itemize}
  \item Browse to:
    \begin{itemize}
    \item \lstinline[style=typing]=C:\Program Files\WinShell\WinShell.exe=
    \end{itemize}
  \item Now the installation is complete
  \item To run \TeX{} Live!:
    \begin{itemize}
    \item \ct{Explore -> Run from CD} 
    \end{itemize}
  \end{itemize}
  
\end{slide}

%---------------------------------------------------------------------------
% Simplest Example
%---------------------------------------------------------------------------
\begin{slide}{The Simplest Example}
{
  \exercise{1}: Type in this file\ldots
  \vspace{2ex}
  
  \begin{texlisting}[gobble=4]
    \documentclass{article}
    
    \begin{document}
    It was a dark and stormy night.
    The wind howled through the trees,
    and blew cold
    and lonely down the
    empty streets of the city.
    \end{document}
  \end{texlisting}
  \vspace{2ex}
  
  \ldots and then \concept{process} it with \LaTeX{}
}
\end{slide}

%---------------------------------------------------------------------------
% Processor
%---------------------------------------------------------------------------
\begin{slide}{The \LaTeX{} Processor}

  \begin{itemize}
  \item The \LaTeX{} processor reads your .tex file...
  \item ...and produces a Device Independent file (.dvi)
  \item The dvi file can be viewed online, printed, converted...
  \end{itemize}

  How to \concept{process} your document:
  \begin{itemize}
  \item Press the \LaTeX{} button on your TeX Live! toolbar
  \item If there are no errors :-):
    \begin{itemize}
    \item Press the \concept{DVI} button on your TeX Live! toolbar
    \end{itemize}
  \end{itemize}
  

%%\verb=***Include diagram here***=
%\epsfig{file=process.eps}

\end{slide}

%---------------------------------------------------------------------------
% Running Text
%---------------------------------------------------------------------------
\begin{slide}{Running Text}
{
  \begin{itemize}
  \item Most documents consist almost entirely of \emph{running text}
  \item Running text consists of words, sentences, paragraphs
  \item Paragraphs separated by one or more blank lines
  \item Words are separated by one or more spaces
  \item Extra spaces are ignored
  \item Formatted according to document class (eg. margins, indentation, etc.)
  \end{itemize}
}
\end{slide}

%---------------------------------------------------------------------------
% Commands
%---------------------------------------------------------------------------
\begin{slide}{\LaTeX{} Commands}
{
  In \LaTeX{}, formatting is done with \concept{commands}:
  \begin{itemize}
  \item \LaTeX{} commands always start with a backslash {\emphcolor
  \verb=\= }
  \end{itemize}
  \begin{texlisting}
    I love \LaTeX{}.
    There were \textbf{many} solutions.
    \chapter{Methodology}
  \end{texlisting}
  \begin{itemize}
  \item Commands may have:
    \begin{itemize}
    \item \concept{Options} in square brackets: {\emphcolor [ ]}
    \item \concept{Arguments} in curly braces: {\emphcolor \{ \}}
    \end{itemize}
  \item Command names are case-sensitive
  \end{itemize}
}
\end{slide}

%---------------------------------------------------------------------------
% Special Characters
%---------------------------------------------------------------------------
\begin{slide}{Special Characters}
  \small

  \LaTeX{} gives special meaning to some characters:

  \begin{itemize}
  \item {\emphcolor{}\verb=\=} : backslash, begin a command
  \item {\emphcolor{}\{ \}} : braces, arguments to a command
  \item {\emphcolor{}\%} : percent, begin a comment
  \item {\emphcolor{}\#} : hash, macro parameters
  \item {\emphcolor{}\$} : dollar, begin/end math mode
  \item {\emphcolor{}\&} : ampersand, separate columns in tables
  \end{itemize}

  You should not use these symbols (without escaping them) in regular
  text.
\end{slide}

%---------------------------------------------------------------------------
% Comments
%---------------------------------------------------------------------------
\begin{slide}{Comments}

  \begin{itemize}
  \item Comments begin with a percent sign (\%) and continue to the
    end of the line.
  \item Comments are ignored by the \LaTeX\ processor
  \item Useful for notes, reminders, editorial markup, copyright notices, etc
  \end{itemize}
  
  \begin{texlisting}
    % NB: check the grammar of this paragraph!
    Wear did eye go, they said -- for I
    did right my Ed.
  \end{texlisting}

\end{slide}

%---------------------------------------------------------------------------
% Dashes
%---------------------------------------------------------------------------
\begin{slide}{Dashes}

  \begin{itemize}
  \item \LaTeX{} has support for several types of dashes; hyphenation,
    numerical ranges and sentence breaks:
  \end{itemize}
  \begin{Example}[\scriptsize]
    quasi-surreal \\
    See pages 23--42 \\
    Alas --- they vanished!
  \end{Example}
\end{slide}

%---------------------------------------------------------------------------
% Quotes
%---------------------------------------------------------------------------
\begin{slide}{Quotes}

  \begin{itemize}
  \item \LaTeX{} has support for proper quotes, both single and double.
  \end{itemize}
  \begin{Example}[\scriptsize]
    An `easy' task \\
    ``You're joking!''
    he cried.
  \end{Example}
\end{slide}

%---------------------------------------------------------------------------
% Installing TeXLive
%---------------------------------------------------------------------------
% Title Page
%---------------------------------------------------------------------------
\begin{slide}{Title Page}
  \begin{itemize}
  \item Call the \tc{maketitle} command to generate
  \item Declare the title, author and date
  \item Title styles depend on the document class
  \end{itemize}
  \begin{texlisting}
    \documentclass{book}
    \title{The Long Dark Winter}
    \author{Wilbur Hogglefarm}
    \date{14 July 1684}
    \begin{document}
    \maketitle
    \chapter{Summer closes}
    As the last rays of summer cast their long
    tendrils of warmth across the land...
  \end{texlisting}

\end{slide}

%---------------------------------------------------------------------------
% Document Structure
%---------------------------------------------------------------------------
\begin{slide}{Document Structure}
  \begin{itemize}
  \item \LaTeX{} is especially good for structured documents.
    \begin{itemize}
    \item \tc{chapter}
    \item \tc{section}
    \item \tc{subsection}
    \item \tc{subsubsection} ...
    \end{itemize}
  \end{itemize}
  \begin{texlisting}
    \section{Maintenance}
    This section describes the maintenace
    procedures for your vehicle.
    
    \subsection{Lubrication}
    The oil should be topped up on a
    regular basis...
  \end{texlisting}
\end{slide}

%---------------------------------------------------------------------------
% Table of Contents
%---------------------------------------------------------------------------
\begin{slide}{Table of Contents}

  \begin{itemize}
  \item Use the \tc{tableofcontents} command
  \item Any sectioning commands will be included
  \item Document class determines TOC style
  \item This requires running the \LaTeX{} processor twice
  \item Why? To resolve forward page references...
  \end{itemize}

\end{slide}

%---------------------------------------------------------------------------
% Environments
%---------------------------------------------------------------------------
\begin{slide}{Environments}
  \begin{itemize}
  \item Frequently need to typeset blocks of text
  \item Quotations, lists, foreign languages, theorems etc
  \item All environments have the form:
  \end{itemize}

  \begin{texlisting}
    \begin[options]{environment}
      content...
    \end{environment}
  \end{texlisting}

\end{slide}

%---------------------------------------------------------------------------
% Quotation
%---------------------------------------------------------------------------
\begin{slide}{Quotation}
{\small
  \begin{Example}
    Nelson Mandela, in his inaugural speech, said:
    \begin{quote}
      Our worst fear is not that we are inadequate. Our deepest fear
      is that we are powerful beyond measure.
      
      It is our Light, not our darkness that most frightens us. We ask
      ourselves, ``Who am I to be brilliant, gorgeous, talented and
      fabulous?'' Actually, who are you not to be.
    \end{quote}
  \end{Example}
}
\end{slide}

%---------------------------------------------------------------------------
% Center
%---------------------------------------------------------------------------
\begin{slide}{Center}
  \begin{Example}
    On the cover of the book, in large friendly
    letters, read:
    \begin{center}
      Don't Panic!
    \end{center}
    Ford was most perplexed by this.  He decided
    to panic anyway.
  \end{Example}
\end{slide}

%---------------------------------------------------------------------------
% Lists
%---------------------------------------------------------------------------
\begin{slide}{Lists}

  \begin{itemize}
  \item Several types of lists are available:

    \begin{itemize}
    \item itemize: bulleted lists
    \item enumerate: numbered lists
    \end{itemize}

  \item Lists can be ``nested'', to produce a hierarchy
  \item They are bracketed with \tc{begin\{\}} and 
    \tc{end\{\}} commands
  \item Each point is introduced with the \tc{item} command
  \end{itemize}

\end{slide}

%---------------------------------------------------------------------------
% Lists Example
%---------------------------------------------------------------------------
\begin{slide}{Lists Example}
  \begin{Example}
    \begin{enumerate}
      \item Itemized lists are very useful
      \item But don't forget that:
        \begin{itemize}
        \item Enumerated lists are handy
        \item Lists can be nested too
        \end{itemize}
      \item Lists are easy to create
    \end{enumerate}
  \end{Example}
\end{slide}

%---------------------------------------------------------------------------
% Symbols
%---------------------------------------------------------------------------
\begin{slide}{Symbols}
  \begin{itemize}
  \item A massive library of symbols is available
  \item Over 2,500 are documented in the symbol reference
  \item Simply put the appropriate \tc{usepackage}
    in the preamble...
  \item ...then insert the symbol by name (eg. \tc{suitclubs})
    where you need it
  \end{itemize}
  \begin{center}
    \dag\ \S\ \P\ \copyright\ \pounds\ \ldots\ \AA\ $\aleph$
  \end{center}
\end{slide}

%---------------------------------------------------------------------------
% Font Styles
%---------------------------------------------------------------------------
\begin{slide}{Font Styles}
{\small
  \begin{Example}
    We can use \textbf{bold text}, or we can
    use \textit{italicised text} for extra
    emphasis.  For special terms, there is
    \textsc{Small Capitals}.  An alternative
    to italic emphasis is the \textsl{slanted text}.
  \end{Example}
}
\end{slide}

%---------------------------------------------------------------------------
% Font Sizes
%---------------------------------------------------------------------------
\begin{slide}{Font Sizes}

  \begin{Example}[\scriptsize]
    {\tiny tiny} \\
    {\small small} \\
    {\normalsize normalsize} \\ 
    {\large large} \\
    {\Large Large} \\
    {\LARGE LARGE} \\
    {\Huge Huge}
  \end{Example}

\end{slide}

%---------------------------------------------------------------------------
% Font Faces
%---------------------------------------------------------------------------
\begin{slide}{Font Faces}
{
  \begin{Example}
    The three basic font families are the
    \textrm{roman family}, \textsf{sans serif},
    and \texttt{typewriter}.  Many more fonts
    are available, as we will see in the next
    course.
  \end{Example}
}
\end{slide}

%---------------------------------------------------------------------------
% Simple Mathematics
%---------------------------------------------------------------------------
\begin{slide}{Simple Mathematics}
{
  \begin{Example}
    $360^\circ$ is equivalent to $2\pi$ radians 
  \end{Example}
  
  \begin{Example}
    \begin{eqnarray}
      x^2 + y^2 = 1 \\
      f(x) = \sum_{i=0}^{\infty}\frac{f^{(i)}(x)}{i!}
    \end{eqnarray}
  \end{Example}
}
\end{slide}

%---------------------------------------------------------------------------
% Simple LOTE
%---------------------------------------------------------------------------
\begin{slide}{Simple LOTE}
  
  \LaTeX{} has support for many languages. For example:
  \begin{Example}
    \textbf{French}: J'ai trouv\'{e} l'H\^{o}tel
      de Ville; plus \c{c}a change! \\
    \textbf{German:} Die Stra{\ss}e war besch\"aftigt,
      also ich w\"ohlte einige Blumen aus. \\
    \textbf{Esperanto:} Mi \^san\^gis la musiko,
      kar \^gi ne estis bona.
  \end{Example}
\end{slide}

%---------------------------------------------------------------------------
% Simple Table
%---------------------------------------------------------------------------
\begin{slide}{Tables}
  \begin{Example}
    \begin{tabular}{|r|l|c|}\hline
      First Name & Surname & Department \\
      \hline
      Glenn  & Moloney & Computer Science \\
      Gavin  & Baker   & Physics          \\
      Angela & Gehrig  & Library          \\
      \hline
    \end{tabular}
  \end{Example}
\end{slide}

\begin{slide}{Moving on\ldots}

  You can learn more about LaTeX from:
  \begin{itemize}
  \item \LaTeX{} A Document Preparation System, \emph{Leslie Lamport}
  \item The \emph{intermediate} \LaTeX{} session:
  \begin{itemize}
    \item Bibliographics, Mathematics, Tables, Cross-references, \ldots
  \end{itemize}
  \end{itemize}

  \vspace{3ex}
  \centerline{\Large\emphcolor Happy \LaTeX{}ing}

\end{slide}
%===========================================================================

\end{document}
