summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/beameraudience/beameraudience.sty
blob: 955ea1e2cace67d623cbf4c2e3b482241f1b939a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
%% 
%% This program is provided under the terms of the
%% LaTeX Project Public License distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt.
%% 
%% Author: Holger Marschall
%%         holgermarschall@yahoo.de
%% 
\def\fileversion{0.1}
\def\filedate{2011/08/02}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beameraudience}[\filedate\space
    v\fileversion\space assembling beamer frames according to audience]

% check for beamer class
% taken from beamersubframe (v 0.1 -- Mike Kaufmann -- THANKS!)
\@ifclassloaded{beamer}{}{%
    \PackageError{beameraudience}{%
        The package works only with the beamer class,\MessageBreak
        therefore it is not loaded.
    }{%
        The package is not loaded, because it needs the\MessageBreak
        beamer class. Continuing may lead to additional\MessageBreak
        errors because of undefined commands.
    }
    \endinput
}

\RequirePackage{kvoptions} 
\RequirePackage{cprotect} 
\RequirePackage{ifthen}

\DeclareStringOption[all]{audience}
\ProcessKeyvalOptions*

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% start functional stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% new frame command '\framefor{#1}{#2}'
%  #1 audience-keyword checked 
%     against the package option
%  #2 frame content
%
% and related stuff: '\justfor{#1}{#2}'
%                    '\showcontentfor{#1}{#2}'
%

\newboolean{includethis}
\newcommand{\ifinclude}[1]{\ifthenelse{\boolean{includethis}}{#1}{}}
\newcommand{\ifshow}[1]{\ifthenelse{\boolean{includethis}}{\only<beamer:1|handout:1>{#1}}{\only<beamer:0|handout:0>{#1}}}

\newcommand{\framefor}[2]%
{%
  \ifthenelse{\equal{#1}{\beameraudience@audience}}{\setboolean{includethis}{true}}{}
	\ifinclude{%
	  \begin{frame}
	    #2
	  \end{frame}%
	}
	\setboolean{includethis}{false}
}

\newcommand{\justfor}[2]%
{%
  \ifthenelse{\equal{#1}{\beameraudience@audience}}{\setboolean{includethis}{true}}{}
	\ifinclude{%
	   #2
	}
	\setboolean{includethis}{false}
}

\newcommand{\showcontentfor}[2]%
{%
  \ifthenelse{\equal{#1}{\beameraudience@audience}}{\setboolean{includethis}{true}}{}
	\ifshow{%
	   #2
	}
	\setboolean{includethis}{false}
}