%% TODO beamerequations: olabel defined for normal case

%% TODO: exercises,
%% further stuff
%%
%% see in beamerequations:
%% why color
%% why numbers

%%TODO: ORDINARE QUESTE OPZIONI
%%
%%
%% rm mynotex.aux *.aux when changing from article to presentation
%\def\doarticle{1}
%%
%%
%%
%
%\def\dohandout{1}
%\def\twoonone{yes} %two pages on one in handout mode if defined
%\def\pgfpagesstep{yes} %uncomment ONLY ON LAST LATEX STEP 
                       %if you want to resize pages in handout
%%TODO: do this automatically
%%
% NO GOOD alternative with psnup:
%->[psnup -Pa5 -pa4 -2]-> xxx-slide-handout.ps ->[ps2pdf14
%-dPDFsettings=/prepress]-> xxx-slide-handout.pdf
% or pdfnup
%% see: http://nicku.org/teaching-template-system-source/beamer-slides-setup.txt
%%NO GOOD pdfnup --nup 1x2 --frame true --orient auto --paper a4paper --outfile tmp.pdf mynotes.pdf


%%CHOOSE
%%\let\nopopup=1\def\dopopeq{0} %%%%  no popup
%%does not work with beamerequations yet %%
\def\dopopeq{1}
\def\nonumeq{1} %% no numbers in popup equations

%%CHOOSE
%\def\dodebug{1}\def\dopopeq{0}
%\def\dodebug{0}


%% comment out if for students
\def\formeonly{yes}
%
%
%%FOR ARTICLE MODE
\ifx\doarticle\undefined\else
\let\nopopup=1\def\dopopeq{0}\def\nonumeq{0}\def\dodebug{1} 
\fi
%%
\ifx\dohandout\undefined\else
\let\nopopup=1\def\dopopeq{0}\def\nonumeq{0}\def\dodebug{1} 
\fi
%

%%see how to do sec-appendix

%%
%\def\doonlychap{\includeonly{}}
%\def\doonlychap{\includeonly{sec-title-intro}}
%\def\doonlychap{\includeonly{sec-failures}}
%\def\doonlychap{\includeonly{sec-wavepart}}
%\def\doonlychap{\includeonly{sec-bohr}}
%\def\doonlychap{\includeonly{sec-wavefun}}
\def\doonlychap{\includeonly{sec-qmsimple}} 
%\def\doonlychap{\includeonly{sec-principles}} 
%\def\doonlychap{\includeonly{sec-angular}} 
%\def\doonlychap{\includeonly{sec-hatom}} 
%\def\doonlychap{\includeonly{sec-appendix}}
%\def\doonlychap{\includeonly{sec-failures,sec-appendix}}


%%sec-title-intro,sec-failures,sec-wavepart,sec-bohr,sec-wavefun,sec-qmsimple

%%\renewcommand{\theequation}{

\ifx\dohandout\undefined
\ifnum\dopopeq>0
%%CHOOSE
%% process with 
%% popupequations.sh mynotes.tex
%% sistemare llabel, vedi beamerequations
\input popupequations.pre
%%%%\ddocumentclass[t,hyperref={plainpages=false,pdfpagelabels}]{beamer}
\ddocumentclass[t]{beamer}
%\ddocumentclass[a4paper]{article}\usepackage{beamerarticle}
%\ddocumentclass[trans,t]{beamer}
\usepackage{popupequations}
%
\usepackage[usepopupequations]{beamerequations}
\else
%%IF NO POPUPEQUATIONS
%% for debugging
     \ifnum\dodebug>0
     \documentclass[12pt]{article}\usepackage{beamerarticle}\usepackage{hyperref}
\usepackage{showlabelsmy}
     \else
\documentclass[t]{beamer}
\fi
\usepackage{beamerequations}
%%END IF NO POPUPEQUATIONS
\fi
\else
\documentclass[t,handout]{beamer}
\usepackage{beamerequations}
\fi


\usepackage{talk-beamer}

%%\usepackage{amsmath}
%% for equation numbers sec.num
\numberwithin{equation}{section}


%\ifx\dohandout\undefined\else
%%%NO GOOD
%\renewcommand<>{\frame}[1]{\beameroriginal{\frame}#2[plain,squeeze]{#1}}
%%%\renewcommand<>{\frame}[2][]{\beameroriginal{\frame}#3[plain,#1]{#2}}
%%%\renewenvironment<>{\frame}[1]{\beameroriginal{\frame}#2[plain]{#1}}
%\fi


\hypersetup{pdfpagemode=FullScreen} %%OK
\usepackage{mybeamer}

\usepackage{pgfpages}



%Example: \documentclass[hyperref={bookmarks=false}]{beamer}
%Alternatively, you can also use the \hypersetup command.
%%\hypersetup{plainpages=false,pdfpagelabels}


%%@@
%\usepackage{itebeamer}
%\usepackage{trig}
%\usepackage{epic}
%\usepackage{eepic}
%%SEE: CAN BE USEFUL \usepackage{pgf}




\setbeamersize{text margin left=0.2cm,text margin right=0.2cm}
\allowlinebreakinarticle

\ifx\doonlychap\undefined\def\doonlychap{}\fi

\setbeamercovered{%
%%%still
%%%covered={\opaqueness<1>{15}\opaqueness<2>{10}\opaqueness<3>{5}\opaqueness<4->{2}},
%still covered={\opaqueness<1->{15}},
%again covered={\opaqueness<1->{90}}
still covered={\opaqueness<1->{0}},
again covered={\opaqueness<1->{30}}
}


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

\AtBeginSection[]{
\mode<presentation>{
%\newpage
\pagebreak
\vspace*{2\scalcm}
%\frame{
\centerline{\Huge Sec.~\thesection:}
\vspace*{1\scalcm}
\centerline{\framebox{
\begin{minipage}{0.8\textwidth}
\centering
\Huge \secname
\end{minipage}
}}
\vspace*{1\scalcm}
%}
%\newpage
}
}
%

\AtBeginSubsection[]{
\mode<presentation>{
\pagebreak
%\newpage
\vspace*{1\scalcm}
%%\centerline{\underline{\LARGE \thesection.\thesubsection:
 %%\subsecname}}
\centerline{\underline{\LARGE \subsecname}}
\vspace*{0.5\scalcm}
}
}


%%NO
%\AtBeginSection[]{
%\setbeamertemplate{sections/subsections in toc}[ball]
%\frame[c]{
%\large
%\tableofcontents[sectionstyle=show/hide,subsectionstyle=hide]
%}
%%\newpage
%}





\providecommand{\paragraph}[1]{\underline{#1}\\}

%%\AtBeginSubsubsection[]{
%%\mode<presentation>{
%%\newpage
%%\large
%%\underline{\subsubsecname}\\
%%}
%%}



\ifx\formeonly\undefined
\else
    \ifx\pdfoutput\undefined
     \else
%%\usepackage{pdfpages}
     \fi
\fi

%%



\mode<article>{
\usepackage{hyperref}
%%to suppress frametitle not in article
\setbeamertemplate{frametitle}{}
}


%%EA\newif\ifdefincpage 
\gdef\newpdfcrop{0}


%%SOON HERE \newcommand{\dommelenpage}{http://www.eng.fsu.edu/~dommelen/quantum}
%%OLD 
\newcommand{\dommelenpage}{http://www.eng.fsu.edu/~dommelen/research/nano/quantum/}

%\href{\dommelenpage/style_a/node1.html}{\copyright 2004 and on, Leon van Dommelen}

%\renewcommand{\insertcopyright}{{\copyright 2004 and on, Leon van
%Dommelen}}

\newcommand{\transpcanvas}{%
\setbeamertemplate{background canvas}[default]% %% necessary if shading was used
\setbeamercolor{background canvas}{bg=}%
}



%% USEFUL  PUT IN STYLE FILE
\newcommand{\getfrompages}[1]{
%%\gdef\frompage{0}%
%%\gdef\topage{0}%
%%\getfrompage#1+
%%\ifnum\frompage>0\else
\getfromtopages#1-
%%\fi
}
\gdef\getfromtopages#1-#2-{%
\gdef\frompage{#1}%
\gdef\topage{#2}%
}
%%NO: I can't find a good solutions, page must be of the form p1-pend
 %%or p1-p1 for a single page
%%\gdef\getfrompage#1+{%
%%\gdef\frompage{#1}%
%%\gdef\topage{#1}%
%%}



%% specify chapter,page
\newcommand{\checkstudents}{}
\def\blinderdir{/users/arrigoni/vorlesungen/scripts/quantum-mechanics/blinder}
\def\dommelendir{/users/arrigoni/vorlesungen/scripts/quantum-mechanics/dommelen-qmeng}
%
% \includeblinderc{chap}{page}
\newcommand{\includeblindercnew}[2]{%
  \gdef\newpdfcrop{1}%
  \includeblinderc{#1}{#2}%
  \gdef\newpdfcrop{0}%
}
%
\newcommand{\includeblinderc}[2]{{\mode<presentation>{
\transpcanvas
\renewcommand{\insertcopyright}{\large Copyright \copyright 2004 Elsevier Inc.}
%
\ifnum\newpdfcrop>0
%EA\defincpagetrue
%%\getfromtopages#2+%
\getfrompages{#2}%
\input \blinderdir/QMChap#1-crop.tex 
\else
\includepdf[pages=#2]{\blinderdir/QMChap#1.pdf}
\fi
%
%
\renewcommand{\insertcopyright}{}
}}}
%
\newcommand{\includedommelennew}[1]{{\mode<presentation>{
\transpcanvas
%% insertcopyright is used in mybeamer.sty
\renewcommand{\insertcopyright}{\href{\dommelenpage/style_a/node1.html}{\large
    \copyright 2004 and on, Leon van Dommelen}}
\getfromtopages#1-%
%%\def\framepreamble{\frametitle{...}}
\input \dommelendir/dommelen-orig-crop.tex 
%%\includepdf[pages=#1]{\dommelendir/dommelen-orig.pdf}
\renewcommand{\insertcopyright}{}
%%http://www.eng.fsu.edu/~dommelen/research/nano/quantum/index.pdf
%% Vers. 3 Beta 4.2
}}}
%%
%% this is something I don't really need in mypresentation
%% so I can switch on and off
\newcommand{\nincludeblinderc}[2]{{
\mode<presentation>{\transpcanvas
%OFF\includeblinderc{#1}{#2}
}}}
%
%
%$%                               
%$% specify absolute page
%$\newcommand{\includeblinder}[1]{{\mode<presentation>{
%$\setbeamercolor{background canvas}{bg=}
%$\includepdf[pages=#1]{blinder-all.pdf}
%$}}}
%$%%
%$%% this is something I don't really need in mypresentation
%$%% so I can switch on and off
%$\newcommand{\nincludeblinder}[1]{{\mode<presentation>{
%$\setbeamercolor{background canvas}{bg=}
%$%OFF \includepdf[pages=#1]{blinder-all.pdf}
%$}}}


%% this is for copy in internet FOR STUDENT
\ifx\formeonly\undefined
%%
  \renewcommand{\includeblinderc}[2]{
    \frame{\vfill\centerline{\LARGE Blinder,Chap. #1, Pages #2}}}
%
  \renewcommand{\nincludeblinderc}[2]{\frame{\vfill\centerline{\LARGE 
\structure{See also} [Blinder],
        Chap. #1, Pages #2}}}
%
  \renewcommand{\includedommelennew}[1]{
    \frame{\vfill\centerline{\LARGE
        \href{\dommelenpage/index.pdf}{[van Dommelen]}, absolute pages #1}}}
%
\renewcommand\checkstudents{
    \vfill{
 \centering 
PDF presentation using LaTeX and the
        \href{http://latex-beamer.sourceforge.net}{Beamer Class}\\
 \centerline{ 
   \href{http://latex-beamer.sourceforge.net}{http://latex-beamer.sourceforge.net}
    }
}}
%
\fi




\newcommand\ffbox[1]{\framebox{$\displaystyle #1$}}
%%
%%in math environment
\newcommand\mffbox[1]{\hbox{\ffbox{#1}}}

%% important equation
\newcommand\impeq[1]{\alert{\mffbox{\color{Black}#1}}}

%%\newcommand<>{\nofootnote}[1]{}

\newcommand{\tento}[1]{\times 10^{#1}}
\newcommand{\vv}[1]{{\bf #1}}
\def\vvv#1{\mbox{\boldmath{$#1$}}}
\providecommand{\beq}{\begin{equation}}
\providecommand{\eeq}{\end{equation}}
\providecommand{\beqn}{\begin{eqnarray}}
\providecommand{\eeqn}{\end{eqnarray}}

\ifnum\dopopeq>0\else\def\eqref#1{(\rref{#1})}\fi


\def\vnabla{\vvv{\nabla}}
\newcommand{\de}{\partial}
%%\newcommand{\to}{\rightarrow}

\title{Atomic Physics and Quantum Mechanics}
\author{Enrico Arrigoni}
\institute{TU Graz}
\date{WS 2008}

%%NOO it is not good to use hframe instead of frame
%\newcommand<>{\hframe}[2][]{
%\alt<beamer>{\frame#3{#1}{#2}}{\frame#3[#1,shrink]{#2}}
%%ALSO ALT IS NOT CORRECT!!
%}

\mode<beamer>{
\usetheme[secheader]{Madrid}
\useoutertheme{infolines}
\setbeamertemplate{navigation symbols}[back]
\newcommand{\hyperback}[2][back]{\hyperlink{#2}{\beamerbutton{#1}}}
}
\mode<handout| trans| article>{
%\usetheme{default}
%\usetheme[secheader]{Madrid}
%%%\setbeamertemplate{headline}[text line]{\thesection:\insertsection
 %%%\thesection.\thesubsection:\insertsubsection}
\setbeamertemplate{navigation symbols}[copyright]
%\newcommand{\hhopt}{allowframebreaks}  % extra option in frames NOT WORKING
%%
%%this (or th next one) is in order to get references to page numbers correctly
\setbeamertemplate{footline}[text line]{\hfill\fbox{\insertpagenumber}}
%\setbeamertemplate{footline}[page number]
%\newcommand{\hyperback}[1]{\hyperlink{#1}{\beamerbutton{Back to
%Pag.~\pageref{#1}}}}
\newcommand{\hyperback}[2][back to]{\hyperlink{#2}{\beamerbutton{#1 pag.~\pageref{#2}}}}
}
\newcommand{\hyperexample}[1]{\label{ex:#1}\hyperback{#1}}
\newcommand{\hypertoexample}[2][examples]{\hyperback[#1:]{ex:#2}\label{#2}}



%%    When printing a handout created this way, you will typically wish to print at least two and possibly four
%%slides on each page. The easiest way of doing so is presumably to use pgfpages as follows:
%%\usepackage{pgfpages}
%%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
%%Instead of 2 on 1 you can use 4 on 1 (but then you have to add landscape to the list of options) and you
%%can use, say, letterpaper instead of a4paper.
%%good 2 in 1 for handout
\mode<handout| trans>{
\ifx\pgfpagesstep\undefined\else
%% this is because pgfpagesuselayout produces wrong page number
%% in aux file, in this way, this must be the last step in latex
%% in the first one (where aux file is produced) this command is skipped
\ifx\twoonone\undefined
\pgfpagesuselayout{resize to}[a4paper,landscape,border shrink=5mm]\nofiles
\else
\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]\nofiles
%%\setbeamercolor{background canvas}{bg=black!5}
\fi
\fi
}


\newcommand{\onlybeamer}[1]{\alt<beamer>{#1}{}}

\mode<trans| handout>{
%%\setbeamertemplate{frametitle continuation}[from second][\insertcontinuationcountroman]%
\setbeamertemplate{frametitle continuation}[from second]
}

%%VERY USEFUL!! see /usr/share/texmf/tex/latex/beamer/base/beamerbaseframesize.sty
\makeatletter
\define@key{beamerframe}{thandout}[0.95]{%
\alt<beamer>{}{%
  \def\beamer@autobreakfactor{#1}\beamer@autobreaktrue
              }
}
\makeatother

%EA%%DOES NOT WORK IF BEGIN{FRAME} IS USED
%EA USE THANDOUT ABOVE
%EA%%THIS WORKS allowframebreaks or shrink
%EA\mode<trans| handout>{
%EA%THIS NOT\def\fcommand{plain}
%EA%NOO\renewenvironment<>{frame}{\begin{originalframe}#1}{\end{originalframe}}
%EA%%
%EA\renewcommand<>{\frame}[2][]{
%EA\def\empty{}
%EA\def\tempty{#1}
%EA\ifx\tempty\empty
%EA%%THIS NOT \beameroriginal{\frame}#3[\fcommand]{#2}
%EA\beameroriginal{\frame}#3[allowframebreaks]{#2}
%EA\else
%EA%%\beameroriginal{\frame}#3{#2}
%EA%%THIS NOT\beameroriginal{\frame}#3[#1,\fcommand]{#2}
%EA\beameroriginal{\frame}#3[#1,allowframebreaks]{#2}
%EA\fi
%EA}
%EA}



%\usepackage{hyperref}
%\hypersetup{plainpages=false,pdfpagelabels}

%% does not work
%%\newenvironment{mystructureenv}{\only{\setbeamertemplate{itemize item}{X}}}{}
%% define also command mystructure !

%% evidence: now in ~/tex/sty/mybeamer.sty
%% color can be changed e.g. with
%%\setbeamercolor{evidencecol}{bg=yellow!20!white}




\doonlychap

%%\only<presentation>{
\onlybeamer{
% several options for coloring
%\setbeamertemplate{background canvas}[vertical shading]
%% color gradient
%%\setbeamertemplate{background canvas}[vertical shading][top=green,bottom=red]
%%\setbeamertemplate{background canvas}[vertical shading][top=green!30,middle=green!10,bottom=green!30]
%%NO 
%\usecolortheme{green}
%\setbeamercolor{normal text}{bg=structure!15}
%
%\setbeamercolor{normal text}{bg=green!15}
\setbeamertemplate{background canvas}[vertical shading][top=green!20,middle=green!15,bottom=green!20]
}

\begin{document}
%\mode*



\include{sec-title-intro}

%% Until atomic orbitals 24x4-21 pages + tunneling (4) ~ 80 pag. 
%% 14 1h-lectures -> 6 pag./lecture
%% done 14 pages in 1h 30'
%% also some exercises


\include{sec-failures}

\include{sec-wavepart}

\include{sec-bohr}


\include{sec-wavefun}


\include{sec-qmsimple}





\include{sec-principles}

\include{sec-angular}


\include{sec-hatom}

%%\section{Atomic structure and the periodic table}

%%\section{Tunnel effect, transmission and reflection}


\appendix
\include{sec-appendix}

\onlybeamer{\inserttafelschreiben}

\mode
<all>

\end{document}

