mk_sample_lecture.sh (8555B)
1 #!/bin/bash 2 # generate sample_lecture.tex 3 # Author: Andreas HABEGGER <andreas.habegger> 4 # Date : 2017 5 # Based on an idea by Albert Reiner. 6 7 _FILE_PERM=644 8 9 OUTFILE=sample_lecture.tex # Name of the file to generate. 10 11 OUTFILE="${_DESTINATION_DIR}/${_LECTURES}/${OUTFILE}" 12 13 # ----------------------------------------------------------- 14 # 'Here document containing the body of the generated script. 15 ( 16 cat <<'EOF' 17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 %% Lecture specific settings 19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 \lecture[SAMPLE]{LaTex Sample Lecture} 21 22 \subtitle{Based on examples get started with the template} 23 24 \date{Aug. 30, 2016} 25 26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 27 %% Do not modify the following lines untile section : 28 %% -> "Add your presentation content" 29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 30 31 \begin{document} 32 \input{lecture-article} 33 34 \lstset{style=bfh-c} 35 36 37 \begin{frame}[plain] 38 \maketitle 39 \end{frame} 40 41 \begin{frame}\frametitle<presentation>{Agenda} 42 \tableofcontents[ 43 % currentsection, % causes all sections but the current to be shown in a semi-transparent way. 44 currentsubsection, % causes all subsections but the current subsection in the current section to ... 45 % hideallsubsections, % causes all subsections to be hidden. 46 % hideothersubsections, % causes the subsections of sections other than the current one to be hidden. 47 subsectionstyle=show/shaded, 48 % part=, % part number causes the table of contents of part part number to be shown 49 pausesections, % causes a \pause command to be issued before each section. This is useful if you 50 % pausesubsections, % causes a \pause command to be issued before each subsection. 51 % sections={ overlay specification }, 52 ] 53 \end{frame} 54 55 \addtocontents{toc}{\vskip -0.1cm} %new code 56 57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 58 %% Add your presentation contetn below 59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 60 \section{section} 61 %%%--------------------------------------- 62 \frame[t]{\frametitle{Some Slide Title} 63 \framesubtitle{Examine some basic code. Take a look at the (very) basic program below to get a good idea about how some of the various aspects of the language work together, and to get an idea of how programs function.} 64 \only<2->{ 65 \lstinputlisting[basicstyle=\ttfamily\scriptsize]{sample-helloWorld.c} 66 } 67 \only<3>{ 68 \begin{itemize} 69 \item The \texttt{\#include} command occurs before the program starts, and loads libraries that contain the functions you need. In this example, \texttt{stdio.h} lets us use the \texttt{printf()} and \texttt{getchar()} functions. 70 \item The \texttt{int main()} command tells the compiler that the program is running the function called ``main'' and that it will return an integer when it is finished. All-most all C programs run a ``main'' function. 71 \item The \texttt{\{\}} indicate that everything inside them is part of the function. In this case, they denote that everything inside is a part of the ``main'' function. 72 \item The \texttt{printf()} function displays the contents of the parentheses on the user's screen. The quotes ensure that the string inside is printed literally. The \textbackslash~n sequence tells the compiler to move the cursor to the next line. 73 \end{itemize} 74 } 75 \only<4-|handout:0>{ 76 \begin{itemize} 77 \item The ``;'' denotes the end of a line. Most lines of C code need to end with a semicolon. 78 \item The \texttt{getchar()} command tells the compiler to wait for a keystroke input before moving on. This is useful because many compilers will run the program and immediately close the window. This keeps the program from finishing until a key is pressed. 79 \item The \texttt{return 0 } command indicates the end of the function. This means that it will need an integer to be returned once the program is finished.\footnote{A ``0'' indicates that the program has performed correctly; any other number will mean that the program ran into an error.} 80 \end{itemize} 81 } 82 }\note{ 83 } 84 %%%--------------------------------------- 85 \subsection[short]{A very very very long title} 86 %%%--------------------------------------- 87 \frame[c]{\frametitle{A graphic based on SVG source} 88 \begin{figure} 89 \centering 90 \includegraphics[width=.4\textwidth]{sample-flowChartSwitch} 91 \caption{The flow-chart of the switch case control statement} 92 \label{fig:flowChartSwitch} 93 \end{figure} 94 }\note{ 95 } 96 %%%--------------------------------------- 97 \subsection[other]{A very very very long title} 98 %%%--------------------------------------- 99 \frame[t]{\frametitle{A picture from internet} 100 Understanding flow-charts is basic skill for an engineer. One is shown on slide~\pageref{fig:flowChartSwitch}. 101 \begin{figure} 102 \centering 103 \includegraphics[width=.4\textwidth]{sample-learnProgLang} 104 \caption{Daily text snippet of a coder.} 105 \source[Image]{learnProgLang} 106 \label{fig:learnProgLang} 107 \end{figure} 108 }\note{ 109 } 110 %%%--------------------------------------- 111 \subsection[exercise]{A very very very heavy exercise } 112 %%%--------------------------------------- 113 \frame[t]{ 114 \begin{block}{Exercise} 115 Some meaningful exercise!! 116 \end{block} 117 \noindent 118 \textbf{Solution.}\nopagebreak\vspace{2in} 119 } 120 %%%--------------------------------------- 121 \section{An other section} 122 \sectionpage 123 %%%--------------------------------------- 124 \frame[c]{\frametitle{The box env } 125 \begin{block}{Blocktitel} 126 Blocktext 127 \end{block} 128 \begin{exampleblock}{Beispielblocktitel} 129 Beispielblocktext 130 \end{exampleblock} 131 \begin{alertblock}{Warnungsblocktitel} 132 Warnungsblocktext 133 \end{alertblock} 134 \only<2->{ 135 \lstinputlisting[style=bfh-cpp,basicstyle=\ttfamily\scriptsize]{sample-helloWorld.cpp} 136 } 137 }\note{ 138 } 139 %%%--------------------------------------- 140 \frame[c]{\frametitle{Shell examples} 141 \begin{itemize} 142 \item An ordinary user shell command.\hfill\\ 143 \begin{cli}git log \end{cli} 144 \item A command on a root shell.\hfill\\ 145 \begin{cli}[\#]apt update \&\& apt install -Y tree\end{cli} 146 \item A user shell where a command with super user perm.\hfill\\ 147 \begin{cli}sudo pstree\end{cli} 148 \end{itemize} 149 } \note{ 150 } 151 %%%--------------------------------------- 152 \section{Some math stuff} 153 \sectionpage 154 %%%--------------------------------------- 155 \frame[t]{\frametitle{Exercise } 156 \begin{enumerate} 157 \item Let $X\sim\mathcal{U}(0,10)$. Find $\P(|X-5|>4)$.\\ 158 \item Let $X\sim\mathcal{N}(\mu,\sigma^2)$. Find $\P(|X-\mu|>2\sigma)$.\\ 159 \end{enumerate} 160 }\note{ 161 } 162 %%%--------------------------------------- 163 \frame[c]{\frametitle{The box env } 164 \begin{lemma}[XY -- Ein Dual zu YX] 165 Lemma 166 \end{lemma} 167 }\note{ 168 } 169 %%%--------------------------------------- 170 \frame[c]{\frametitle{The box env } 171 \begin{theorem}[T -- Nach Tarski] 172 Theorem 173 \end{theorem} 174 }\note{ 175 } 176 177 \section{section} 178 179 %%%--------------------------------------- 180 \subsection{The definitions} 181 %%%--------------------------------------- 182 \frame[c]{\frametitle{The box env } 183 \begin{definition} 184 Definition bla bla bla bla bla 185 \end{definition} 186 }\note{ 187 } 188 %%%--------------------------------------- 189 \frame[t]{ 190 \begin{block}{Exercise} 191 \end{block} 192 \noindent 193 \textbf{Solution.}\nopagebreak\vspace{2in} 194 } 195 %%%--------------------------------------- 196 \begin{frame}[c,allowframebreaks]{Text on multiple slides} 197 A\\ A\\ A\\ A\\ A\\ A\\ A\\ A\\ A\\ A\\ A\\ A\\ A\\ 198 \framebreak 199 B\\ B\\ B\\ B\\ B\\ B\\ B\\\framebreak B\\ B\\ B\\ B\\ B\\ B\\ 200 \end{frame} 201 \note{ 202 } 203 %%%--------------------------------------- 204 \begin{frame}[c,allowframebreaks]{References} 205 \tiny{\bibliographystyle{abbrv} } 206 \bibliography{sample-theRefs} 207 \end{frame} 208 \note{ 209 } 210 %%%--------------------------------------- 211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 212 %% Do not modify below 213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 214 215 \end{document} 216 EOF 217 ) > $OUTFILE 218 # ----------------------------------------------------------- 219 220 # Quoting the 'limit string' prevents variable expansion 221 #+ within the body of the above 'here document.' 222 # This permits outputting literal strings in the output file. 223 224 if [ -f "$OUTFILE" ] 225 then 226 chmod ${_FILE_PERM} ${OUTFILE} 227 else 228 echo "Problem in creating file: \"$OUTFILE\"" 229 fi 230 231 232 233 exit 0