% This file began as the "generic-ornate-15min-45min.en.tex" template
% file in the Beamer distribution. I highly recommend using Beamer for
% your talks; it is very well-designed, powerful, and yet pretty easy to
% use. 
%
% Read about Beamer at http://en.wikipedia.org/wiki/Beamer_(LaTeX) .
% There is lots of information on the web about using Beamer.
%
% I also don't claim that all my code is the best way to do things!
%
% --Dan Drake 
% email:  python -c "print '.'.join(['ddrake@member', 'ams', 'org'])"
%
% This work is licensed under a Creative Commons Attribution-Share Alike
% 3.0 Unported License: http://creativecommons.org/licenses/by-sa/3.0/

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\mode<presentation>
{
  \usetheme{Boadilla}
  \setbeamercovered{transparent}
}

\usepackage{times}
\usepackage[T1]{fontenc}

% The default Courier typewriter font looks bad, this is much better.
% You can find out more such fonts from the LaTeX Font Catalogue:
% http://www.tug.dk/FontCatalogue/
\usepackage[scaled]{beramono}

\title[Graphics tools \& \LaTeX{} 1]{Tools for Getting Graphics Into \LaTeX}
\subtitle{Part \texorpdfstring{$1$}{1}}

% The \texorpdfstring is used when making PDFs. In a PDF, you can really
% only use simple text for the section names and so on. But in TeX, you
% can have fancy stuff like "\section{The \sqrt{a + b} problem}".
% \texorpdfstring outputs TeX when it should and a "PDF string" when it
% should. You need to use this when running pdflatex complains about
% "Token not allowed in a PDFDocEncoded string".
%
% As it turns out, I don't think I need to do this for simple math-mode
% numbers, but it can't hurt.

\author{Dan Drake}

% The template file mentions that you can add a logo (look for the
% "university-logo" stuff) but that doesn't seem to actually do
% anything. This works and looks relatively nice.
\institute[KAIST]{\includegraphics[scale=.2]{kaist}\\Korea Advanced
Institute of Science and Technology}

\date{13 August 2008 / Sage Days 9}

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

\begin{document}

\begin{frame}
  \titlepage

\end{frame}

\begin{frame}{Outline}
  \tableofcontents[pausesections]
\end{frame}

\section{Introduction}

\begin{frame}{Before we get started\ldots}

  Tomorrow I'll talk more about specific pieces of software.

  Try to think of questions like:

  \begin{itemize}
    \item What's a good way to make graphics like X / for Y?
    \item Is graphics program X good for use with \LaTeX?
  \end{itemize}

  I will take questions at the end and answer them tomorrow. (Or maybe
  today.)
\end{frame}

\begin{frame}{How does \TeX{} handle graphics?}

  \begin{itemize}
    \item It doesn't.
      \pause
    \item \TeX{} uses the \texttt{\textbackslash special} macro to put
      magic bits in the output file.
      \pause
    \item Vaguely similar to putting images on web pages with an
      \texttt{img} tag.
  \end{itemize}
      \pause

  You needn't ever worry about this, but in the bad old days, one had to
  select the proper ``driver''.
  
\end{frame}

\begin{frame}{Admission of biases}{(and level of knowledge)}

  \begin{center}
  \visible<1->{
    \includegraphics[height=2.5cm]{tux}}
  \visible<2->{
    \raisebox{1cm}{\resizebox{!}{1cm}{$>$}}
    \includegraphics[height=2.5cm]{apple_logo}}
  \visible<3->{
    \raisebox{1cm}{\resizebox{!}{1cm}{$\gg$}}
    \includegraphics[height=2.5cm]{windows_logo}}
  \end{center}

\end{frame}

\begin{frame}{Two basic strategies}
  Two basic strategies for getting graphics into \LaTeX:

  \begin{description}
    \item[Strategy $1$] use \LaTeX{} itself
    \item[Strategy $i$] use something else
  \end{description}
\end{frame}

\section{Strategy \texorpdfstring{$i$}{\emph{i}}}

\begin{frame}{Strategy \texorpdfstring{$i$}{\emph{i}}: use something
  else to create the graphics}
  \begin{center}
    \begin{tikzpicture}[decoration=snake]
      \node[circle, fill=gray, decorate, inner sep=5mm, text=white]
        (void) at (0, 0) {\textbf{the void}};

      \node[draw, text width=35mm, text centered]
        (ps) at (6, 0) {Postscript family: EPS, PS, PDF};

      \draw[->, thick] (void) -- (ps) node [midway, above] {whatever};
    \end{tikzpicture}
  \end{center}

  \begin{itemize}
    \item Using \texttt{latex} to make a DVI file: only EPS files
    \item Using \texttt{pdflatex} to make PDFs: PDF files, as well as
      JPG and PNG.
  \end{itemize}
\end{frame}

\begin{frame}{Use ``Postscript family'' formats whenever possible}
  \begin{itemize}
    \item Vector graphics are much better for mathematical/scientific
      graphics
    \pause

  \item The \TeX{} ecosystem is well-adapted to the Postscript family
    \pause

  \item Conversion between EPS, PS, PDF is usually quite easy.

  \end{itemize}

\end{frame}

\begin{frame}{Aside: leave off extension when includegraphics'ing}

  A tip:
  \begin{itemize}
    \item When using \texttt{\textbackslash includegraphics}, don't add
    the file extension; \texttt{latex} and \texttt{pdflatex} automatically
    look for EPS and PDF files, resp.
    \pause
    \item Do \texttt{\textbackslash includegraphics\{foo\}}, keep
    \texttt{foo.eps} and \texttt{foo.pdf} around. (Use \texttt{epstopdf}
    if necessary.)
  \end{itemize}
\end{frame}

\begin{frame}{Another aside:}

  From Wikipedia's article on ``Vector graphics'': ``One of the first
  uses of vector graphic displays was the \textcolor{blue}{US SAGE air
  defense system}.''

  \pause

  \begin{quote}
  SAGE, the Semi-Automatic Ground Environment, was an automated control
  system for tracking and intercepting enemy bomber aircraft used by
  NORAD from the late 1950s into the 1980s. [\ldots]

  By the time it was fully operational the Soviet bomber threat had been
  replaced by the Soviet missile threat, for which SAGE was entirely
  inadequate. \pause Nevertheless, SAGE was tremendously important; it
  led to huge advances in online systems \pause and interactive
  computing, \pause real-time computing, \pause and data communications
  using modems. \pause It is generally considered to be one of the most
  advanced and successful large computer systems ever developed.
  \end{quote}

\end{frame}


\section{Strategy \texorpdfstring{$1$}{1}}


\begin{frame}{Strategy \texorpdfstring{$1$}{1}: use \LaTeX{}
  to create the graphics}

  \visible<1-> { This uses packages that use \TeX{} or \LaTeX{} to
    insert graphics directly.}

  \visible<2-> {
  \begin{center}
  \tikzstyle{every path}=[very thick]
  \begin{tikzpicture}[scale=3]

      \draw (-.1, 0) -- (1.1, 0);

      \draw[->] (0, -.1) -- (0, 1.1) node[above] {frequency};

      % You can plot pretty complicated functions just in TikZ, even
      % though it's doing all the math with TeX, which has relatively
      % poor math abilities 
      \draw[domain=0:1, variable=\t, smooth]
        plot (\t, {(1 - \t/2)*cos(3.1416 * \t r)^8});

      \draw (0,0) node[anchor=north west] {lame};
      \draw (1,0) node[anchor=north]      {awesome};

  \end{tikzpicture}
  \end{center}
  }
  \visible<3->{Unfortunately, awesomeness is strongly correlated with
  being difficult to use.}

\end{frame}

\begin{frame}{Big advantage: \TeX{} does the text!}
  Using \TeX{} means \emph{text in the graphics matches the rest of the
  article.} 

  \pause

  \begin{itemize}
    \item can do math properly
    \pause
    \item matching typeface gives visual and logical consistency
    \pause
  \end{itemize}

  \pause
  Two slogans from book titles:

  \begin{itemize}
  \item don't click the black T
  \pause
  \item write like you give a damn
  \end{itemize}

\end{frame}

\begin{frame}{How to combine strategies \texorpdfstring{$1$}{1} and
\texorpdfstring{$i$}{\emph{i}}?}

  \visible<1->{We need strategy \ldots }\visible<2->{$1+i$\ !

  Use something external to create the graphics, and use \TeX{} to
  create and place the text.}

  \visible<3->{Ways to do this:}
  \begin{itemize}
    \item<4-> Overlay a \texttt{picture} environment over the graphics
    (\texttt{xfig, overpic, psfrag})
    \item<5-> Render text as paths (PiScript, Inkscape, \emph{et al.})
  \end{itemize}

\end{frame}

\begin{frame}{Interlude}
  A disclaimer/cautionary tale/admission of hypocrisy\ldots
\end{frame}

\section{Wrap up}

\begin{frame}{Colophon}{A note about the graphics}

  What's a colophon? Quoth Wikipedia:

  \begin{quote}
    A brief description usually located at the end of a book, describing
    production notes relevant to the edition. In most cases it is a
    description of the text typography, often entitled ``A note
    about the type''.
  \end{quote}

  What about the graphics used in these slides?

\end{frame}

\begin{frame}{About the graphics in these slides}
  \begin{itemize}
    \item KAIST logo: downloaded an Adobe Illustrator file from KAIST
      website; used Inkscape to save as PDF.
    \item Windows and Apple logos: JPGs off the web, cropped in the
      GIMP.
    \item Tux: from the SVG file at Wikipedia, used Inkscape to convert
      to PDF. Tux SVG \copyright Larry Ewing, Simon Budig, Anja Gerwinski.
    \item Other graphics: Ti\emph{k}Z
  \end{itemize}
  
\end{frame}

\begin{frame}{Thank you}

  \begin{center}
    Tomorrow: gritty details
  \end{center}

  \vfill

  These slides (source and PDF) will be available from the Sage Days 9
  wiki page, and \href{http://wiki.sagemath.org/DanDrake/Days9Talks}
  {\texttt{wiki.sagemath.org/DanDrake/Days9Talks}}

\end{frame}

\end{document}
