mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 6212033e4ba32c5dcfecf6c0849eaf4703de7a8b
parent 157fe4cdb7bbfa3707040f336d9e72c29a3f7cb4
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Tue, 24 Sep 2013 22:29:14 +0200

update shorthand

Diffstat:
shorthand.pl | 62++++++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 42 insertions(+), 20 deletions(-)

diff --git a/shorthand.pl b/shorthand.pl @@ -6,13 +6,14 @@ my $escaping = 0; my $in_frame = 0; my @env = qw(); my @envd = qw(); +my $subsecneeded = 0; my $header = <<END; \\documentclass{beamer} \\usepackage[utf8]{inputenc} -\\usepackage{graphicx, verbatim, array, xspace, booktabs, tikz, url} +\\usepackage{graphicx, verbatim, array, xspace, booktabs, tikz, url, etoolbox,multirow,tabularx,minibox,tikz-qtree,minted} \\usetheme{Frankfurt} \\usecolortheme{beaver} -\\definecolor{beamer@blendedblue}{rgb}{1,0,0} +\\definecolor{beamer\@blendedblue}{rgb}{1,0,0} \\colorlet{darkgreen}{green!50!black} \\newcommand{\\imgp}[2]{ \\begin{figure} @@ -21,6 +22,8 @@ my $header = <<END; \\end{center} \\end{figure} } +\\DeclareUnicodeCharacter{0169}{\\~u} +\\DeclareUnicodeCharacter{0144}{\'n} \\setbeamertemplate{navigation symbols}{} \\makeatletter \\setbeamertemplate{footline} @@ -29,20 +32,30 @@ my $header = <<END; \\vspace{0.2cm} }% \\makeatother +\\newenvironment{changemargin}[2]{% + \\begin{list}{}{% + \\setlength{\\topsep}{0pt}% + \\setlength{\\leftmargin}{#1}% + \\setlength{\\rightmargin}{#2}% + \\setlength{\\listparindent}{\\parindent}% + \\setlength{\\itemindent}{\\parindent}% + \\setlength{\\parsep}{\\parskip}% + }% + \\item[]}{\\end{list}} +END + + +my $header2 = <<END; \\AtBeginSection[] { \\ifnumcomp{\\value{section}}{=}{1}{} { \\begin{frame}<beamer> - \\frametitle{Table of contents} + \\frametitle{\\mytocname} \\tableofcontents[currentsection] \\end{frame} } } -END - - -my $header2 = <<END; \\begin{document} \\begin{frame} @@ -51,14 +64,6 @@ my $header2 = <<END; 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 (<>) { @@ -82,9 +87,15 @@ while (<>) { $escaping = 1; next; } - if ($l =~ /^! (.*)/) { + if ($l =~ /^(!f?) (.*)/) { print "\\end{frame}\n\n" if ($in_frame == 1); - print "\\begin{frame}{$1}\n"; + print "\\subsection\{\}\n" if ($subsecneeded == 1); + $subsecneeded = 0; + if ($1 eq "!f") { + print "\\begin{frame}[fragile]\{$2\}\n"; + } else { + print "\\begin{frame}\{$2\}\n"; + } $in_frame = 1; next; } @@ -95,22 +106,29 @@ while (<>) { my $level; if ($nest == 2) { $level = "section"; + $subsecneeded = 1; } if ($nest == 3) { $level = "subsection"; + $subsecneeded = 0; } print "\\$level\{$2\}\n"; next; } + if ($l =~ /^\.\.\.$/) { + print "\\pause\n"; + next; + } if ($l =~ /^$/) { while (@env > 0) { my $e = pop @env; my $ed = pop @envd; print "\\end{$e}\n\n"; } + print "\n"; next; } - if (/^( *)([[-])(.*)/) { + if (/^( *)(-|\[|=>)(.*)/) { my $indent = length($1); while (@env > 0 and $envd[-1] > $indent) { my $e = pop @env; @@ -124,16 +142,19 @@ while (<>) { push (@env, $e); push (@envd, $indent); } - my $key; + my $key = ""; if ($2 eq "[") { if ($3 =~ /([^]]*)\](.*)/) { $l = "$2\n"; $key = $1; } } else { + if ($2 eq "=>") { + $key = "\$\\Rightarrow\$"; + } $l = "$3\n"; } - if ($2 eq "[") { + if (length($key) > 0) { print "\\item[$key] "; } else { print "\\item "; @@ -143,4 +164,5 @@ while (<>) { print "$l"; } +print "\\end{frame}\n\n" if ($in_frame == 1); print "\\end{document}\n";