% This is a demonstration file distributed with the
% Lecturer package (see lecturer-doc.pdf).
%
% You can recompile the file with a basic TeX implementation,
% using pdfTeX or LuaTeX with the plain format.
% 
% The reusable part ends somewhere around line 300.
%
% Author: Paul Isambert.
% Date: July 2010. 

\input lecturer

\font\maintitlefont  = cmdunh10 at 23pt
\font\slidetitlefont = cmss12   at 20pt
\font\subtitlefont   = cmss10
\font\titlefont      = cmssi10

\newcolor{darkred}{rgb}{.6 0 0}
\newcolor{lightgrey}{grey}{.85}
\newcolor{darkgrey}{grey}{.7}

\setparameter job:
  mode           = presentation % The handout is ready, just turn it on.
  author         = "Pete Agoras"
  title          = "The square root of 2 ain't rational"
  date           = "Some centuries B.C."
  fullscreen     = true
  autofullscreen = true
  font           = \tenrm % Plain TeX's default, but must be specified
                          % to set it back after a \step with another font.
  
\setparameter slide:
  everyslide    = \everyslide
  hsize         = ".6\pdfpagewidth"
  top           = 76pt
  bottom        = 42pt
  areas*        = "title author date"
  bookmarkstyle = italic
  baselineskip  = 12pt
  topskip       = \baselineskip

\def\everyslide{%
  \position{topleft}\Title
  \position{topright}\sectiontitle
  \position{titlebar}\slidetitle
  \position{bottomleft}\Author
  \position{bottommiddle}{%
    \noindent
    \dobutton\firstslide\FirstPage
    \dobutton\prevslide\PrevPage
    \dobutton\prevstep\PrevStep\kern.3em
    \dobutton\showbookmarks\Bookmarks\kern.3em
    \dobutton\nextstep\NextStep
    \dobutton\nextslide\NextPage
    \dobutton\lastslide\LastPage\unskip}
  \position{bottomright}\Date
  \presentationonly{
    \position{math}{%
      ${a\over b}=\sqrt2$\par
      $({a\over b})^2=2$\par
      ${a^2\over b^2}=2$\par
      $a^2=2b^2$\par
      $(2k)^2=2b^2$\par
      $4k^2=2b^2$\par
      $2k^2=b^2$\par
      ${a\over b}\neq\sqrt2$}}
  }
\def\dobutton#1#2{%
  #1[push]{\rlap#2\buttonborder}\hskip1em
   }

%
% Top and bottom bars.
% 

\setarea{topleft topright bottomleft bottommiddle bottomright}
  height = 18pt

\setarea{topleft bottomleft}
  background = darkred
  foreground = white
  
\setarea{topright bottomright}
  background = darkgrey
  foreground = darkred

\setarea{topright bottomleft bottomright}
  font = \subtitlefont

\setarea{topleft topright}
  width      = ".5\pdfpagewidth"
  right left = 1em

\setarea{bottomleft bottommiddle bottomright}
  vshift* = 0pt
  width   = "\pdfpagewidth/3"
  hpos    = rr

\setarea{topleft}
  hpos       = rf
  font       = \titlefont

\setarea{topright}
  hshift* = 0pt
  hpos    = fr
    
\setarea{titlebar}
  vshift     = 18pt
  left       = 1em
  height     = 40pt
  background = lightgrey
  foreground = darkred
  topskip    = 30pt
  hpos       = fr
  font       = \slidetitlefont

% bottomleft is already fully specified.
  
\setarea{bottommiddle}
  hshift     = "\pdfpagewidth/3"
  topskip    = "\symbolheight\buttonborder+3pt"
  background = lightgrey
  foreground = white
  
\setarea{bottomright}
  hshift* = 0pt

%
% The maths on the right.
%
\setarea{math}
  width      = ".2\pdfpagewidth"
  hshift*    = 0pt
  vshift     = 58pt
  vshift*    = 18pt
  foreground = "grey .75"
  hpos       = fr
  vpos       = center
  baselineskip = 18pt


%
% The title slide.
%
\setslide{titleslide}
  areas      = "title author date topleft topright"
  bookmark   = false
  hpos       = rr
  everyslide = {}

\setarea{title}
  hshift*    = 1cm
  vshift     = 2.5cm
  height     = 45pt
  topskip    = 25pt
  background = darkred
  foreground = white
  top        = 1em
  frame      = "width=.2em, corner=round, color=darkgrey"
  hpos       = rr
  font       = \maintitlefont

\setarea{author}
  hshift*    = 5cm
  vshift     = 6cm
  height     = 28pt
  topskip    = 20pt
  background = lightgrey
  foreground = white
  frame      = "width=.5em, corner=round"
  hpos       = rr
  font       = \slidetitlefont
  
\setarea{date}
  hshift*    = 5.5cm
  vshift     = 9cm
  height     = 22pt
  topskip    = 10pt
  background = white
  foreground = black
  top        = 5pt
  frame      = "width=.5em, corner=bevel, color=lightgrey"
  hpos       = rr


%
% For the appendices.
% We remove the math area instead
% of redefining \everyslide.
%
\setslide{appslide}
  areas* = "math title author date"

%
% Default step.
%
\setparameter step:
  everyvstep = "\quitvmode\llap{\itemsymbol\kern.5em}"
  vskip = 18pt

%
% Foreground math.
%
\setstep\emptystep
  everyvstep everyhstep = {}
  vskip hskip = 0pt

\def\domath#1 #2 #3 {%
  \emptystep[on=#2,off=#3]
  \domathstep{#1}%
  }
\def\Domath#1 #2 {%
  \emptystep[off=#2,visible=true]
  \domathstep{#1}%
  }
\def\domathstep#1{%
  \presentationorhandout{\position{math}[0pt,#1\dimexpr18pt\relax]}{\position{math}}
    {\quitvmode\llap{\mathsym\kern.3em}\usecolor{black}{\typemath{#1}}}%
  }

\def\typemath#1{%
  $\ifcase#1
      {a\over b}=\sqrt2
  \or ({a\over b})^2=2
  \or {a^2\over b^2}=2
  \or a^2=2b^2
  \or (2k)^2=2b^2
  \or 4k^2=2b^2
  \or 2k^2=b^2
  \or {a\over b}\neq\sqrt2
  \fi$}
%
% Navigation symbols.
%
\newcolor{button}{grey}{.95}
\newcolor{darkbutton}{grey}{.68}
\newsymbol\buttonborder[.7pt]
  {color button,
   + 0 16, + 16 0, stroke,
   color darkbutton,
   move 0 0, + 16 0, + 0 16
   }  
\newsymbol\NextStep[.7pt]
  {move 3 3,
   + 10 5,+ -10 5,
   }
\newsymbol\PrevStep[.7pt]
  {move 3 3,
   move + 10 0, + -10 5,+ 10 5,
   }
\newsymbol\NextPage[.7pt]
  {move 3 3,
   + 10 5,+ -10 5, close,
   }
\newsymbol\PrevPage[.7pt]
  {move 3 3,
   move + 10 0, + -10 5,+ 10 5, close,
   }
\newsymbol\LastPage[.7pt]
  {move 3 3,
   + 10 5,+ -10 5, close,
   move 3 3,
   move + 10 0, + 0 10,
   }
\newsymbol\FirstPage[.7pt]
  {move 3 3,
   move + 10 0, + -10 5, + 10 5, close,
   move 3 3, + 0 10,
   }
\newsymbol\Bookmarks[.7pt]
  {move 3 3,
   move + 0 1, + 10 0,
   move 3 3,
   move + 0 5, + 10 0,
   move 3 3,
   move + 0 9, + 10 0,
  }
%
% Item symbols.
%
\newsymbol\itemsymbol[.6em,padding=0pt]
  {color darkred, + 1 0, + 0 1, + -1 0, fill,}
\newsymbol\mathsym[.5em,padding=0pt]
  {color darkred, 
  + 1 .5, + -1 .5, fill,}
\newsymbol\backsym[.5em,padding=0pt]
  {color darkred, move 1 0, + -1 .5, + 1 .5, fill,}
%
% Navigation to the appendices.
%
\def\Back#1{%
  \presentationonly{\usecolor{darkred}{\gotoB{#1}{\subtitlefont\backsym\kern.3em Back}}}%
  }
\def\To#1{%
  \presentationorhandout{\usecolor{darkred}{\gotoA{#1}{\subtitlefont\mathsym\kern.3em See why}}}
    {{\usecolor{darkred}{\subtitlefont\mathsym\kern.3em(See Appendices)}}}%
  }
%
% And some structure.
%
\def\section#1{%
  \def\sectiontitle{#1}%
  \createbookmark[nosubmenutext,open]{.5}{#1}%
  }


% \endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                             %
% UNCOMMENT THE PREVIOUS LINE TO USE THIS FILE AS A TEMPLATE, %
% OR REMOVE EVERYTHING BELOW.                                 %
%                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\titleslide

\position{title}\Title
\position{author}[0cm,-1.7cm]{\it\usecolor{black}{A Casual Talk By}}
\position{author}\Author
\position{date}\Date

\endtitleslide





\section{Demonstration}

\slide[A simple assumption]

\domath0 A B
\domath1 B C
\domath2 C D
\domath3 D {}

\step Some say the square root of 2 isn't rational.
\step Suppose it were.

\step[A] Then we could write it as this, where $a$ and $b$ are
integers without a common factor.
\To{app1}

\step[B] But then we can also write this.
\step[C] And this.
\step[D] And finally this.
\step Which means that $a^2$ is even.

\endslide



\slide[Its consequences]

\Domath3   A  
\domath4 A B
\domath5 B C
\domath6 C D

\step[visible="true"] So what?
\step So $a$ is even. Because only even numbers produce even squares.
\To{app2}

\step[A] Being even means being expressible in the form $2k$, where $k$ is
any integer.
\step[B] And $(2k)^2$ square gives $4k^2$.

\step[C] Let's simplify.
\step Thus $b^2$ is even.
\step And $b$ is too.

\endslide



\slide[The problem]

\domath7 A {}

\step[visible=true] And but so we said $a$ and $b$ have no common factor.

\step If both are even they do have a common factor: 2.
\step Which is absurd.

\step Thus, our basic assumption is false.
\step[A] There are no such $a$ and $b$.

\step The square root of 2 is irrational.
\step Too bad.

\endslide





\section{Appendices}



\appslide[All fractions are reducible]


\step[visible=true]
Suppose $c\over d$ is a rational number. If c and d have no common
factor, then $a=b$ and $b=d$. If they have a common factor,
divide both by their greatest common divisor. The result
is $a\over b$, with no common factor.

\vskip\baselineskip
\Back{app1}

\endappslide



\appslide[An even square has an even root,scale=true]

\step[visible=true]
An even number, by definition, is expressible
in the form $2k$, where $k$ is any integer.
On the other hand, an odd number is expressible
by $$2k+1$$
Thus the square of an odd number is
$$(2k+1)^2$$
i.e. $$4k^2+4k+1$$
i.e. $$2\times2(k^2+k)+1$$
which is of the form $2k+1$
with $2(k^2+k)$ as $k$.
Hence, an odd number produces an odd square,
and thus if a square is even its root is even too.

\vskip\baselineskip
\Back{app2}

\step[visible=true,font=\it] You might have noticed
that this page is slightly scaled to accommodate
its content to the slide's declared {\tt\usecolor{darkred}{vsize}}
parameter. Actually, it is scaled because I stretch this
paragraph so as to have too much content. Which is kind
of paradoxical. Or just opportunistic.

\endappslide

\bye



