Skip to content
Snippets Groups Projects
Commit 424cdb07 authored by Valentin Bruch's avatar Valentin Bruch
Browse files

beamer presentation

parent 8f987192
No related branches found
No related tags found
No related merge requests found
Showing
with 589 additions and 0 deletions
### Beamer presentation
Build:
```bash
mkdir pgf-img
lualatex beamer
make -f beamer.makefile # this takes some time
lualatex beamer
```
# Create a very basic animation as an example
# This is a simple, but not the best way of implementing this animation.
#
# This script should work with both python2 and python3
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
# Resolution of the video (should be at least 200 for a good quality)
dpi = 400
# Number of time steps, for which the plot is calculated
nt = 500
# Number of points on the x axis
nx = 400
x = np.linspace(-1, 1, nx)
# Calculate a function of x and time, which will be shown in the animation
# The function is a wavefunction of a quantum mechanical particle in a one dimensional box.
y1 = np.cos(np.pi*x/2)
y2 = np.sin(np.pi*x)
y3 = np.cos(3*np.pi*x/2)
y4 = np.sin(2*np.pi*x)
e1 = 0.5
e2 = 1
e3 = 1.5
e4 = 2
# psi(t) returns an array of complex y values.
psi = lambda t: 0.4*np.exp(2j*np.pi*e1*t)*y1 + 0.3*np.exp(2j*np.pi*e2*t)*y2 - 0.2*np.exp(2j*np.pi*e3*t)*y3 - 0.1*np.exp(2j*np.pi*e4*t)*y4
y = psi(0)
# Set up a plot
fig, ax = plt.subplots()
fig.set_size_inches(8/2.54, 5/2.54)
ax.set_xlim(-1, 1)
ax.set_ylim(0, 0.85)
# Show the phase of the complex values in psi(t) as a color plot
img = ax.imshow(np.angle(y).reshape((1,nx)), cmap=plt.cm.hsv, norm=plt.Normalize(-np.pi,np.pi), extent=[-np.pi,np.pi,0,0.85])
# Clip this color plot, such that it is only shown in the area defined by 0 < y < abs( psi(t) )
fill, = ax.fill(x, np.abs(y), facecolor='none')
img.set_clip_path(fill)
# Plot the absolute value of psi as a black line
plot, = ax.plot(x, np.abs(y), color='black')
# Set aspect ratio
ax.set_aspect(1.5)
# Save the plot to an image
fig.savefig("image.jpg", dpi=dpi)
# Define a function which updates the data
def calc_data(t):
y = psi(t)
fill.set_xy( np.array((x, np.abs(y))).T )
img.set_data(np.angle(y).reshape((1, nx)))
img.set_clip_path(fill)
plot.set_ydata(np.abs(y))
# Define an array of times, for which the plot will be shown
times = np.linspace(0, 2*np.pi, nt, endpoint=False)
# Create an animation
anm = FuncAnimation(fig, calc_data, times)
# Save the animation
anm.save("movie.mp4", fps=50, dpi=dpi)
\documentclass[aspectratio=169, xcolor=dvipsnames, ngerman]{beamer}
%\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
%\usepackage{lmodern}
\usepackage{verbatim}
\usepackage{dtk-logos}
\usepackage{tikz}
\usetikzlibrary{backgrounds, fit, matrix, calc}
\usepackage{listings}
\usepackage{calc}
\usepackage{multimedia}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{dsfont}
\graphicspath{{figures/}{examples/}}
\usefonttheme{professionalfonts}
\newcommand{\red}[1]{{\color{red}#1}}
\newcommand{\blue}[1]{{\color{blue}#1}}
\newcommand{\green}[1]{{\color[rgb]{0,.5,0}#1}}
\newcommand{\gray}[1]{{\color{gray}#1}}
\newcommand{\black}{\color{black}}
%%% TIKZ SETTINGS
%% packages
\usepackage{pgf}
\usepackage{tikz}
\usepackage{pgfplots}
%% libraries
\usetikzlibrary{external}
\usetikzlibrary{backgrounds, fit, decorations.pathreplacing, shapes.geometric, matrix, calc, fadings}
%% externalize
\tikzexternalize[shell escape=-shell-escape, prefix=pgf-img/]
\tikzset{
external/mode=list and make,
external/system call={
lualatex \tikzexternalcheckshellescape -halt-on-error
-interaction=batchmode -jobname="\image" "\texsource"},
external/optimize command away=\includepdf,
%external/optimize=false,
}
\tikzsetfigurename{figure_}
\pgfplotsset{compat=1.16}
\newlength\termlength
\newcommand{\Underbrace}[3][]{% Surprisingly, this seems to work.
\ensuremath{%
\mathrlap{%
\setlength{\termlength}{\widthof{$#3$}-\widthof{$#2$}}%
\hspace*{0.5\termlength}%
\underbrace{#3}^{#1}_{\displaystyle#2}%
}%
\hphantom{#3}%
}%
}
\hypersetup{unicode=true}
\setmonofont{FiraCode}
\usetheme{OSAK}
\addtobeamertemplate{frametitle}{}{\vspace{-6pt}}
\lstset{
basicstyle=\footnotesize\ttfamily,
language={[LaTeX]TeX},
texcsstyle=*\color{Mahogany}\bfseries,
commentstyle=\itshape\color{RoyalBlue},
keywordstyle=\color{RoyalBlue}\bfseries,
moretexcs={lstset,subsubsection,paragraph,subsection,color,sl,textcolor,lstinputlisting,newfontfamily,fontsize,section,documentclass,begin,includegraphics,hello,bye,setmainlanguage,setlength},
morekeywords={center,document,flushleft,flushright,itemize,enumerate,tabular,article,polyglossia,geometry,amsmath,graphicx,xcolor,hyperref,alert,frame,example,definition,theorem,proof,block,column,columns,exampleblock,alertblock,only,onslide},
moredelim=**[is][\smash]{@}{@}
}
\makeatletter
\newcommand\notsotiny{\@setfontsize\notsotiny{7}{8}}
\makeatother
\setbeamersize{text margin left=6mm, text margin right=6mm}
% TODO Titel & Autoren anpassen!
\date{\today}
\title[\LaTeX-Workshop]{\LaTeX-Beamer}
\subtitle{Präsentationen mit \LaTeX}
\author{OSAK-Mitglied \#42}
\institute[OSAK]{
Open Source Arbeitskreis der \\
Fachschaft Mathematik/Physik/Informatik an der RWTH Aachen \\
und der Aachener Linux User Group
}
\newlength\marginwidth
\newcommand\marginbox[3][2pt]{
% USAGE: \marginbox[margin width]{width}{content}
% TODO: width is set manually such that it fits real width!
\setlength\marginwidth{#1}
\begin{tikzpicture}[even odd rule, scale=1]
\node[anchor=north west] (text) {%
\begin{minipage}{#2-2\marginwidth-10pt}%
#3%
\end{minipage}%
};
\begin{pgfonlayer}{background}
\node[draw opacity=.5, draw=blue, line width=#1, inner sep=2pt, fit = (text)] {};
\end{pgfonlayer}
\end{tikzpicture}
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{Inhaltsverzeichnis}
\tableofcontents
\end{frame}
\section{Was ist \LaTeX-Beamer}
\begin{frame}{Was ist \LaTeX-Beamer?}
\null\hspace{.25\textwidth}\begin{minipage}{.5\textwidth}\lstinputlisting[basicstyle=\large]{examples/documentclass-beamer.tex}\end{minipage}
\begin{itemize}
\item Dokumentklasse für diese Präsentation
\item Saubere Formatierung
\item teilweise automatische Formatierung
\item Praktisch für Formeln, Theoreme
%\item<2-> Overlays
%\item Freie Software
%\item Ausgabe als PDF (portabel)
\item<2-> Beispiel: Euklids Präsentation
\end{itemize}
\end{frame}
% TODO: Installation testen?
\section{Beispiel: Euklids Präsentation}
\begin{frame}{Was sind Primzahlen}
\begin{columns}[c]
\begin{column}{.5\textwidth}
Eine Primzahl hat genau zwei Teiler.
\end{column}
\begin{column}{.5\textwidth}
\lstinputlisting{examples/euklid1.tex}
\end{column}
\end{columns}
\end{frame}
\subsection{Was sind Primzahlen}
\begin{frame}{Was sind Primzahlen}
\begin{columns}[c]
\begin{column}{.5\textwidth}
\begin{definition}{Primzahl}
Eine Primzahl hat genau zwei Teiler.
\end{definition}
\begin{example}
\begin{itemize}
\item 2 ist Primzahl (Teiler: 1, 2)
\item 3 ist Primzahl (Teiler: 1, 3)
\item 4 ist keine Primzahl (Teiler: 1, 2, 4)
\end{itemize}
\end{example}
\end{column}
\begin{column}{.5\textwidth}
\lstinputlisting{examples/euklid2.tex}
\end{column}
\end{columns}
\end{frame}
\begin{frame}{Was sind Primzahlen}
\begin{columns}[c]
\begin{column}{.5\textwidth}
\begin{definition}{Primzahl}
Eine \alert{Primzahl} hat genau zwei Teiler.
\end{definition}
\begin{example}
\begin{itemize}
\item 2 ist Primzahl (Teiler: 1, 2)
\item 3 ist Primzahl (Teiler: 1, 3)
\item 4 ist \alert{keine} Primzahl (Teiler: 1, \alert{2}, 4)
\end{itemize}
\end{example}
\end{column}
\begin{column}{.5\textwidth}
\lstinputlisting{examples/euklid3.tex}
\end{column}
\end{columns}
\end{frame}
\subsection{Keine größte Primzahl}
\OSAKthemenologo
\begin{frame}{Keine größte Primzahl}
\begin{columns}[c]
\begin{column}{.5\textwidth}
\begin{theorem}
Es gibt keine größte Primzahl.
\end{theorem}
\begin{proof}
\begin{enumerate}
\setlength\itemindent{-6pt}%
\item Angenommen $p$ ist die größte Primzahl.
\item Sei $q$ das Produkt der ersten $p$ Zahlen.
\item $q+1$ ist durch keine davon teilbar.
\item Damit ist $q+1$ Primzahl und größer als $p$.
\end{enumerate}
\end{proof}
\end{column}
\begin{column}{.5\textwidth}
\lstinputlisting{examples/euklid4.tex}
\end{column}
\end{columns}
\end{frame}
\begin{frame}{Keine größte Primzahl}
\begin{columns}[c]
\begin{column}{.5\textwidth}
\begin{theorem}
Es gibt keine größte Primzahl.
\end{theorem}
\begin{proof}
\begin{enumerate}
\setlength\itemindent{-6pt}%
\item Angenommen $p$ ist die größte Primzahl.
\item<2-> Sei $q$ das Produkt der ersten $p$ Zahlen.
\item<3-> $q+1$ ist durch keine davon teilbar.
\item<3-> Damit ist $q+1$ Primzahl und größer als $p$.
\end{enumerate}
\end{proof}
\end{column}
\begin{column}{.5\textwidth}
\lstinputlisting{examples/euklid5.tex}
\end{column}
\end{columns}
\end{frame}
\section{Strukturierung von Folien}
\begin{frame}{Struktur einer Folie}
\begin{columns}[c]
\begin{column}{.27\textwidth}
Erste Spalte
\end{column}
\hfill%
\begin{column}{.27\textwidth}
Zweite Spalte
\end{column}
\hfill%
\begin{column}{.44\textwidth}
\lstinputlisting{examples/columns1.tex}
\end{column}
\end{columns}
\end{frame}
\begin{frame}[t]{Struktur einer Folie}
\vspace*{-6mm}%
\begin{columns}[t]
\begin{column}{.52\textwidth}
\null\vspace*{16mm}%
\begin{columns}
\begin{column}{.45\textwidth}
\begin{block}{Einfacher Block}
Strucktur durch Blöcke
\end{block}
\end{column}
\onslide<1,3->
\begin{column}{.45\textwidth}
\begin{exampleblock}{Beispiel}
Beispielblock
\end{exampleblock}
\end{column}
\end{columns}
\onslide<1,4->
\begin{alertblock}{Wichtiger Block}
Dieser Block ist immer rot.
\end{alertblock}
\end{column}
\hfill%
\onslide<1->
\begin{column}{.48\textwidth}
\only<1>{\lstinputlisting{examples/columns2.tex}}%
\only<2->{\lstinputlisting{examples/columns3.tex}}%
\end{column}
\end{columns}
\end{frame}
\section{Was beamer noch kann}
\begin{frame}{Videos}
\vspace*{-6mm}%
\begin{center}
\movie[width=.5\textwidth, height=.3125\textwidth, loop]{}{movie.mp4}\\
Wellenfuntion im eindimensionalen Kastenpotential
\end{center}
\end{frame}
\newcount\timecounter
\begin{frame}{Einfache Animationen}
\animate<2-25>
\animatevalue<1-25>{\timecounter}{0}{100}
\null\hspace{\the\timecounter pt}
\begin{minipage}{.3\textwidth}
\begin{block}{Animation}
Dieser Block bewegt sich.
\end{block}
\end{minipage}
\\[5mm]
\animate<27-40>
\animatevalue<26-40>{\timecounter}{100}{0}
\begin{colormixin}{\the\timecounter!averagebackgroundcolor}
Dieser Text wird ausgeblendet.
\end{colormixin}
\end{frame}
\begin{frame}{TikZ Beispiel: Graphen in Tight Binding}
\begin{overprint}
Näherung der Bandstruktur von Graphen
\vspace*{-1mm}
\begin{columns}[T]
\begin{column}[T]{0.5\textwidth}
\begin{block}{Tight Binding Model}
\vspace*{-1mm}
\begin{itemize}
\item Honigwabengitter
\item Nur \red{Hüpfen} zu \green{nächsten Nachbarn}
\end{itemize}
\vspace*{-2mm}
\begin{align*}
\mathcal{H}
&=-\red{t} \sum_{\green{\left<i,j\right>}}a_\green{i}^\dagger a_\green{j} \\
&=-\sum_{\mathbf{m}, \mathbf{n}, \alpha, \beta}
\red{t}\green{_{\alpha\beta}(\mathbf{m})} a_{\alpha\,(n+m)}^\dagger a_{\beta\,n}
\end{align*}
\vspace*{-1mm}
\end{block}
\end{column}
\begin{column}[T]{0.5\textwidth}
\vspace*{-4.5mm}
\tikzsetnextfilename{graphene3d}
\hspace*{3mm}%
\begin{tikzpicture}[scale=1]
\begin{axis}[
view/h=33,
axis lines=none,
width=8.3cm,
height=8.5cm,
xmin=-4.4, xmax=4.4,
ymin=-4.4, ymax=4.4,
zmin=-3.1, zmax=3.1,
]
\addplot3[
mesh,
%surf,
%shader=interp,
samples=50,
domain=-4.3:4.3,
y domain=-4.3:4.3,
] { -sqrt(1+4*cos(\y/2 r)^2+4*cos(\y/2 r)*cos(sqrt(3)*\x/2 r)) };
\addplot3[
mesh,
%surf,
%shader=interp,
samples=50,
domain=-4.3:4.3,
y domain=-4.3:4.3,
] { sqrt(1+4*cos(\y/2 r)^2+4*cos(\y/2 r)*cos(sqrt(3)*\x/2 r)) };
\end{axis}
\end{tikzpicture}
\vspace*{-12mm}
\end{column}
\end{columns}
\onslide<2->{
\vspace*{1.5mm}
$\implies$ Energieeigenzustände:
$\quad\displaystyle
E(\mathbf{k})
= \pm \red{t}%
\Underbrace{%
\sqrt{1+4\cos^2\Big( \frac a2 k_y \Big)+4\cos\Big( \frac a2 k_y \Big)\cos\Big( \sqrt3 \frac a2 k_x \Big)}%
}{\left|1+e^{-i\mathbf{k}\cdot\mathbf{a_2}}+e^{-i\mathbf{k}\cdot(\mathbf{a_1}+\mathbf{a_2})}\right|}%
$
}
\end{overprint}
\end{frame}
\end{document}
\begin{comment}
vim:ts=2:spelllang=de:fo=want:expandtab
\end{comment}
\begin{frame}{Struktur eine Folie}
\begin{columns}
\begin{column}{0.45\textwidth}
Erste Spalte
\end{column}
\begin{column}{0.45\textwidth}
Zweite Spalte
\end{column}
\end{columns}
\end{frame}
\begin{frame}{Struktur eine Folie}
\begin{columns}
\begin{column}{.45\textwidth}
\begin{block}{Einfacher Block}
Strucktur durch Blöcke
\end{block}
\end{column}
\begin{column}{.45\textwidth}
\begin{exampleblock}{Beispiel}
Beispielblock
\end{exampleblock}
\end{column}
\end{columns}
\begin{alertblock}{Wichtiger Block}
Dieser Block ist immer rot.
\end{alertblock}
\end{frame}
\begin{frame}{Struktur eine Folie}
\begin{columns}
\begin{column}{.45\textwidth}
\begin{block}{Einfacher Block}
Strucktur durch Blöcke
\end{block}
\end{column}
\onslide<2->
\begin{column}{.45\textwidth}
\begin{exampleblock}{Beispiel}
Beispielblock
\end{exampleblock}
\end{column}
\end{columns}
\onslide<3->
\begin{alertblock}{Wichtiger Block}
Dieser Block ist immer rot.
\end{alertblock}
\end{frame}
\documentclass{beamer}
\begin{frame}{Was sind Primazahlen}
Eine Primzahl hat genau zwei Teiler.
\end{frame}
\begin{frame}{Was sind Primzahlen}
\begin{definition}{Primzahl}
Eine Primzahl hat
genau zwei Teiler.
\end{definition}
\begin{example}
\begin{itemize}
\item 2 ist Primzahl (Teiler: 1, 2)
\item 3 ist Primzahl (Teiler: 1, 3)
\item 4 ist keine Primzahl
(Teiler: 1, 2, 4)
\end{itemize}
\end{example}
\end{frame}
\begin{frame}{Was sind Primzahlen}
\begin{definition}{Primzahl}
Eine @\alert{Primzahl}@ hat
genau zwei Teiler.
\end{definition}
\begin{example}
\begin{itemize}
\item 2 ist Primzahl (Teiler: 1, 2)
\item 3 ist Primzahl (Teiler: 1, 3)
\item 4 ist @\alert{keine}@ Primzahl
(Teiler: 1, @\alert{2}@, 4)
\end{itemize}
\end{example}
\end{frame}
\begin{frame}{Keine größte Primzahl}
\begin{theorem}
Es gibt keine größte Primzahl.
\end{theorem}
\begin{proof}
\begin{enumerate}
\item Angenommen $p$ ist die
größte Primzahl.
\item Sei $q$ das Produkt der
ersten $p$ Zahlen.
\item $q+1$ ist durch keine
davon teilbar.
\item Damit ist $q+1$ Primzahl
und größer als $p$.
\end{enumerate}
\end{proof}
\end{frame}
\begin{frame}{Keine größte Primzahl}
\begin{theorem}
Es gibt keine größte Primzahl.
\end{theorem}
\begin{proof}
\begin{enumerate}
\item Angenommen $p$ ist die
größte Primzahl.
\item<2-> Sei $q$ das Produkt der
ersten $p$ Zahlen.
\item<3-> $q+1$ ist durch keine
davon teilbar.
\item<3-> Damit ist $q+1$ Primzahl
und größer als $p$.
\end{enumerate}
\end{proof}
\end{frame}
\begin{frame}{Titel}
Inhalt
\end{frame}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment