From 17b186ef428d2f3dcdf1a22f68d8f6fa3b3ba247 Mon Sep 17 00:00:00 2001 From: Lukas Pietzschmann Date: Fri, 9 Dec 2022 21:39:41 +0100 Subject: [PATCH] Added keys for customizing --- README.md | 5 +++ beamerthemeawesome.sty | 88 ++++++++++++++++++++++++++++++++++-------- example.tex | 2 +- 3 files changed, 77 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 386f204..19c1b4c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ The kinda awesome beamer theme! ## Using the theme Just copy and paste `beamerthemeawesome.sty` into your project, add `\usetheme{awesome}` into your main file and your good to go :) +## Options +This theme provides some settings you can tweak: +- Language: Possible values are `english` or `german`. This changes the value passed to babel and csquotes. If none of both is selected, `german` is used. +- Extra slides: For each section and subsection an extra slide containing the title can be inserted. This is controlled by passing `secslide` and `subsecslide`. The absence of `secslide` indicates that you don't want an extra slide for every section. This is analog for `subsecslide`. + ## Compilation Using this theme requires you to run your compiler multiple times on your main LaTeX file. This is required for those litte dots in the footer to work. If you're using latexmk you don't have to do this manually as latexmk can figure this stuff out by itself. diff --git a/beamerthemeawesome.sty b/beamerthemeawesome.sty index 2bb46ec..2c3e219 100644 --- a/beamerthemeawesome.sty +++ b/beamerthemeawesome.sty @@ -1,7 +1,40 @@ \ProvidesPackage{awesome-beamer-theme}[] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\RequirePackage{kvoptions} +\SetupKeyvalOptions{family=awesome,prefix=awesome@} + +\newif\ifawesome@english@ + +\DeclareVoidOption{english}{ + \awesome@english@true +} + +\DeclareVoidOption{german}{ + \awesome@english@false +} + +\DeclareBoolOption{secslide} +\DeclareBoolOption{subsecslide} + +\ProcessKeyvalOptions* + +\ifawesome@english@ + \RequirePackage[english]{babel} +\else + \RequirePackage[ngerman]{babel} +\fi + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \RequirePackage{fontspec} -\RequirePackage[ngerman]{babel} \RequirePackage{microtype} \RequirePackage{chngcntr} \RequirePackage{scrextend} @@ -401,7 +434,15 @@ \fi% \fi% \hfill% - \colorbox{awesomehighlight!70}{\hspace{0.3cm}Seite~\insertframenumber~/~\inserttotalframenumber\hspace{0.3cm}}% + \colorbox{awesomehighlight!70}{ + \hspace{0.3cm} + \ifawesome@english@ + Page + \else + Seite + \fi + ~\insertframenumber~/~\inserttotalframenumber\hspace{0.3cm} + }% \end{beamercolorbox}% } \vskip0pt% @@ -424,7 +465,16 @@ \hfill% \inserttitle% \hfill% - \colorbox{awesomehighlight!70}{\hspace{0.3cm}Seite~\insertframenumber~/~\inserttotalframenumber\hspace{0.3cm}}% + \colorbox{awesomehighlight!70}{ + \hspace{0.3cm} + \ifawesome@english@ + Page + \else + Seite + \fi + ~\insertframenumber~/~\inserttotalframenumber + \hspace{0.3cm} + }% \end{beamercolorbox}% } \vskip0pt% @@ -442,21 +492,25 @@ \AtBeginSection[]{ - \begin{frame}[noframenumbering] - \thispagestyle{navigation@toc} - \vfill - \centering - \usebeamerfont{title}\usebeamercolor[fg]{section number projected}\insertsectionnumber.~\usebeamercolor[fg]{title}\insertsectionhead\par - \vfill - \end{frame} + \ifawesome@secslide + \begin{frame}[noframenumbering] + \thispagestyle{navigation@toc} + \vfill + \centering + \usebeamerfont{title}\usebeamercolor[fg]{section number projected}\insertsectionnumber.~\usebeamercolor[fg]{title}\insertsectionhead\par + \vfill + \end{frame} + \fi } \AtBeginSubsection[]{ - \begin{frame}[noframenumbering] - \thispagestyle{navigation@toc} - \vfill - \centering - \usebeamerfont{title}\usebeamercolor[fg]{section number projected}\insertsectionnumber.\textsubscript{\usebeamercolor[fg]{subsection number projected}\insertsubsectionnumber}~\usebeamercolor[fg]{title}\insertsubsectionhead\par - \vfill - \end{frame} + \ifawesome@subsecslide + \begin{frame}[noframenumbering] + \thispagestyle{navigation@toc} + \vfill + \centering + \usebeamerfont{title}\usebeamercolor[fg]{section number projected}\insertsectionnumber.\textsubscript{\usebeamercolor[fg]{subsection number projected}\insertsubsectionnumber}~\usebeamercolor[fg]{title}\insertsubsectionhead\par + \vfill + \end{frame} + \fi } diff --git a/example.tex b/example.tex index 9dce517..4892807 100644 --- a/example.tex +++ b/example.tex @@ -2,7 +2,7 @@ \usepackage{lipsum} -\usetheme{awesome} +\usetheme[english, secslide, subsecslide]{awesome} \title{Test Presentation} \author{Lukas Pietzschmann}