commit 157fe4cdb7bbfa3707040f336d9e72c29a3f7cb4
parent 91dfea9d87e88b9ba22640951304a9e1216637dd
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Tue, 24 Sep 2013 18:36:03 +0200
+shorthand
Diffstat:
shorthand.pl | | | 146 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 146 insertions(+), 0 deletions(-)
diff --git a/shorthand.pl b/shorthand.pl
@@ -0,0 +1,146 @@
+#!/usr/bin/perl
+
+# Convert my shorthand to beamer
+
+my $escaping = 0;
+my $in_frame = 0;
+my @env = qw();
+my @envd = qw();
+my $header = <<END;
+\\documentclass{beamer}
+\\usepackage[utf8]{inputenc}
+\\usepackage{graphicx, verbatim, array, xspace, booktabs, tikz, url}
+\\usetheme{Frankfurt}
+\\usecolortheme{beaver}
+\\definecolor{beamer@blendedblue}{rgb}{1,0,0}
+\\colorlet{darkgreen}{green!50!black}
+\\newcommand{\\imgp}[2]{
+ \\begin{figure}
+ \\begin{center}
+ \\includegraphics[scale=#2]{#1.pdf}
+ \\end{center}
+ \\end{figure}
+}
+\\setbeamertemplate{navigation symbols}{}
+\\makeatletter
+\\setbeamertemplate{footline}
+{%
+ \\hfill \\insertframenumber/\\inserttotalframenumber \\hspace{0.2cm}
+ \\vspace{0.2cm}
+}%
+\\makeatother
+\\AtBeginSection[]
+{
+ \\ifnumcomp{\\value{section}}{=}{1}{}
+ {
+ \\begin{frame}<beamer>
+ \\frametitle{Table of contents}
+ \\tableofcontents[currentsection]
+ \\end{frame}
+}
+}
+END
+
+
+my $header2 = <<END;
+\\begin{document}
+
+\\begin{frame}
+\\titlepage
+\\end{frame}
+END
+
+
+# \title{Taxonomy-Based Crowd Mining}
+# \author[shortname]{\textbf{Antoine Amarilli}\inst{1,2} \and Yael Amsterdamer\inst{1} \and Tova Milo\inst{1}}
+# \institute[shortinst]{\inst{1} Tel Aviv University, Tel Aviv, Israel \and \inst{2} \'Ecole normale sup\'erieure, Paris, France}
+# \titlegraphic{\includegraphics[height=2cm,keepaspectratio]{tau.pdf}\hfill\includegraphics[height=2cm, keepaspectratio]{ens.eps}}
+# \\date{}
+
+# print header
+
+print $header;
+
+while (<>) {
+ last if /^$/;
+ print;
+}
+
+print $header2;
+
+while (<>) {
+ my $l = $_;
+ if ($escaping) {
+ if ($l =~ /\?>/) {
+ $escaping = 0;
+ } else {
+ print $l;
+ }
+ next;
+ }
+ if ($l =~ /<\?/) {
+ $escaping = 1;
+ next;
+ }
+ if ($l =~ /^! (.*)/) {
+ print "\\end{frame}\n\n" if ($in_frame == 1);
+ print "\\begin{frame}{$1}\n";
+ $in_frame = 1;
+ next;
+ }
+ if ($l =~ /^(=+) (.*) (=+)$/) {
+ print "\\end{frame}\n\n" if ($in_frame == 1);
+ $in_frame = 0;
+ my $nest = length($1);
+ my $level;
+ if ($nest == 2) {
+ $level = "section";
+ }
+ if ($nest == 3) {
+ $level = "subsection";
+ }
+ print "\\$level\{$2\}\n";
+ next;
+ }
+ if ($l =~ /^$/) {
+ while (@env > 0) {
+ my $e = pop @env;
+ my $ed = pop @envd;
+ print "\\end{$e}\n\n";
+ }
+ next;
+ }
+ if (/^( *)([[-])(.*)/) {
+ my $indent = length($1);
+ while (@env > 0 and $envd[-1] > $indent) {
+ my $e = pop @env;
+ my $ed = pop @envd;
+ print "\\end{$e}\n\n";
+ }
+ if (@envd == 0 or $indent > $envd[-1]) {
+ $e = "itemize" if ($2 eq "-");
+ $e = "description" if ($2 eq "[");
+ print "\\begin\{$e\}\n";
+ push (@env, $e);
+ push (@envd, $indent);
+ }
+ my $key;
+ if ($2 eq "[") {
+ if ($3 =~ /([^]]*)\](.*)/) {
+ $l = "$2\n";
+ $key = $1;
+ }
+ } else {
+ $l = "$3\n";
+ }
+ if ($2 eq "[") {
+ print "\\item[$key] ";
+ } else {
+ print "\\item ";
+ }
+ }
+ $l =~ s/\*([^*]+)\*/\\textcolor{red}{$1}/g;
+ print "$l";
+}
+
+print "\\end{document}\n";