commands.sty 5.95 KB
Newer Older
Alija Sabic's avatar
Alija Sabic committed
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
% ------------------------------------------------------------------------------------------------------------------- %
% fit to page and center image
% ------------------------------------------------------------------------------------------------------------------- %
\newcommand{\fitpageandcenter}[1]{%
        \node at (current page.center) {
        \includegraphics[width=\paperwidth]{#1}};%
}%
% ------------------------------------------------------------------------------------------------------------------- %
% place TikZ background
% ------------------------------------------------------------------------------------------------------------------- %
\newcommand{\placetikzbackground}[3][]{%
\ifnum\thepage#2\relax%
    \begin{tikzpicture}[#1]%
        \useasboundingbox (0,0) rectangle(\paperwidth,\paperheight);%
        #3%
    \end{tikzpicture}%
\fi%
}%
% ------------------------------------------------------------------------------------------------------------------- %
% shadowed text
% ------------------------------------------------------------------------------------------------------------------- %
\NewDocumentCommand{\shadowedtext}{O{text=white} O{text=black} O{.5pt} m m m}{%
    \foreach \angle in {0,5,...,359}{%
        \node[align=left,anchor=north west,text width=#5,shift={(\angle:#3)},#2] at #4 {#6};%
    }%
    \node[align=left,anchor=north west,text width=#5,#1] at #4 {#6};%
}
% ------------------------------------------------------------------------------------------------------------------- %
% sliced circular progressbar
% ------------------------------------------------------------------------------------------------------------------- %
\newcommand{\slicedcircularprogressbar}[9]{%
% Syntax: \slicedcircularprogressbar {coordinate} {outer radius} {inner radius} {opening angle}
%                                    {page total} {current page} {base color} {fill color} {bg color}
    \def\ratio{#6/#5}%
    \def\outerradius{#2}%
    \def\innerradius{#3}%
    \coordinate (centerprogressbar) at #1;%
    \draw[draw=none,fill=#7] (centerprogressbar) circle (\outerradius);%
    \draw[draw=none,fill=#8] (centerprogressbar) -- (centerprogressbar) ++(0,\outerradius) arc (90:90-360*\ratio:\outerradius) -- (centerprogressbar);%
    \draw[draw=none,fill=#9] (centerprogressbar) circle (\innerradius);%
    \pgfmathparse{#5-1}%
    \pgfmathsetmacro{\nums}{\pgfmathresult}%
    \foreach \x in {0,...,\nums} {%
        \pgfmathparse{360/#5*\x}%
        \pgfmathsetmacro{\angl}{\pgfmathresult}%
        \def\slice{#4}%
        \draw[draw=none,fill=#9,line width=0.1mm] (centerprogressbar) -- +(90-\angl+\slice:\outerradius+0.1) arc (90-\angl+\slice:90-\angl-\slice*2:\outerradius) -- cycle;%
    }%
}%
\NewDocumentCommand{\circularprogressbar}{ m m m m m m m m }{
    \def\position{#1}
    \def\radius{#2}
    \def\width{#3}
    \def\page{#4}
    \def\pages{#5}
    \def\fillcolor{#6}
    \def\fillopacity{#7}
    \def\padding{#8}

    \pgfmathparse{360/\pages}
    \pgfmathsetmacro{\delta}{\pgfmathresult}

    \pgfmathparse{90-\delta}
    \pgfmathsetmacro{\start}{\pgfmathresult}

    \pgfmathparse{\start-\delta}
    \pgfmathsetmacro{\step}{\pgfmathresult}

    \pgfmathparse{-360+\start}
    \pgfmathsetmacro{\stop}{\pgfmathresult}

    \coordinate (center) at #1;
    \foreach \x [count=\idx] in {\start,\step,...,\stop} {
        \ifnum\idx<\page\relax\def\opacity{1}\else\ifnum\idx=\page\relax\def\opacity{1}\else\def\opacity{\fillopacity}\fi\fi
        \draw[draw=\fillcolor,line width=\width,opacity=\opacity] (center) +(\x:\radius) arc[start angle=\x, delta angle=\delta-\padding, radius=\radius];
    }
}
% ------------------------------------------------------------------------------------------------------------------- %
% set beamer style
% ------------------------------------------------------------------------------------------------------------------- %
\newcommand{\beamer@fhtw@setstyle}[2]{\setbeamertemplate{#1}[#2]}%
% ------------------------------------------------------------------------------------------------------------------- %
% reuse beamer style (conditionally)
% ------------------------------------------------------------------------------------------------------------------- %
\newcommand{\beamer@fhtw@reusestyle}[3]{\ifthenelse{\equal{\beamer@fhtw@style}{#1}}{\setbeamertemplate{#2}[#3]}{}}%
% ------------------------------------------------------------------------------------------------------------------- %
% Title (redefined)
% ------------------------------------------------------------------------------------------------------------------- %
\RenewDocumentCommand{\logo}{O{1cm} m}{
    \def\beamer@fhtw@logowidth{#1}
    \def\beamer@fhtw@logofile{#2}
}
% ------------------------------------------------------------------------------------------------------------------- %
% Title (redefined)
% ------------------------------------------------------------------------------------------------------------------- %
\RenewDocumentCommand{\title}{O{#2} m}{
    \def\insertshorttitle{#1}
    \def\inserttitle{#2}
}
% ------------------------------------------------------------------------------------------------------------------- %
% Author (redefined)
% ------------------------------------------------------------------------------------------------------------------- %
\RenewDocumentCommand{\author}{O{#2} m}{
    \def\insertshortauthor{#1}
    \def\insertauthor{#2}
}
% ------------------------------------------------------------------------------------------------------------------- %
% Mail
% ------------------------------------------------------------------------------------------------------------------- %
\newcommand{\mail}[1]{
    \def\insertmail{\texttt{#1}}
}
% ------------------------------------------------------------------------------------------------------------------- %
% Keywords (redefined)
% ------------------------------------------------------------------------------------------------------------------- %
\renewcommand*{\keywords}[1]{\def\insertkeywords{#1}}