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 -*- # -*- cperl -*-
# latexmkrc # latexmkrc
$builddir = $ENV{'BUILDDIR'}; $builddir = $ENV{'BUILDDIR'};
$job = $ENV{'JOBNAME'};
$bibdirs = $ENV{'BIBDIRS'}; $bibdirs = $ENV{'BIBDIRS'};
$target = $ENV{'TARGET'};
$type = $ENV{'TYPE'}; $type = $ENV{'TYPE'};
$viewer = $ENV{'VIEWER'}; $viewer = $ENV{'VIEWER'};
...@@ -14,11 +14,12 @@ $dependents_list = 1; ...@@ -14,11 +14,12 @@ $dependents_list = 1;
$silence_logfile_warnings = 0; $silence_logfile_warnings = 0;
$use_make_for_missing_files = 1; $use_make_for_missing_files = 1;
$out_dir = $builddir; $out_dir = $builddir;
$deps_file = "$builddir/$target.deps"; $deps_file = "$out_dir/$job.deps";
$jobname = $job;
@BIBINPUTS = ('.',$bibdirs); @BIBINPUTS = ('.',$bibdirs);
# $bibtex = 'bibtex %O %B'; # $bibtex = 'bibtex %O %B';
$pdflatex = join '', 'pdflatex %O -interaction=nonstopmode -synctex=1 -file-line-error "\PassOptionsToClass{', $type, '}{beamer} \input{%S}"'; $pdflatex = join '', 'pdflatex %O -interaction=nonstopmode -synctex=1 -file-line-error "\PassOptionsToClass{', $type, '}{beamer} \input{%S}"';
$pdf_previewer = $viewer; $pdf_previewer = $viewer;
push @generated_exts, 'blg', 'cut', 'nav', 'snm', 'vrb', 'synctex.gz'; push @generated_exts, 'blg', 'cut', 'nav', 'snm', 'sta', 'vrb', 'synctex.gz';
\ No newline at end of file \ 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
BUILDDIR = build BASENAME = demo
VARIANTS = presentation handout notes BUILDDIR = build
BASEVARIANTS = presentation,handout,notes
# space separated list of requested variants
VARIANTSLIST = $(eval comma:=,) $(subst $(comma), ,$(VARIANTS))
# Environment # Environment
TEXDIRS = resources/latex/:resources/latex-sty/:resources/images/:resources/listings/ TEXDIRS = resources/latex/:resources/latex-sty/:resources/images/:resources/listings/
BIBDIRS = resources/latex/ TEXDIRS := $(TEXDIRS):resources/figures:resources/tables:resources/tex
BSTDIR = resources/latex-bst/ BIBDIRS = resources/latex/
BSTDIR = resources/latex-bst/
# cf. latexmkrc # cf. latexmkrc
LATEXMKV = export TYPE=$1 TARGET="$(BASENAME)-$1" && latexmk -jobname="$(BASENAME)-$1" $2 LATEXMK = latexmk $(OPTS) $2 $1.tex | fold -sw $(out_length)
LATEXMK = export TYPE= TARGET="$(basename $(notdir $1))" && latexmk $(basename $1)$2 VIEWER = xdg-open
VIEWER = xdg-open
# main targets # main targets
all: $(VARIANTS) all: build
clean: build: setup
find $(BUILDDIR) -type f -not -name "*.pdf" -delete $(call LATEXMK_SELECT, )
distclean: log: setup
rm -rf $(BUILDDIR) $(call LATEXMK_ERRS, $(TARGET))
define TEMPLATE = view: setup
$(BASENAME)-$(strip $(1)).pdf $(strip $(1)).build $(1): setup $(call LATEXMK_SELECT, -pv)
$(call LATEXMKV,$(strip $(1)),)
$(strip $(1)).view: setup preview: setup
$(call LATEXMKV,$(strip $(1)),-pv) $(call LATEXMK_PREVIEW, -pvc)
$(strip $(1)).preview: setup
$(call LATEXMKV,$(strip $(1)),-pvc) clean: setup
$(strip $(1)).clean: setup $(call LATEXMK_SELECT, -c)
$(call LATEXMKV,$(strip $(1)),-c)
$(strip $(1)).distclean: setup distclean: setup
$(call LATEXMKV,$(strip $(1)),-C) $(call LATEXMK_SELECT, -C)
endef
help:
$(foreach variant, $(VARIANTS), $(eval $(call TEMPLATE, $(variant)))) @echo $(INSTRUCTIONS)
# 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)
%/: %/:
mkdir -p $@ mkdir -p $@
setup: .FORCE | $(BUILDDIR)/ setup: .FORCE | $(BUILDDIR)/
.PHONY: all presentation handout notes clean distclean .FORCE .PHONY: all build log view preview clean distclean .FORCE
.EXPORT_ALL_VARIABLES: .EXPORT_ALL_VARIABLES:
export JOBNAME=$(JOBNAME)
TEXINPUTS := :.:$(TEXDIRS) TEXINPUTS := :.:$(TEXDIRS)
# bibtex invoked from BUILDDIR, thus prepend './../' # bibtex invoked from BUILDDIR, thus prepend './../'
BSTINPUTS := ./../$(BSTDIR) 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). 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 presentation
$ make handout // $ make handout
$ make notes // $ 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
// ----
The results are placed in `$BUILDDIR`. == Help Instructions
Auxiliary files can be deleted with
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.
---
.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 == Features
...@@ -37,11 +82,13 @@ This beamer template provides various features, viz. ...@@ -37,11 +82,13 @@ This beamer template provides various features, viz.
* `*.latexmkrc*` configuration * `*.latexmkrc*` configuration
* One source file, three different variants, i.e., * One source file, three different variants, i.e.,
** link:build/demo-presentation.pdf[*Presentation*]: ** link:build/demo-presentation.pdf[*Presentation*]
** link:build/demo-handout.pdf[*Handout*]: ** link:build/demo-handout.pdf[*Handout*]
** link:build/demo-notes.pdf[*Notes*]: ** link:build/demo-notes.pdf[*Notes*]
* *Acronyms* * Modularized (and resuable) slides, figures, tables, etc. (`standalone`), e.g.,
* *Bibliography/References* ** link:build/title.pdf[*Title Page*]
** link:build/control-system.pdf[*Figure*]
** link:build/siunits.pdf[*Table*]
* *Sidebar* with * *Sidebar* with
** Progressbar ** Progressbar
** Table of Content ** Table of Content
...@@ -52,14 +99,17 @@ This beamer template provides various features, viz. ...@@ -52,14 +99,17 @@ This beamer template provides various features, viz.
** Acronyms (`acro`) ** Acronyms (`acro`)
** References (`natbib`) ** References (`natbib`)
** Itemize, Enumerate, Description, Block ** Itemize, Enumerate, Description, Block
** Figures ** Formulas
** Illustrations
** Listings ** Listings
** Tables (`tabu`) ** Tables (`tabu`)
== Notes == Notes
For documentation on the various LaTeX packages use
.read documentation on the various `LaTeX` packages
====
---- ----
$ texdoc <package> $ texdoc <package>
---- ----
\ No newline at end of file ====
\ No newline at end of file
No preview for this file type
No preview for this file type
\documentclass{beamer} \documentclass{beamer}
% \usepackage[texcoord,grid,gridunit=mm,gridcolor=red!10,subgridcolor=green!10]{eso-pic} % \usepackage[texcoord,grid,gridunit=mm,gridcolor=red!10,subgridcolor=green!10]{eso-pic}
\usepackage{pgfpages} % multi screen mode \usepackage[subpreambles,sort]{standalone}
\usepackage{preamble}
% 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{fhtw} \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} \begin{document}
\def\biblio{}
\def\bibliolist{}
% Add acronyms used in images or not used at all by adding to the list % Add acronyms used in images or not used at all by adding to the list
\acuse{FHTW,FG} \acuse{FHTW,FG}
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
% Title & ToC % Title & ToC
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
\begin{frame}[plain] \input{title}
\titlepage
\addtocounter{framenumber}{-1} \begin{frame}[plain]{Outline}
\end{frame} \tableofcontents[subsubsectionstyle=hide]
\addtocounter{framenumber}{-1}
\begin{frame}[plain]{Outline} \end{frame}
\tableofcontents[subsubsectionstyle=hide]
\addtocounter{framenumber}{-1}
\end{frame}
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
% Intro % Intro
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
\section{Intro} \input{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}
}
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
% Main Content % Main Content
% ---------------------------------------------------------------------------------------------------------------------------- % ----------------------------------------------------------------------------------------------------------------------------
\section{Content} \input{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