% Beamer example file for Physical Mathematics I
% Ewan Stewart
% KAIST
% 2011/9/2

\documentclass{beamer} % Beamer formats the whole document and so must be loaded as a document class, not an add on package.

\usepackage{tikz} % PGF is recommended for figures.
\tikzset{every picture/.style=remember picture} % Allows tikzpictures to refer to other tikzpictures.

\newcommand<>{\textnode}[2]{%
\begin{tikzpicture}[baseline=(#1.base)]
\onslide#3{\node(#1)[inner sep=0pt,outer sep=0pt]{#2};}
\end{tikzpicture}%
}
% Defines the command "\textnode<overlay specification #3>{compulsary argument #1}{compulsary argument #2}" to be a tikzpicture consisting of a node, labelled by its first compulsary argument "#1", with text given by its second compulsary argument "#2", visible on slides determined by its overlay specification "#3".
% The "%" signs avoid the addition of extra space, arising from the cursor return, before or after the tikzpicture.
% The tikzpicture option "baseline=(#1.base)" vertically aligns the tikzpicture such that the external text baseline matches the base of the text in the node "#1".
% The node options "inner sep=0pt,outer sep=0pt" ensure no extra surrounding space.
% The purpose of this command is to set up a node ready to be acted on by another command such as "\textcrossout" or "\textreplace" below.

\newcommand<>{\textcrossout}[2][]{
\begin{tikzpicture}[overlay]
\usebeamercolor[fg]{alerted text}
\draw#3[thick,fg] (#2.mid west) to (#2.mid east);
\node#3[above,fg] at (#2) {#1};
\end{tikzpicture}
}
% Defines the command "\textcrossout<overlay specification #3>[optional argument #1]{compulsary argument #2}" to be a tikzpicture which modifies the external node referred to by the compulsary argument "#2", on slides determined by the overlay specification "#3".
% The tikzpicture option "overlay" ensures that the modification does not affect the layout.
% The command "\usebeamercolor[fg]{alerted text}" defines the color "fg" to be the color of "alerted text". Using Beamer colors like this helps to make the color scheme more consistent.
% The external node text is crossed out, in thick fg color horizontally through the middle of the text, and is optionally replaced above in fg color by the text of the first optional argument "#1".

\newcommand<>{\textreplace}[2]{
\begin{tikzpicture}[overlay]
\usebeamercolor[fg]{alerted text}
\node#3[fg] at (#1) {#2};
\end{tikzpicture}
}
% Defines the command "\textreplace<overlay specification #3>{compulsary argument #1}{compulsary argument #2}" to be a tikzpicture containing a node, placed at the position of the external node referred to by its first compulsary argument "#1", with text given by its second compulsary argument "#2", on slides determined by its overlay specification "#3".
% The tikzpicture option "overlay" ensures that the new node does not affect the layout.
% The command "\usebeamercolor[fg]{alerted text}" defines the color "fg" to be the color of "alerted text". Using Beamer colors like this helps to make the color scheme more consistent.


\title{Beaming}
\author{Ewan Stewart}
\institute{KAIST}
\date{Physical Mathematics I \\ Fall \number\year}
% Information is entered logically and used appropriately by LaTeX.

\begin{document} % The content of a Beamer document consists of a series of frames organized in sections and subsections.

\begin{frame} % A frame may contain many slides generated by overlay specifications "<slide numbers>".
\titlepage % Generated from the information entered in the preamble.
\end{frame}

\begin{frame}
\tableofcontents % Generated from the "\section" and "\subsection" commands.
\end{frame}

\section{Why Beamer?}

\subsection{Documents}

\begin{frame}{Documents}

For documents \textnode{most1}{most} people use \textnode{word}{Word}.
\onslide<2>{But
\begin{displaymath}
\text{\LaTeX} \gg \text{Word}
\end{displaymath}
}
\textcrossout<4->[smart]{most1}
\textcrossout<5>[\LaTeX]{word}

\end{frame}

\subsection{Talks}

\begin{frame}{Talks}

For talks \textnode<1-3>{most2}{most} people use \textnode<1-4>{powerpoint}{Powerpoint}.
\onslide<2>{But
\begin{displaymath}
\text{Beamer} \gg \text{Powerpoint}
\end{displaymath}
}
\textreplace<4->{most2}{smart}
\textreplace<5>{powerpoint}{\LaTeX}

\end{frame}

\end{document}

