Commit 262417e3 authored by Alija Sabic's avatar Alija Sabic
Browse files

reorganize Makefile, externalize slides & content

 - cleanup Makefile, remove template, reorganzie using enviroment variable TARGET, VARIANTS, OPTS
 - move content to separate slides, figures, tables (standalone)
 - add help instructions, update README
 - add forumula, figures and tables as demonstration
parent dc5692e1
# -*- cperl -*-
# latexmkrc
$builddir = $ENV{'BUILDDIR'};
$job = $ENV{'JOBNAME'};
$bibdirs = $ENV{'BIBDIRS'};
$target = $ENV{'TARGET'};
$type = $ENV{'TYPE'};
$viewer = $ENV{'VIEWER'};
......@@ -14,11 +14,12 @@ $dependents_list = 1;
$silence_logfile_warnings = 0;
$use_make_for_missing_files = 1;
$out_dir = $builddir;
$deps_file = "$builddir/$target.deps";
$deps_file = "$out_dir/$job.deps";
$jobname = $job;
@BIBINPUTS = ('.',$bibdirs);
# $bibtex = 'bibtex %O %B';
$pdflatex = join '', 'pdflatex %O -interaction=nonstopmode -synctex=1 -file-line-error "\PassOptionsToClass{', $type, '}{beamer} \input{%S}"';
$pdf_previewer = $viewer;
push @generated_exts, 'blg', 'cut', 'nav', 'snm', 'vrb', 'synctex.gz';
\ No newline at end of file
push @generated_exts, 'blg', 'cut', 'nav', 'snm', 'sta', 'vrb', 'synctex.gz';
\ No newline at end of file
pr = $(shell echo "\e[38;5;36m")
sc = $(shell echo "\e[38;5;231m")
ac = $(shell echo "\e[38;5;197m")
rst = $(shell echo "\e[0m")
dollar = `echo '\$$'`
out_length = 80
header = -------------------------------------------------------------------------------
print_banner = $1$(header)\n==$(rst) $2$1\n$(header)$(rst)\n
ERRS = error
LOG = @echo "$(call print_banner,$(ac),Error Log:$(sc)$1$(rst))\e[1A" && \
grep $(ERRS) $1 -nR -A4 -B8 | fold -sw $(out_length) | \
sed --expression='s/--/$(ac)$(header)\n$(header)$(rst)/g' | \
grep --color -E -e '' -e '$(ERRS)' && echo "$(ac)$(header)\n$(header)$(rst)\n"
INSTRUCTIONS = "$(call print_banner,$(pr),$(sc)Help Instructions $(rst))\n" \
"Provided targets:\n\n build, view, preview, log, clean, distclean, help\n\n" \
"Three environment variables are used to configure the behavior of those targets:\n" \
"\n" \
"$(pr)$(dollar)TARGET$(rst) is used to specify the $(sc)tex$(rst) file to compile" \
"(default: $(pr)$(dollar)BASENAME$(rst)).\n" \
"$(pr)$(dollar)VARIANTS$(rst) is used to specify none, one, or multiple variants" \
"(default: $(pr)$(dollar)BASEVARIANTS$(rst)).\n" \
"$(pr)$(dollar)OPTS$(rst) is used to pass additional options to latexmk.\n" \
"\n" \
"Examples:\n\n" \
" $(dollar) make $(pr)OPTS$(rst)=$(sc)-gg$(rst)\n" \
" $(dollar) make $(pr)TARGET$(rst)=$(sc)resources/tex/figures/logo$(rst) view\n" \
" $(dollar) make $(pr)VARIANTS$(rst)=$(sc)handout,presentation$(rst) build\n" \
" $(dollar) make $(pr)VARIANTS$(rst)=, view\n" \
"\n" \
"Export variables to set them permanently.\n\n" \
" $(dollar) export $(pr)TARGET$(rst)=$(sc)resources/tex/intro.tex$(rst)\n" \
" $(dollar) export $(pr)VARIANTS$(rst)=$(sc)notes$(rst)\n" \
" $(dollar) make\n" \
" $(dollar) make preview\n" \
" $(dollar) make clean\n" \
"\n$(pr)$(header)$(rst)" \
"\n$(pr)$(header)$(rst)"
LATEXMK_ERRS = $(if $(strip $(TARGET)),,$(eval TARGET=$(BASENAME))) \
$(if $(strip $(VARIANTS)),,$(eval VARIANTS=$(BASEVARIANTS))) \
$(eval SOURCE=$(notdir $(basename $(TARGET)))) \
$(if $(strip $(VARIANTSLIST)), \
$(foreach v, $(VARIANTSLIST), \
$(call LOG, $(BUILDDIR)/$(SOURCE)-$(v).log) \
);, \
$(call LOG, $(BUILDDIR)/$(SOURCE).log) \
)
LATEXMK_SELECT = $(if $(strip $(TARGET)),,$(eval TARGET=$(BASENAME))) \
$(if $(strip $(VARIANTS)),,$(eval VARIANTS=$(BASEVARIANTS))) \
$(eval SOURCE=$(basename $(TARGET))) \
$(if $(strip $(VARIANTSLIST)), \
$(foreach v, $(VARIANTSLIST), \
export JOBNAME=$(notdir $(SOURCE))-$(v) \
TYPE=$(v) && \
$(call LATEXMK,$(SOURCE),$1); \
), \
export JOBNAME=$(notdir $(SOURCE)) \
TYPE=presentation && \
$(call LATEXMK, $(SOURCE), $1); \
)
LATEXMK_PREVIEW = $(if $(strip $(VARIANTS)),,$(eval VARIANTS=$(BASEVARIANTS))) \
$(if $(strip $(VARIANTSLIST)),$(eval VARIANTSLIST=$(firstword $(VARIANTSLIST))),) \
$(call LATEXMK_SELECT, -pvc)
\ No newline at end of file
BASENAME = demo
include .utils
BASENAME = demo
BUILDDIR = build
VARIANTS = presentation handout notes
BASEVARIANTS = presentation,handout,notes
# space separated list of requested variants
VARIANTSLIST = $(eval comma:=,) $(subst $(comma), ,$(VARIANTS))
# Environment
TEXDIRS = resources/latex/:resources/latex-sty/:resources/images/:resources/listings/
TEXDIRS := $(TEXDIRS):resources/figures:resources/tables:resources/tex
BIBDIRS = resources/latex/
BSTDIR = resources/latex-bst/
# cf. latexmkrc
LATEXMKV = export TYPE=$1 TARGET="$(BASENAME)-$1" && latexmk -jobname="$(BASENAME)-$1" $2
LATEXMK = export TYPE= TARGET="$(basename $(notdir $1))" && latexmk $(basename $1)$2
LATEXMK = latexmk $(OPTS) $2 $1.tex | fold -sw $(out_length)
VIEWER = xdg-open
# main targets
all: $(VARIANTS)
clean:
find $(BUILDDIR) -type f -not -name "*.pdf" -delete
distclean:
rm -rf $(BUILDDIR)
define TEMPLATE =
$(BASENAME)-$(strip $(1)).pdf $(strip $(1)).build $(1): setup
$(call LATEXMKV,$(strip $(1)),)
$(strip $(1)).view: setup
$(call LATEXMKV,$(strip $(1)),-pv)
$(strip $(1)).preview: setup
$(call LATEXMKV,$(strip $(1)),-pvc)
$(strip $(1)).clean: setup
$(call LATEXMKV,$(strip $(1)),-c)
$(strip $(1)).distclean: setup
$(call LATEXMKV,$(strip $(1)),-C)
endef
$(foreach variant, $(VARIANTS), $(eval $(call TEMPLATE, $(variant))))
# dynamic targets
%.build: setup
$(call LATEXMK, $@, )
%.view: setup
$(call LATEXMK, $@, -pv)
%.preview: setup
$(call LATEXMK, $@, -pvc)
%.clean: setup
$(call LATEXMK, $@, -c)
%.distclean: setup
$(call LATEXMK, $@, -C)
all: build
build: setup
$(call LATEXMK_SELECT, )
log: setup
$(call LATEXMK_ERRS, $(TARGET))
view: setup
$(call LATEXMK_SELECT, -pv)
preview: setup
$(call LATEXMK_PREVIEW, -pvc)
clean: setup
$(call LATEXMK_SELECT, -c)
distclean: setup
$(call LATEXMK_SELECT, -C)
help:
@echo $(INSTRUCTIONS)
%/:
mkdir -p $@
setup: .FORCE | $(BUILDDIR)/
.PHONY: all presentation handout notes clean distclean .FORCE
.PHONY: all build log view preview clean distclean .FORCE
.EXPORT_ALL_VARIABLES:
export JOBNAME=$(JOBNAME)
TEXINPUTS := :.:$(TEXDIRS)
# bibtex invoked from BUILDDIR, thus prepend './../'
BSTINPUTS := ./../$(BSTDIR)
......
= FHTW LaTeX Beamer Template
= image:https://es.technikum-wien.at/sabic/fhtw-latex-slides/raw/logo/.img/fhtw-latex-slides.svg[] FHTW LaTeX Beamer Template
Template for LaTeX beamer slides (FHTW).
== Make
// == Make
You can build presentation, handout, and notes variants of `$BASENAME` with
// You can build presentation, handout, and notes variants of `$BASENAME` with
----
$ make presentation
$ make handout
$ make notes
----
// ----
// $ make presentation
// $ make handout
// $ make notes
// ----
or create all three with
// or create all three with
----
$ make all
----
// ----
// $ make all
// ----
// The results are placed in `$BUILDDIR`.
// Auxiliary files can be deleted with
// ----
// $ make clean
// ----
// and all files with
// ----
// $ make distclean
// ----
== Help Instructions
Provided targets:
build, view, preview, log, clean, distclean, help
Three environment variables are used to configure the behavior of those targets:
* `*pass:q[<font color="#118F7D">$TARGET</font>]*` is used to specify the tex file to compile (default: `pass:q[<font color="#118F7D">$BASENAME</font>]`).
* `*pass:q[<font color="#118F7D">$VARIANTS</font>]*` is used to specify none, one, or multiple variants (default: `pass:q[<font color="#118F7D">$BASEVARIANTS</font>]`).
* `*pass:q[<font color="#118F7D">$OPTS</font>]*` is used to pass additional options to latexmk.
---
The results are placed in `$BUILDDIR`.
Auxiliary files can be deleted with
.pass variables with `make` command
====
[subs=+macros]
----
$ make clean
pass:q[
$ make <font color="#118F7D">*OPTS*</font>=-gg
$ make <font color="#118F7D">*TARGET*</font>=resources/tex/figures/logo *view*
$ make <font color="#118F7D">*VARIANTS*</font>=handout,presentation *build*
$ make <font color="#118F7D">*VARIANTS*</font>=, *view*
]
----
====
and all files with
---
.`export` variables to set them permanently
====
[subs=+macros]
----
$ make distclean
pass:q[
$ <font color="#118F7D">*TARGET*</font>=resources/tex/intro.tex
$ <font color="#118F7D">*VARIANTS*</font>=notes
$ make
$ make *preview*
$ make *clean*
]
----
====
== Features
......@@ -37,11 +82,13 @@ This beamer template provides various features, viz.
* `*.latexmkrc*` configuration
* One source file, three different variants, i.e.,
** link:build/demo-presentation.pdf[*Presentation*]:
** link:build/demo-handout.pdf[*Handout*]:
** link:build/demo-notes.pdf[*Notes*]:
* *Acronyms*
* *Bibliography/References*
** link:build/demo-presentation.pdf[*Presentation*]
** link:build/demo-handout.pdf[*Handout*]
** link:build/demo-notes.pdf[*Notes*]
* Modularized (and resuable) slides, figures, tables, etc. (`standalone`), e.g.,
** link:build/title.pdf[*Title Page*]
** link:build/control-system.pdf[*Figure*]
** link:build/siunits.pdf[*Table*]
* *Sidebar* with
** Progressbar
** Table of Content
......@@ -52,14 +99,17 @@ This beamer template provides various features, viz.
** Acronyms (`acro`)
** References (`natbib`)
** Itemize, Enumerate, Description, Block
** Figures
** Formulas
** Illustrations
** Listings
** Tables (`tabu`)
== Notes
For documentation on the various LaTeX packages use
.read documentation on the various `LaTeX` packages
====
----
$ texdoc <package>
----
====
\ No newline at end of file
No preview for this file type
No preview for this file type
\documentclass{beamer}
% \usepackage[texcoord,grid,gridunit=mm,gridcolor=red!10,subgridcolor=green!10]{eso-pic}
\usepackage{pgfpages} % multi screen mode
% Enable two-screen mode only for notes
\makeatletter
\@ifclasswith{beamer}{notes}{\setbeameroption{show notes on second screen=right}}{}
\makeatother
% ----------------------------------------------------------------------------------------------------------------------------
% Bibliography/References
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[square,numbers,sort]{natbib}
% TODO: provide examples
\usepackage{usebib}
\bibinput{references}
\setlength{\bibsep}{1em}
% \bibliographystyle{./../\bstpath IEEEtranSNC}
\bibliographystyle{IEEEtranSNC}
% \interfootnotelinepenalty=10000
% ----------------------------------------------------------------------------------------------------------------------------
% Languagues
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[french,german,english]{babel}
% ----------------------------------------------------------------------------------------------------------------------------
% Styles & Packages
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[subpreambles,sort]{standalone}
\usepackage{preamble}
\usepackage{fhtw}
\usepackage{custom}
\usepackage{lipsum}
\usepackage{adjustbox}
\usepackage{appendixnumberbeamer}
% ----------------------------------------------------------------------------------------------------------------------------
% Customization
% ----------------------------------------------------------------------------------------------------------------------------
% Title
\makeatletter \def\currentdate{\@date} \makeatother
\def\title{Presentation Title}
\def\shorttitle{\hspace{1.75em}\title}
\def\authorname{Robin Forest}
\def\authortext{\href{mailto:me@technikum-wien.at;other@technikum-wien.at?subject=\title}{Ausgef\"uhrt von: \authorname}}
\def\studentid{Personenkennzeichen: 1234567890}
\def\supervisortitle{Betreuer:}
\def\supervisor{1\textsuperscript{st} Supervisor}
\def\secondsupervisor{2\textsuperscript{nd} Supervisor}
\def\place{Vienna}
% Colors
\def\primarycolor{tw-blue}
\def\secondarycolor{tw-green}
\def\accentcolor{tw-gray}
% Misc
\author{\authorname}
% ----------------------------------------------------------------------------------------------------------------------------
% Units
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[binary-units]{siunitx}
\usepackage{xfrac}
\sisetup{quotient-mode=fraction,fraction-function=\sfrac,product-units=single,exponent-product=\times}
% ----------------------------------------------------------------------------------------------------------------------------
% Tables
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage{booktabs,tabu}
\usepackage{multirow}
\usepackage{multicol}
% ----------------------------------------------------------------------------------------------------------------------------
% Hyperlinks
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage{hyperref}
\hypersetup{
% colorlinks = false, linkbordercolor = {white}, linkbordercolor = tw-green!50, linkbordercolor = white,
% anchorcolor= tw-green, anchorcolor= white!0, citebordercolor = tw-gray!50, urlbordercolor = tw-blue!50,
colorlinks = true,
anchorcolor = black,
linkcolor = \primarycolor,
citecolor = \primarycolor,
urlcolor = \primarycolor
}
% ----------------------------------------------------------------------------------------------------------------------------
% Acronyms
% ----------------------------------------------------------------------------------------------------------------------------
\usepackage[hyperref=true]{acro}
\acsetup{first-long-format=\itshape}
\input{acronyms}
% ----------------------------------------------------------------------------------------------------------------------------
% ----------------------------------------------------------------------------------------------------------------------------
% Required for correct coloring of frames created because of `allowframebreaks` option.
\setbeamercolor{frametitle}{fg=tw-blue}
\begin{document}
\def\biblio{}
\def\bibliolist{}
% Add acronyms used in images or not used at all by adding to the list
\acuse{FHTW,FG}
% ----------------------------------------------------------------------------------------------------------------------------
% Title & ToC
% ----------------------------------------------------------------------------------------------------------------------------
\begin{frame}[plain]
\titlepage
\addtocounter{framenumber}{-1}
\end{frame}
\input{title}
\begin{frame}[plain]{Outline}
\begin{frame}[plain]{Outline}
\tableofcontents[subsubsectionstyle=hide]
\addtocounter{framenumber}{-1}
\end{frame}
\end{frame}
% ----------------------------------------------------------------------------------------------------------------------------
% Intro
% ----------------------------------------------------------------------------------------------------------------------------
\section{Intro}
\begin{frame}{Introduction}
\ac{ES}-style beamer template of \acs{UAS} Technikum Wien.
\end{frame}
\note{
Introduction
\begin{itemize}
\item Issue 1
\item Issue 2
\item Issue 3
\end{itemize}
}
\input{intro}
% ----------------------------------------------------------------------------------------------------------------------------
% Main Content
% ----------------------------------------------------------------------------------------------------------------------------
\section{Content}
\begin{frame}[allowframebreaks]{Demonstration}
\begin{itemize}\itemsep3em
\item References
\item Itemize
\item Enumerate
\item Description
\item Block
\item Figures
\item Tables
\item Listings
\end{itemize}
\end{frame}
\subsection{References}
\begin{frame}{Demonstration}{References}
\begin{itemize}\itemsep2em
\item \citet{einstein1905}
\item \citet{pentz2004}
\item \citet{latexcompanion}
\item \citet{daniel1998}
\item \citet{knuthwebsite}
\item \cite{article, book, booklet}
\end{itemize}
\end{frame}
\subsection{Textual}
\begin{frame}{Demonstration}{Itemize}
\begin{itemize}\itemsep3em
\item<1-> One
\item<2-> Two
\item<3-> Three
\begin{itemize}\itemsep1em
\item<4-> Four
\item<5-> Five
\item<6-> Six
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}{Demonstration}{Enumerate}
\begin{enumerate}\itemsep3em
\item<1-> One
\item<2-> Two
\item<3-> Three
\end{enumerate}
\end{frame}
\begin{frame}{Demonstration}{Description}
\begin{description}\itemsep2em
\item<1-> [Ant] Ameise
\item<2-> [Elephant] Elefant
\item<3-> [Bee] Biene
\item<4-> [Honey] Honig
\end{description}
\end{frame}
\begin{frame}{Demonstration}{Block}
\begin{block}<1->{This is a block}
Lipsum ipsum dolor sit amet, consectetur elit. Morbi ac arcu est, vel poseuere velit.
In congue erat vel lorem ornare pretium.
\end{block}
\begin{exampleblock}<2->{This is an exampleblock}
Lipsum ipsum dolor sit amet, consectetur elit. Morbi ac arcu est, vel poseuere velit.
In congue erat vel lorem ornare pretium.
\end{exampleblock}
\begin{alertblock}<3->{This is an alertblock}
Lipsum ipsum dolor sit amet, consectetur elit. Morbi ac arcu est, vel poseuere velit.
In congue erat vel lorem ornare pretium.
\end{alertblock}
\end{frame}
\subsection{Illustrations}
\begin{frame}{Demonstration}{Figures}
\begin{figure}
\centering
\includegraphics<1|handout:0>[width=0.4\textwidth]{dilbert1.pdf}%
\includegraphics<2|handout:0>[width=0.4\textwidth]{dilbert2.pdf}%
\includegraphics<3|handout:0>[width=0.4\textwidth]{dilbert3.pdf}%
\includegraphics<handout>[width=0.3\textwidth]{dilbert1.pdf}%
\includegraphics<handout>[width=0.3\textwidth]{dilbert2.pdf}%
\includegraphics<handout>[width=0.3\textwidth]{dilbert3.pdf}%
\caption{\textcopyright~2018 Scott Adams, \url{dilbert.com}}
\label{fig:figure1}
\end{figure}
\end{frame}
\begin{frame}{Demonstration}{Listings}
\begin{adjustbox}{center,max width=0.85\textwidth,max height=\textheight}
\lstinputlisting[
caption={C Syntax Highlighting},
label=lst:listing1,
style=c,
emph={EXIT_SUCCESS},
breaklines=true,
]{main.c}
\end{adjustbox}
\end{frame}
\subsection{Tables}
\begin{frame}{Demonstration}{Tables}
\begin{table}
\setlength{\leftmargini}{4mm}
\centering\scriptsize
\begin{tabu} to 0.95\linewidth {X[2]XXX} \toprule
Material & Symbol & $E_{\textup{g}}$ (\si{\electronvolt}) & Type \\
\midrule
\rowfont\bfseries
\multicolumn{4}{c}{Elements} \\
diamond & $C$ & 5.46 & i \\
silicon & $Si$ & 1.12 & i \\
germanium & $Ge$ & 0.67 & i \\
selenium & $Se$ & 1.74 & d \\
\midrule
\rowfont\bfseries
\multicolumn{4}{c}{IV-IV Compounds} \\
silicon carbide & $SiC 3C$ & \num{2.36} & i \\
silicon carbide & $SiC 4H$ & \num{3.28} & i \\
silicon carbide & $SiC 6H$ & \num{3.03} & i \\
\midrule
\rowfont\bfseries
\multicolumn{4}{c}{III-V Compounds} \\
indium phosphide & $InP$ & \num{1.27} & d \\
indium arsenide & $InAs$ & \num{0.355} & d \\
gallium nitride & $GaN$ & \num{3.37} & d \\
gallium arsenide & $GaAs$ & \num{1.42} & d \\
aluminium nitride & $AlN$ & \num{6.2} & d \\
\bottomrule
\end{tabu}
\caption{The bandgab of some semiconductors.}
\label{tab:table1}
\end{table}
\end{frame}
\begin{frame}{Demonstration}{Tables}
\begin{table}
% \tabulinesep=0mm
% \extrarowsep=0mm
% \extratabsurround=0mm
\setlength{\leftmargini}{4mm}
\centering
\resizebox{0.95\linewidth}{!}{%
\begin{tabu} to 2.5\linewidth {X[0.2,m]X[0.25,m]X[0.35,m]X[0.3,m]X[c,m]} \toprule
% \everyrow{\midrule}
\rowfont{\large\bfseries}
Unit name & Unit Symbol & Dimension symbol & Quanitity name & Definition\textsuperscript{\normalfont 1}
\\ \midrule
\rowfont{\Large}
\textbf{metre} & \si{\m} & L & length &
\begin{itemize}\footnotesize
\item \textbf{Prior} (\num{1793}): \SI{1/10000000}{} of the meridian through Paris between the North Pole and the Equator.\textsuperscript{FG}
\item \textbf{Interim} (\num{1960}): \SI{1650763.73}{} wavelengths in a vacuum of the radiation corresponding to the transition
between the $\num{2} \textmd{p}^{\num{10}}$ and $\num{5} \textmd{d}^{\num{5}}$ quantum levels of the krypton-\num{86} atom.
\item \textbf{Current} (\num{1983}): The distance travelled by light in vacuum in \SI{1/299792458}{\second}.
\end{itemize}