summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/gridslides
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/gridslides
Initial commit
Diffstat (limited to 'macros/latex/contrib/gridslides')
-rw-r--r--macros/latex/contrib/gridslides/Makefile22
-rw-r--r--macros/latex/contrib/gridslides/README.md85
-rwxr-xr-xmacros/latex/contrib/gridslides/compile.pl79
-rw-r--r--macros/latex/contrib/gridslides/example.pdfbin0 -> 326392 bytes
-rw-r--r--macros/latex/contrib/gridslides/example.tex111
-rw-r--r--macros/latex/contrib/gridslides/figures/band02.pngbin0 -> 58080 bytes
-rw-r--r--macros/latex/contrib/gridslides/figures/band08.pngbin0 -> 60724 bytes
-rw-r--r--macros/latex/contrib/gridslides/figures/cnontrivial.pdfbin0 -> 15227 bytes
-rw-r--r--macros/latex/contrib/gridslides/figures/ctrivial.pdfbin0 -> 17042 bytes
-rw-r--r--macros/latex/contrib/gridslides/figures/qahe.pdfbin0 -> 11865 bytes
-rw-r--r--macros/latex/contrib/gridslides/figures/qshe.pdfbin0 -> 12219 bytes
-rw-r--r--macros/latex/contrib/gridslides/figures/skyrmion.pdfbin0 -> 27442 bytes
-rw-r--r--macros/latex/contrib/gridslides/figures/trivial.pdfbin0 -> 26646 bytes
-rw-r--r--macros/latex/contrib/gridslides/gridslides.cls10
-rw-r--r--macros/latex/contrib/gridslides/gridslides.pdfbin0 -> 135427 bytes
-rw-r--r--macros/latex/contrib/gridslides/gridslides.sty235
16 files changed, 542 insertions, 0 deletions
diff --git a/macros/latex/contrib/gridslides/Makefile b/macros/latex/contrib/gridslides/Makefile
new file mode 100644
index 0000000000..a8114887b8
--- /dev/null
+++ b/macros/latex/contrib/gridslides/Makefile
@@ -0,0 +1,22 @@
+# Package: gridslides
+# Description: LaTeX package to create free form slides with blocks placed on a grid
+# File: Makefile
+# Author: Daniel Mendler <mail@daniel-mendler.de>
+# Version: 0.1.1
+# Date: 2017-11-28
+# License: GPL2 or LPPL1.3 at your option
+# Homepage: https://github.com/minad/gridslides
+
+example.pdf: example.tex
+ ./compile.pl --once example.tex
+
+clean:
+ rm -rf auto output example.pdf gridslides.zip gridslides gridslides.pdf
+
+gridslides.pdf: README.md
+ pandoc README.md -o gridslides.pdf
+
+dist: gridslides.pdf example.pdf *.cls *.sty README.md
+ for i in $$(git ls-files | grep -v .gitignore); do mkdir -p gridslides/$$(dirname $$i); cp $$i gridslides/$$i; done
+ zip -r gridslides.zip gridslides
+ rm -rf gridslides
diff --git a/macros/latex/contrib/gridslides/README.md b/macros/latex/contrib/gridslides/README.md
new file mode 100644
index 0000000000..5b286c44e2
--- /dev/null
+++ b/macros/latex/contrib/gridslides/README.md
@@ -0,0 +1,85 @@
+# gridslides: LaTeX package to create free form slides with blocks placed on a grid
+
+This package allows to create free form slides with blocks placed on a grid.
+The blocks can be filled with text, equations, figures etc.
+This allows more flexible slides similar compared to LaTeX beamer.
+Sequential unconvering of elements is supported.
+A compiler script is provided which compiles each slide separately, avoiding long compile times this way.
+
+## Example
+
+See the file `example.tex` and `example.pdf`. Each slide is compiled separately using `compile.pl example.tex`.
+
+## Supported commands
+
+This package provides only a handful of commands, which
+allow to create slides and with blocks at fixed positions.
+
+### Slides/Pages
+
+```latex
+\begin{slide}{Slide title}
+ Slide content
+\end{slide}
+
+\begin{rawslide}
+ Raw slide without title and style
+\end{rawslide}
+
+\begin{style}
+ Define style which underlies all slides.
+ Best used together with \bg{filename}!
+\end{style}
+
+\begin{style}
+ \bg{figure-filename}
+\end{style}
+```
+
+### Slide content blocks
+
+The slide is divided in a 32x24 grid.
+
+```latex
+\bg{figure-filename}
+\txt(x,y){Text content}
+\block(x,y,w){Arbitrary content}
+\fig(x,y,w){figure-filename}
+\eq(x,y){a^2 + b^2 = c^2}
+```
+
+### Sequential uncovering
+
+Each slide can be split in multiple steps by defining blocks with `<n-m>` annotations.
+
+```latex
+\txt<1->(x,y){On slide step 1 to n}
+\block<2>(x,y,w){Only on step 2}
+\only<2-3>{
+ \block(x,y){Block content}
+}
+```
+
+### Metadata
+
+```latex
+\author{Author} defines \theauthor
+\title{Presentation Title} defines \thetitle
+\date{Date} defines \thedate
+\institute{Institute} defines \theinstitute
+\theheadline defined by slide title
+\theslide defined by slide number
+```
+
+## Alternatives
+
+* beamer
+* ffslides
+* prosper
+* pure tikz or pstricks
+
+## License
+
+Copyright (c) 2017 Daniel Mendler. The package is dual-licensed
+under the GNU General Public License, version 2 and
+the LaTeX Project Public License 1.3 at your option.
diff --git a/macros/latex/contrib/gridslides/compile.pl b/macros/latex/contrib/gridslides/compile.pl
new file mode 100755
index 0000000000..b488a08b38
--- /dev/null
+++ b/macros/latex/contrib/gridslides/compile.pl
@@ -0,0 +1,79 @@
+#!/usr/bin/perl
+# Package: gridslides
+# Description: LaTeX package to create free form slides with blocks placed on a grid
+# File: compile.pl
+# Author: Daniel Mendler <mail@daniel-mendler.de>
+# Version: 0.1.1
+# Date: 2017-11-28
+# License: GPL2 or LPPL1.3 at your option
+# Homepage: https://github.com/minad/gridslides
+
+use strict;
+use Digest::MD5 qw(md5_hex);
+use File::Slurp qw(read_file write_file);
+
+sub load_file {
+ my ($file) = @_;
+ my $code = read_file($file);
+ $code =~ /\A(.*?\\begin\{document\})/s;
+ return ($1, $');
+}
+
+sub compile_slide {
+ my ($format, $slide, $body) = @_;
+
+ my $code = "%&$format\n\\begin{document}\\setcounter{slide}{$slide}\n$body\n\\end{document}\n";
+ my $hash = md5_hex($code);
+ my $pdf = "$hash.pdf";
+ unless (-e $pdf) {
+ my $tex = "$hash.tex";
+ write_file($tex, $code);
+ print "Compiling slide $slide - $tex...\n";
+ `pdflatex -interaction=batchmode $tex; biber $hash; pdflatex -interaction=batchmode $tex; pdflatex -interaction=batchmode $tex`;
+ }
+
+ return $pdf;
+}
+
+my $once = 0;
+my $file;
+if ($ARGV[0] eq "--once") {
+ $file = $ARGV[1];
+ $once = 1;
+} else {
+ $file = $ARGV[0];
+}
+
+my $result = $file;
+$result =~ s/\.tex\Z//g;
+$result .= '.pdf';
+
+my $out = 'output';
+mkdir($out);
+chdir($out);
+$ENV{TEXINPUTS}='..:.:';
+$ENV{BIBINPUTS}='..';
+
+my ($header, $body) = load_file "../$file";
+my $format = "header$file";
+write_file("$format.tex", "$header\n\\end{document}");
+`pdftex -interaction=batchmode -ini -jobname="$format" '&pdflatex' mylatexformat.ltx "$format.tex"`;
+
+do {
+ my @slides = ();
+ my $slide = 1;
+ while ($body =~ /(\\maketitle|\\begin\{.*?slide\}.*?\\end\{.*?slide\})/sg) {
+ my $pdf = compile_slide "$format", $slide, $1;
+ push @slides, $pdf if (-e $pdf);
+ ++$slide;
+ }
+
+ print "Joining $result...\n";
+ `pdfjoin -q -o $result @slides`;
+ rename $result, "../$result";
+
+ unless ($once) {
+ `inotifywait -e modify ../$file`;
+ (my $unused, $body) = load_file "../$file";
+ }
+} until ($once);
diff --git a/macros/latex/contrib/gridslides/example.pdf b/macros/latex/contrib/gridslides/example.pdf
new file mode 100644
index 0000000000..b05e2e770f
--- /dev/null
+++ b/macros/latex/contrib/gridslides/example.pdf
Binary files differ
diff --git a/macros/latex/contrib/gridslides/example.tex b/macros/latex/contrib/gridslides/example.tex
new file mode 100644
index 0000000000..8a0005673f
--- /dev/null
+++ b/macros/latex/contrib/gridslides/example.tex
@@ -0,0 +1,111 @@
+% Package: gridslides
+% Description: LaTeX package to create free form slides with blocks placed on a grid
+% File: example.tex
+% Author: Daniel Mendler <mail@daniel-mendler.de>
+% Version: 0.1.1
+% Date: 2017-11-28
+% License: GPL2 or LPPL1.3 at your option
+% Homepage: https://github.com/minad/gridslides
+\documentclass{gridslides}
+
+\usepackage{cmbright}
+
+\newcommand{\hcterm}{\text{H.c.}}
+\newcommand{\nodag}{{\phantom{\dag}}}
+\newcommand{\hc}{^\dag}
+\newcommand{\trans}{^\intercal}
+\newcommand{\nohc}{^\nodag}
+\newcommand{\OpH}{\ensuremath{\mathcal{H}}\xspace}
+\newcommand{\HH}{\ensuremath{\widehat{\OpH}}\xspace}
+\renewcommand{\vec}[1]{\ensuremath{\boldsymbol{#1}}\xspace}
+
+\definecolor{bordercolor}{HTML}{23373b}
+\newcommand{\border}{
+ \block(0,0,32){\tikz\fill[bordercolor] (0,0) rectangle (128mm,2mm);}
+ \block(0,22,32){\tikz\fill[bordercolor] (0,0) rectangle (128mm,8mm);}
+}
+\newcommand{\logo}{\Large\textbf{\color{bordercolor}\TeX}}
+
+\author{Author}
+\title{Presentation Title}
+\date{\today}
+\institute{Institute~$\cdot$~University}
+
+\begin{style}
+ \border
+ \txt(28,1.5){\logo}
+ \block(1.5,2,26){\LARGE\theheadline}
+ \txt(1,22.8){\color{white}\theslide}
+ \txt(4,22.9){\color{white}\scriptsize\theauthor~$\cdot$~\thetitle}
+\end{style}
+
+\begin{document}
+
+\begin{rawslide}
+ \border
+ \txt(28,1.5){\logo}
+ \block(2,5,28){\LARGE\thetitle}
+ \txt(2,9.5){\theauthor~$\cdot$~\thedate}
+ \txt(2,11.7){\footnotesize\theinstitute}
+\end{rawslide}
+
+\begin{slide}{Overview}
+ \block(1.5,5,29){
+ \begin{enumerate}[1.]
+ \item Topological phases
+ \item 1D p-wave superconductor
+ \end{enumerate}
+ }
+\end{slide}
+
+\begin{slide}{Topological Phases}
+ \fig(3,4,12){qahe}
+ \fig(17,4,12){qshe}
+ \txt(6,11){Conducting edge channels $\longleftrightarrow$ Non-trivial bandstructure}
+
+ \txt<2->(1.5,12.5){QAHE bulk Hamiltonian $\HH(\vec{k}) = \vec{g}(\vec{k})\cdot\vec{\sigma}$}
+ \eq<2->(13,14.2){\vec{g}(k_x,k_y) = \left(\sin k_x, \sin k_y, \cos k_x + \cos k_y - M \right)\trans}
+
+ \only<3>{
+ \fig(0.5,15,16){skyrmion}
+ \eq(4,20){M=1}
+ \block(4,15,5){\tikz \node[fill=white,text=red!90!black,inner sep=0.5mm]
+ {non-trivial};}
+
+ \fig(15,16,16){trivial}
+ \eq(18,21){M=3}
+ \block(20,17.5,2.2){\tikz \node[fill=white,inner sep=0.5mm,text=blue!90!black]
+ {trivial};}
+ }
+\end{slide}
+
+\begin{slide}{1D p-wave superconductor}
+ \txt(1.5,11){Lattice}
+ \eq(6.5,10){\OpH = \sum_{i=1}^{n-1} \left [ t c_i\hc c_{i+1}\nohc + \Delta c\nohc_i c\nohc_{i+1} + \hcterm \right] - \mu \sum_{i=1}^n c_i\hc c_i\nohc}
+
+ \fig(2,4,12){ctrivial}
+ \fig(18,5.5,12){cnontrivial}
+
+ \block<2->(26,10.5,4){%
+ \tikz \node[draw=red,inner sep=1mm] {
+ \scriptsize Majorana operators
+ $\begin{aligned}
+ \gamma_j\nohc &= \frac{c_j\nohc + c_j\hc}{2}\\
+ \gamma_j' &= \frac{c_j\nohc - c_j\hc}{2 \imath}
+ \end{aligned}$
+ };
+ }
+
+ \only<3>{
+ \fig(3,13.5,9){band02}
+ \txt(5,13.5){t=0.2}
+
+ \fig(16,13.5,9){band08}
+ \txt(18,13.5){t=0.8}
+
+ \txt(4,20.5){Bulk}
+ \eq(9,20.3){\HH(k) = (2t \cos k - \mu)\tau_z - 2\Delta\sin k\, \tau_y\qquad\vec{c}_k\hc = \left( c_k\hc,\, c_{-k}\nohc\right)}
+ }
+\end{slide}
+
+\end{document}
diff --git a/macros/latex/contrib/gridslides/figures/band02.png b/macros/latex/contrib/gridslides/figures/band02.png
new file mode 100644
index 0000000000..f6be7deb37
--- /dev/null
+++ b/macros/latex/contrib/gridslides/figures/band02.png
Binary files differ
diff --git a/macros/latex/contrib/gridslides/figures/band08.png b/macros/latex/contrib/gridslides/figures/band08.png
new file mode 100644
index 0000000000..8626561dc8
--- /dev/null
+++ b/macros/latex/contrib/gridslides/figures/band08.png
Binary files differ
diff --git a/macros/latex/contrib/gridslides/figures/cnontrivial.pdf b/macros/latex/contrib/gridslides/figures/cnontrivial.pdf
new file mode 100644
index 0000000000..41940216ed
--- /dev/null
+++ b/macros/latex/contrib/gridslides/figures/cnontrivial.pdf
Binary files differ
diff --git a/macros/latex/contrib/gridslides/figures/ctrivial.pdf b/macros/latex/contrib/gridslides/figures/ctrivial.pdf
new file mode 100644
index 0000000000..75bc39b857
--- /dev/null
+++ b/macros/latex/contrib/gridslides/figures/ctrivial.pdf
Binary files differ
diff --git a/macros/latex/contrib/gridslides/figures/qahe.pdf b/macros/latex/contrib/gridslides/figures/qahe.pdf
new file mode 100644
index 0000000000..9f05e42306
--- /dev/null
+++ b/macros/latex/contrib/gridslides/figures/qahe.pdf
Binary files differ
diff --git a/macros/latex/contrib/gridslides/figures/qshe.pdf b/macros/latex/contrib/gridslides/figures/qshe.pdf
new file mode 100644
index 0000000000..850173fbe0
--- /dev/null
+++ b/macros/latex/contrib/gridslides/figures/qshe.pdf
Binary files differ
diff --git a/macros/latex/contrib/gridslides/figures/skyrmion.pdf b/macros/latex/contrib/gridslides/figures/skyrmion.pdf
new file mode 100644
index 0000000000..521c5a7172
--- /dev/null
+++ b/macros/latex/contrib/gridslides/figures/skyrmion.pdf
Binary files differ
diff --git a/macros/latex/contrib/gridslides/figures/trivial.pdf b/macros/latex/contrib/gridslides/figures/trivial.pdf
new file mode 100644
index 0000000000..b285161fe6
--- /dev/null
+++ b/macros/latex/contrib/gridslides/figures/trivial.pdf
Binary files differ
diff --git a/macros/latex/contrib/gridslides/gridslides.cls b/macros/latex/contrib/gridslides/gridslides.cls
new file mode 100644
index 0000000000..b596b5b056
--- /dev/null
+++ b/macros/latex/contrib/gridslides/gridslides.cls
@@ -0,0 +1,10 @@
+% Package: gridslides
+% Description: LaTeX package to create free form slides with blocks placed on a grid
+% File: gridslides.cls
+% Author: Daniel Mendler <mail@daniel-mendler.de>
+% Version: 0.1.1
+% Date: 2017-11-28
+% License: GPL2 or LPPL1.3 at your option
+% Homepage: https://github.com/minad/gridslides
+\LoadClass{article}
+\RequirePackage{gridslides}
diff --git a/macros/latex/contrib/gridslides/gridslides.pdf b/macros/latex/contrib/gridslides/gridslides.pdf
new file mode 100644
index 0000000000..d386df8127
--- /dev/null
+++ b/macros/latex/contrib/gridslides/gridslides.pdf
Binary files differ
diff --git a/macros/latex/contrib/gridslides/gridslides.sty b/macros/latex/contrib/gridslides/gridslides.sty
new file mode 100644
index 0000000000..65d8185c6f
--- /dev/null
+++ b/macros/latex/contrib/gridslides/gridslides.sty
@@ -0,0 +1,235 @@
+% Package: gridslides
+% Description: LaTeX package to create free form slides with blocks placed on a grid
+% File: gridslides.sty
+% Author: Daniel Mendler <mail@daniel-mendler.de>
+% Version: 0.1.1
+% Date: 2017-11-28
+% License: GPL2 or LPPL1.3 at your option
+% Homepage: https://github.com/minad/gridslides
+\RequirePackage[utf8]{inputenc}
+\RequirePackage{amsmath,amsthm,amssymb}
+\RequirePackage{mathtools}
+\RequirePackage[ngerman]{babel}
+\RequirePackage{braket}
+\RequirePackage{siunitx}
+\RequirePackage{xspace}
+\RequirePackage{dsfont}
+\RequirePackage{microtype}
+\RequirePackage{ragged2e}
+\RequirePackage{tikz}
+\RequirePackage[margin=0mm,paperwidth=128mm,paperheight=96mm]{geometry}
+\RequirePackage{xstring}
+\RequirePackage{enumerate}
+\RequirePackage{environ}
+\RequirePackage[pdfusetitle,bookmarksopen]{hyperref}
+\usetikzlibrary{calc}
+
+% support arrows in overlay
+\tikzstyle{every picture}+=[remember picture]
+
+\pagestyle{empty}
+\graphicspath{{figures/}}
+
+\newif\ifgridslides@grid
+%\gridslides@gridtrue
+\gridslides@gridfalse
+
+\newif\ifgridslides@boxes
+%\gridslides@boxestrue
+\gridslides@boxesfalse
+
+\ifgridslides@boxes%
+\tikzset{gridslides@box/.style={draw=blue}}
+\else
+\tikzset{gridslides@box/.style={}}
+\fi
+
+\def\gridslides@xoff{0}
+\def\gridslides@yoff{0}
+
+\long\def\gridslides@block(#1,#2,#3)#4{%
+ \let\oldxoff\gridslides@xoff%
+ \let\oldyoff\gridslides@yoff%
+ \pgfmathsetmacro\xoff{\gridslides@xoff+#1}%
+ \pgfmathsetmacro\yoff{\gridslides@yoff+#2}%
+ \global\let\gridslides@xoff\xoff%
+ \global\let\gridslides@yoff\yoff%
+ \begin{tikzpicture}[overlay,yscale=-1,shift=(current page.north west)]%
+ \node[gridslides@box,rectangle,anchor=north west,inner sep=0pt,text width=#3*4mm] at (4mm*\xoff,4mm*\yoff)%
+ {%
+ \begingroup%
+ #4%
+ \endgroup%
+ };%
+ \end{tikzpicture}%
+ \global\let\gridslides@xoff\oldxoff%
+ \global\let\gridslides@yoff\oldyoff%
+}
+
+\def\gridslides@fig(#1,#2,#3)#4{\gridslides@block(#1,#2,#3){\includegraphics[width=\textwidth]{#4}}}
+
+\long\def\gridslides@eq(#1,#2)#3{%
+ \gridslides@block(#1,#2,32){%
+ $\begin{aligned}#3\end{aligned}$%
+ }%
+}
+
+\long\def\gridslides@txt(#1,#2)#3{\gridslides@block(#1,#2,32){\mbox{#3}}}
+
+\newcounter{gridslides@totalsteps}
+\newcounter{gridslides@step}
+
+\newcommand{\gridslides@setsteps}[1]{%
+ \ifnum#1>\value{gridslides@totalsteps}%
+ \setcounter{gridslides@totalsteps}{#1}%
+ \fi%
+}
+
+\long\def\gridslides@from<#1->#2#3{%
+ \gridslides@setsteps{#1}%
+ \ifnum\value{gridslides@step}<#1%
+ #3%
+ \else%
+ #2%
+ \fi%
+ }
+
+\long\def\gridslides@only<#1-#2>#3#4{%
+ \gridslides@setsteps{#1}%
+ \gridslides@setsteps{#2}%
+ \ifnum\value{gridslides@step}<#1%
+ #4%
+ \else%
+ \ifnum\value{gridslides@step}>#2%
+ #4%
+ \else%
+ #3%
+ \fi%
+ \fi%
+}
+
+\long\def\alt<#1>#2#3{%
+ \IfSubStr{#1}{-}{%
+ \IfBeginWith{#1}{-}{%
+ \gridslides@only<1#1>{#2}{#3}%
+ }{%
+ \IfEndWith{#1}{-}{%
+ \gridslides@from<#1>{#2}{#3}%
+ }{%
+ \gridslides@only<#1>{#2}{#3}%
+ }%
+ }%
+ }{%
+ \gridslides@only<#1-#1>{#2}{#3}%
+ }%
+}
+
+\long\def\only<#1>#2{\alt<#1>{#2}{}}
+
+\long\def\gridslides@blockhelper#1<#2>(#3)#4{\only<#2>{#1(#3){#4}}}
+\def\gridslides@defblock#1{%
+ \long\expandafter\def\csname#1\endcsname{%
+ \@ifnextchar<{\gridslides@blockhelper{\csname gridslides@#1\endcsname}}{\csname gridslides@#1\endcsname}%
+ }%
+}
+
+\gridslides@defblock{block}
+\gridslides@defblock{fig}
+\gridslides@defblock{eq}
+\gridslides@defblock{txt}
+
+\long\def\gridslides@cmdhelper#1#2<#3>#4{\alt<#3>{#1{#4}}{#2{#4}}}
+\def\gridslides@cmd#1#2{%
+ \expandafter\let\csname gridslides@#1\expandafter\endcsname\csname#1\endcsname%
+ \long\expandafter\def\csname#1\endcsname{%
+ \@ifnextchar<{\gridslides@cmdhelper{\csname gridslides@#1\endcsname}{#2}}{\csname gridslides@#1\endcsname}%
+ }%
+}
+
+\newcommand{\rgb}[1]{\definecolor{gridslides@rgb}{HTML}{#1}\color{gridslides@rgb}}
+
+\gridslides@cmd{textbf}{\relax}
+\gridslides@cmd{textit}{\relax}
+\gridslides@cmd{emph}{\relax}
+\gridslides@cmd{underline}{\relax}
+\def\gridslides@ignore#1{}
+\gridslides@cmd{color}{\gridslides@ignore}
+\gridslides@cmd{rgb}{\gridslides@ignore}
+
+\newcounter{slide}
+\stepcounter{slide}
+
+\newcommand{\gridslides@page}[1]{%
+ \setcounter{gridslides@totalsteps}{1}%
+ \setcounter{gridslides@step}{0}%
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt}%
+ \loop\ifnum\value{gridslides@step}<\value{gridslides@totalsteps}%
+ \stepcounter{gridslides@step}%
+ \clearpage%
+ \begingroup%
+ #1%
+ \endgroup%
+ \repeat%
+ \stepcounter{slide}%
+}
+
+\newcommand{\bg}[1]{%
+ \fig(0,0,32){#1}%
+ \ifgridslides@grid%
+ \begin{tikzpicture}[overlay,yscale=-1,shift=(current page.north west)]%
+ \begin{scope}[x=4mm,y=4mm]%
+ \draw[gray,step=1,line width=0.1pt] (0,0) grid (32,24);%
+ \draw[red,step=8,line width=1pt] (0,0) grid (32,24);%
+ \end{scope}%
+ \end{tikzpicture}%
+ \fi%
+}
+
+\def\gridslides@style{}
+\def\theheadline{}
+
+\newcommand{\gridslides@slide}[2]{%
+ \gridslides@page{%
+ \global\def\theheadline{#1}%
+ \gridslides@style%
+ #2%
+ \ifnum\value{gridslides@step}=1%
+ \pdfbookmark[0]{\theheadline}{slide\theslide}%
+ \fi
+ \ifnum\value{gridslides@totalsteps}>1%
+ \pdfbookmark[1]{Step \thegridslides@step}{slide\theslide.step\thegridslides@step}%
+ \fi
+ }%
+}
+
+\NewEnviron{slide}[1]{\gridslides@slide{#1}{\BODY}}
+\NewEnviron{style}{\global\let\gridslides@style\BODY}
+\NewEnviron{rawslide}{\gridslides@page{\BODY}}
+
+\newcommand{\institute}[1]{\newcommand\@institute{#1}}
+\newcommand{\theauthor}{\@author}
+\newcommand{\thedate}{\@date}
+\newcommand{\thetitle}{\@title}
+\newcommand{\theinstitute}{\@institute}
+
+% undefine some commands from article
+\let\tableofcontents\gridslides@undefined
+\let\addcontentsline\gridslides@undefined
+\let\paragraph\gridslides@undefined
+\let\subparagraph\gridslides@undefined
+\let\chapter\gridslides@undefined
+\let\section\gridslides@undefined
+\let\subsection\gridslides@undefined
+\let\subsubsection\gridslides@undefined
+\let\maketitle\gridslides@undefined
+\let\figure\gridslides@undefined
+\let\table\gridslides@undefined
+\let\pagestyle\gridslides@undefined
+\let\footnote\gridslides@undefined
+\let\bf\gridslides@undefined
+\let\it\gridslides@undefined
+\let\cal\gridslides@undefined
+\let\tt\gridslides@undefined
+\let\listoffigures\gridslides@undefined
+\let\listoftables\gridslides@undefined