rbbeamer 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +35 -8
  2. data/bin/rbbeamer +93 -19
  3. data/changes.txt +8 -0
  4. metadata +6 -6
data/README.md CHANGED
@@ -3,9 +3,9 @@ rbbeamer - ruby-beamer
3
3
 
4
4
  rbbeamer is a preprocessor script to convert a structured file with informations about your slides into a .tex file. If pdflatex is installed, rbbeamer can go on and start pdflatex to build your PDF.
5
5
 
6
- Most of work is done by the LaTeX-Beamer-package. But writing TEX-Files for beamer can be a little bit annoying if you usually use only a small (and everytime the same) part of the things beamer is capable to do. Most times I ended up with copy-and-pasting one slide after another and do same kind of changes all the time.
6
+ Most of work is done by the LaTeX-Beamer-package. But writing TEX-Files for beamer can be a little bit annoying if you usually use only a small (and everytime the same) part of the things beamer is capable to do. So if you need individual slides using all beamer-capbilities, you should use beamer directly by writing a .tex-file.
7
7
 
8
- rbbeamer gives you access to (right now) just a small part of beamer-capabilities - in other words: it makes accessable the capabilities I usually use in my presentations / lectures. But you can input your data very fast with nearly no hazzle about formatting and counting clicks and all this stuff.
8
+ rbbeamer gives you access to (right now) just a small part of beamer-capabilities. But you can input your data very fast with nearly no hazzle about formatting and counting clicks and all this stuff.
9
9
 
10
10
  Example
11
11
  -------
@@ -27,6 +27,18 @@ Let's say we need a couple of slides about rbbeamer. Open an ASCII-Editor of you
27
27
  #d|disadvantage | you have to read a \emph{small} README.
28
28
  #Fd
29
29
 
30
+ #sub|This is my subsection
31
+ #fx|Starting an empty frame
32
+ #bd|starting a description
33
+ #d|description|bd starts a description-environment
34
+ #d|second|this is just an example
35
+ #Bd
36
+ #bi|starting an itemize
37
+ #i|bi starts an itemize-environment
38
+ #i|this is just an example too
39
+ #Bi
40
+ #Fx
41
+
30
42
  Save this file as demo.rbt (rbt is default extension for rbbeamer-files). Now start rbbeamer:
31
43
 
32
44
  if pdflatex is installed:
@@ -37,7 +49,7 @@ or, if you just want to create a TEX-File for later use
37
49
 
38
50
  rbbeamer demo.rbt
39
51
 
40
- The resulting .TEX file will create a presentation with a title page, a table of content titled "Agenda" and two slides with data.
52
+ The resulting .TEX file will create a presentation with a title page, a table of content titled "Agenda" and two slides with data. Both slides will step from one item to the next by mouseclick
41
53
 
42
54
  ### Install
43
55
 
@@ -49,7 +61,7 @@ rbbeamer compiles .rbt-files into .tex-files. If you want to create your PDF, yo
49
61
 
50
62
  rbbeamer ist a script written in [Ruby][ruby]. You need a running Ruby-Installation (tested: 1.9.3, 2.0.0p0), most modern operating systems include one. rbbeamer ist developed and tested under Linux - it should run under MAC OS/X and Windows too - but I didn' t test it until now. Drop me a mail if you have additional info.
51
63
 
52
- Creating pictures you will need [Graphviz][graphviz] in your path
64
+ Creating pictures you will need *graphviz* in your path
53
65
  ### Commands
54
66
 
55
67
  Commands start with a "#" as first char in a line. Every line not starting with # is ignored (so a blank as the first char means: this is a comment). You can use this to specify additional informations not shown on slide or just to decativate a command for testing purposes. The end of a command is defined by line break or seperator-char (default: |)
@@ -89,6 +101,18 @@ Defines a frame (one slide) with no content. \<yourtitle> will be the title of f
89
101
  #Fx
90
102
  Closes a frame started with `#fx`.
91
103
 
104
+ #bi|<yourtitle>
105
+ Starts a new block inside a fx-frame named \<yourtitle>. Alle entries in block should follow with #i-command (itemize).
106
+
107
+ #Bi
108
+ Closes a block started with `#bi`.
109
+
110
+ #bd|<yourtitle>
111
+ Starts a new block inside a fx-frame named \<yourtitle>. Alle entries in block should follow with #d-command (description).
112
+
113
+ #Bd
114
+ Closes a block started with `#bd`.
115
+
92
116
  #[|content
93
117
  This command just copies all content of this line into resulting .TEX-file. Lets say, you want to specify a section with an additional short title. This you cannot do with `#sec`-command. Instead you can use `#[|\section[Short Title]{Really Long Title}`. Resulting .TEX-file will include this line: `\section[Short Title]{Really Long Title}`
94
118
 
@@ -129,10 +153,13 @@ Starting rbbeamer at least you will have to specify your .rbt-file to compile. B
129
153
  --help, -x: Show all options (this page)
130
154
 
131
155
 
132
- ### .rbbeamer.conf
133
- Nearly all options regarding rbbeamer can be specified in command-line. But most times you don' t change your options. So ist is easier to use a config-file to save them. During startup rbbeamer sets all options to default values. If it finds .rbbeamer.conf, options are overriden by those specified in config-file. If you also specified options in command-line, these values will override the former ones.
156
+ ### Config-directory
157
+ During startup rbbeamer tries to find config-dir (Linux: `~/.rbbeamer`). If it doesn't exist, it will be created. You can save some files used by a myjority of your presentations in this dir (i.e. logo-files, bibtex-sources). rbbeamer tries to find this files in this dir, if you didn't specify another directory. In my case, I store my bibtex-sourcefile with all entries I usually cite from in this dir. So I don't have to bother with copies of this file in different directories.
158
+
159
+ ### rbbeamer.conf
160
+ Nearly all options regarding rbbeamer can be specified in command-line. But most times you don' t change your options. So ist is easier to use a config-file to save them. During startup rbbeamer sets all options to default values. If it finds rbbeamer.conf, options are overriden by those specified in config-file. If you also specified options in command-line, these values will override the former ones.
134
161
 
135
- To create your config-file, just specify all options needed for your work and add `--writeconfigfile (or -w)`. rbbeamer will then create a config (Linux: `~/.rbbeamer.conf`) to save all options within. Next time just start rbbeamer and specify your .rbt-file. Thats it. You can edit your config-file with any editor.
162
+ To create your config-file, just specify all options needed for your work and add `--writeconfigfile (or -w)`. rbbeamer will then create a config (Linux: `~/.rbbeamer/rbbeamer.conf`) to save all options within. Next time just start rbbeamer and specify your .rbt-file. Thats it. You can edit your config-file with any editor.
136
163
 
137
164
  handout = false
138
165
  pdf = true
@@ -168,7 +195,7 @@ License
168
195
  -------
169
196
 
170
197
  rbbeamer is a preprocessor for creating TEX-files for LaTeX-Beamer.
171
- Copyright (C) 2013 Thomas Romeyke (rubybeamer at gmail.com).
198
+ Copyright (C) 2013 Thomas Romeyke (rubybeamer at googlemail.com).
172
199
 
173
200
  This program is free software: you can redistribute it and/or modify
174
201
  it under the terms of the GNU General Public License as published by
data/bin/rbbeamer CHANGED
@@ -23,7 +23,7 @@ require 'parseconfig.rb'
23
23
  require 'open3'
24
24
  require 'pathname'
25
25
 
26
- Version = "0.5.3 (2013-05-01)"
26
+ Version = "0.5.4 (2013-05-16)"
27
27
 
28
28
  sep = '|' # seperator-string to split different parts of a line / command
29
29
  SAVESEP = '<-saveThisAsSeperatorForLaterUse->'
@@ -74,12 +74,24 @@ intro = <<-'EOF'
74
74
  \usepackage[utf8]{inputenc}
75
75
  \setbeamercovered{transparent}
76
76
  \usepackage{pdfpages}
77
+ \usepackage{eurosym}
77
78
  \usepackage[style=authortitle,backend=/<-KVAR-TBR->/]{biblatex}
78
79
  \usetheme{/<-KVAR-TBR->/}
79
80
  \usepackage{tikz}
80
81
  \usetikzlibrary{shapes,arrows}
81
82
  /<-KVAR-TBR->/
82
83
  /<-KVAR-TBR->/
84
+ \newcommand\Fontvi{\fontsize{7}{7.2}\selectfont}
85
+ \usepackage{colortbl}
86
+ \usepackage{array}
87
+ \newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
88
+ % --- Colordefs --------------------------------------
89
+ \definecolor{darkgrey}{rgb}{0.8,0.8,0.8}
90
+ \definecolor{grey}{rgb}{0.95,0.95,0.95}
91
+ \definecolor{red}{rgb}{0.99,0.25,0.5}
92
+ \definecolor{blue}{rgb}{0.1,0.25,0.95}
93
+ \definecolor{green}{rgb}{0.1,0.95,0.1}
94
+ % Usage: \cellcolor{hellgruen}
83
95
  \begin{document}
84
96
  \title[{\makebox[.45\paperwidth]{/<-KVAR-TBR->/\hfill%
85
97
  \insertframenumber/\inserttotalframenumber}}]{/<-KVAR-TBR->/}
@@ -110,7 +122,7 @@ return toc
110
122
  end
111
123
 
112
124
  def checkStruc(struc,code,situation)
113
- # trying to finde missing closing elements or unmatched #d or #i elements
125
+ # trying to find missing closing elements or unmatched #d or #i elements
114
126
  case situation
115
127
  when 'new'
116
128
  # struc must be empty, otherwise we already have an open structure
@@ -118,11 +130,11 @@ def checkStruc(struc,code,situation)
118
130
  puts "WARNING: Missing closing element for " + struc[1] unless mode
119
131
  when '-'
120
132
  # code must fit to struc
121
- mode = code.gsub(/#/,'') == struc[0].gsub(/#f/,'')
133
+ mode = code.gsub(/#/,'') == struc[0].gsub(/#f/,'') || code.gsub(/#/,'') == struc[0].gsub(/#b/,'')
122
134
  puts "WARNING: #{code} does'nt match #{struc[0]}: '" + struc[1] + "'" unless mode
123
135
  when 'close'
124
136
  # code must fit to struc
125
- mode = code.gsub(/#F/,'') == struc[0].gsub(/#f/,'')
137
+ mode = code.gsub(/#F/,'') == struc[0].gsub(/#f/,'') || code.gsub(/#B/,'') == struc[0].gsub(/#b/,'')
126
138
  puts "WARNING: closing #{code} does'nt match #{struc[0]}: '" + struc[1] + "'" unless mode
127
139
  else
128
140
  raise "Problem: situation= #{situation.inspect} " + ' (' + struc + '): ' + code
@@ -167,8 +179,11 @@ pathname = File.dirname(File.expand_path(__FILE__))
167
179
  pathname_lib = Pathname.new(pathname).parent.to_s + '/lib'
168
180
  homedir = Dir.home + '/'
169
181
 
182
+ # Config-dir will be:
183
+ ccfg_dir = homedir + '.' + firstname
184
+ Dir.mkdir(ccfg_dir) unless Dir.exists?(ccfg_dir)
170
185
  # Configfile will be:
171
- ccfg = homedir + '.' + firstname + '.conf'
186
+ ccfg = ccfg_dir + '/' + firstname + '.conf'
172
187
 
173
188
  opts = Trollop::options do
174
189
  opt :seperator, "use this pattern as seperator", :type => :string, :default => sep
@@ -224,6 +239,16 @@ end
224
239
  # transform boolean vars from string:
225
240
  [:debug,:debugpdf,:deleteworkfiles,:handout,:writeconfigfile,:pdf,:license].each {|s| cfg[s] = cfg[s].to_bool}
226
241
 
242
+ # if specified Logofile isn't found, we will look for in in rbbeamer-config-dir:
243
+ if not File.exists?(cfg[:logo])
244
+ # try finding it in ccfg_dir:
245
+ f = ccfg_dir + '/' + File.basename(cfg[:logo])
246
+ if not File.exists?(f)
247
+ [cfg[:logo],f].each{|x| puts "Didn't find logofile: #{x}"}
248
+ raise "Missing logofile"
249
+ end
250
+ cfg[:logo] = f
251
+ end
227
252
  # This our config for this session:
228
253
  if cfg[:debug]
229
254
  puts "\n\nDebugging info:\nPathes:\npathname = #{pathname}\nhomedir = #{homedir}\n\nConfig-File = #{ccfg} #{ccfgexist}\n"
@@ -343,12 +368,12 @@ textfi = Array.new
343
368
  lines.each do |line|
344
369
  sp = line.split(sep).reverse
345
370
  code,content = sp.pop, sp.reverse
346
- if code == '#fd'
371
+ if %w[#fd #bd].include?(code)
347
372
  x += 1
348
373
  nums << 0
349
374
  text << ''
350
375
  end
351
- if code == '#fi'
376
+ if %w[#fi #bi].include?(code)
352
377
  x += 1
353
378
  numsfi << 0
354
379
  textfi << ''
@@ -367,6 +392,8 @@ nums.reverse!
367
392
  text.reverse!
368
393
  numsfi.reverse!
369
394
  textfi.reverse!
395
+ counter = 1
396
+
370
397
  # only for testing purposes: File.open('ftest.txt','w'){|f| lines.each{|x| f.puts x}}
371
398
  File.open(fn,'w') do |out|
372
399
  out.puts "% File created by #{fname}, Version #{Version}"
@@ -377,10 +404,10 @@ File.open(fn,'w') do |out|
377
404
  anzfi = 0
378
405
  textmuster = ''
379
406
  lines.each do |line|
380
- sp = line.split(sep).reverse
407
+ sp = line.chomp.split(sep).reverse
381
408
  code,content = sp.pop.strip, sp.reverse
382
- # puts "code=#{code}, content=#{content.inspect}"
383
- # puts "line=#{line.inspect}"
409
+ puts "line=#{line.inspect}" if cfg[:debug]
410
+ puts "code=#{code}, content=#{content.inspect}" if cfg[:debug]
384
411
  case code
385
412
  when '#{', '#}', '#dig}'
386
413
  # nothing to do
@@ -415,7 +442,23 @@ File.open(fn,'w') do |out|
415
442
  Titel,Autor,Datum = content[0..2]
416
443
  opt_handout = cfg[:handout] ? 'handout' : '' # we include this in \documentclass-command
417
444
  addpackage = packages.size > 0 ? packages.join("\n") : '% no additional packages defined'
418
- bibline = content.size >= 4 ? '\bibliography{' + content[3].strip + '}' : '%'
445
+ if content.size >= 4
446
+ # find file with sources for bibliography:
447
+ bibFileName = content[3].strip
448
+ if not (File.exists?(bibFileName) || File.exists?(bibFileName+'.bib'))
449
+ # file is not in our working dir, so try conf-dir:
450
+ obibFileName = ccfg_dir + '/' + File.basename(bibFileName)
451
+ if not (File.exists?(obibFileName) || File.exists?(obibFileName+'.bib'))
452
+ # Didn't find file in conf-dir:
453
+ [bibFileName,obibFileName].each{|x| puts "Didn't find bibfile: #{x}"}
454
+ raise "Missing bibfile"
455
+ end
456
+ bibFileName = obibFileName
457
+ end
458
+ bibline = '\bibliography{' + bibFileName + '}'
459
+ else
460
+ bibline = '% No bibfile specified'
461
+ end
419
462
  vorspann = intro_beamer
420
463
  vorspann.gsub!('%','/PROZENT!/')
421
464
  vorspann.gsub!('/<-KVAR-TBR->/','%s')
@@ -427,8 +470,8 @@ File.open(fn,'w') do |out|
427
470
  when '#l' # Label für Frame vergeben
428
471
  out.puts '\label{' + content.first.strip + '}'
429
472
  when '#f'
430
- raise "#f is deprecated, please change to #fd and #Fd"
431
- when '#fd'
473
+ raise "#f is deprecated, please change to #fd, #fx or #fi"
474
+ when '#fd' # begin of frame with decription
432
475
  checkStruc(openstruc,code,'new')
433
476
  out.puts '\frame{'
434
477
  out.puts ' \frametitle{' + content.first + '}'
@@ -437,7 +480,7 @@ File.open(fn,'w') do |out|
437
480
  textmuster = text.pop
438
481
  out.puts ' \begin{description}['+textmuster+':]'
439
482
  openstruc = ['#fd',content.join]
440
- when '#fi' # Beginn eines Frames
483
+ when '#fi' # begin of frame with itemize
441
484
  checkStruc(openstruc,code,'new')
442
485
  openstruc = ['#fi',content.join]
443
486
  out.puts '\frame{'
@@ -445,18 +488,36 @@ File.open(fn,'w') do |out|
445
488
  counter = 1
446
489
  anzfi = numsfi.pop + 1
447
490
  out.puts ' \begin{itemize}'
448
- when '#d' # Ausgabe eines description items
491
+ when '#bi' # begin of block with itemize
492
+ checkStruc(openstruc,code,'new')
493
+ openstruc = ['#bi',content.join]
494
+ out.puts ' \begin{block}{' + content.first + '}'
495
+ # counter = 1
496
+ anzfi = numsfi.pop + 1
497
+ out.puts ' \begin{itemize}'
498
+ when '#bd' # begin of block with description
499
+ checkStruc(openstruc,code,'new')
500
+ openstruc = ['#bd',content.join]
501
+ out.puts ' \begin{block}{' + content.first + '}'
502
+ # counter = 1
503
+ anz = nums.pop + 1
504
+ textmuster = text.pop
505
+ out.puts ' \begin{description}['+textmuster+':]'
506
+ openstruc = ['#bd',content.join]
507
+ when '#d' # output description item
449
508
  checkStruc(openstruc,code,'-')
450
509
  counter += 1
451
510
  content.reverse!
452
511
  word = content.pop.strip
453
512
  description = content.reverse.join.gsub(SAVESEP,sep)
454
- out.puts ' \item<'+counter.to_s+'-'+anz.to_s+'|alert@'+counter.to_s+'> [' + word + ':] ' + description
455
- when '#i' # Ausgabe eines items
513
+ # out.puts ' \item<'+counter.to_s+'-'+anz.to_s+'|alert@'+counter.to_s+'> [' + word + ':] ' + description
514
+ out.puts ' \item<'+counter.to_s+'-'+'|alert@'+counter.to_s+'> [' + word + ':] ' + description
515
+ when '#i' # outpit itemize item
456
516
  checkStruc(openstruc,code,'-')
457
517
  counter += 1
458
- out.puts ' \item<'+counter.to_s+'-'+anzfi.to_s+'|alert@'+counter.to_s+'> ' + content.join.gsub(SAVESEP,sep)
459
- when '#fx' # Beginn eines Frames aber ohne description
518
+ # out.puts ' \item<'+counter.to_s+'-'+anzfi.to_s+'|alert@'+counter.to_s+'> ' + content.join.gsub(SAVESEP,sep)
519
+ out.puts ' \item<'+counter.to_s+'-'+'|alert@'+counter.to_s+'> ' + content.join.gsub(SAVESEP,sep)
520
+ when '#fx' # begin of empty frame
460
521
  raise "Need frametitle as argument: " + line if content.size < 1
461
522
  out.puts '\begin{frame}[fragile]'
462
523
  out.puts ' \frametitle{' + content.first + '}'
@@ -469,13 +530,26 @@ File.open(fn,'w') do |out|
469
530
  openstruc = '' # closing structure
470
531
  out.puts ' \end{description}'
471
532
  out.puts '}'
533
+ counter = 1
472
534
  when '#Fi'
473
535
  checkStruc(openstruc,code,'close')
474
536
  openstruc = '' # closing structure
475
537
  out.puts ' \end{itemize}'
476
538
  out.puts '}'
539
+ counter = 1
540
+ when '#Bi'
541
+ checkStruc(openstruc,code,'close')
542
+ openstruc = '' # closing structure
543
+ out.puts ' \end{itemize}'
544
+ out.puts ' \end{block}'
545
+ when '#Bd'
546
+ checkStruc(openstruc,code,'close')
547
+ openstruc = '' # closing structure
548
+ out.puts ' \end{description}'
549
+ out.puts ' \end{block}'
477
550
  when '#Fx'
478
551
  out.puts '\end{frame}'
552
+ counter = 1
479
553
  else
480
554
  raise "(RBB) Error, don't know this command: " + code
481
555
  end
data/changes.txt CHANGED
@@ -1,3 +1,11 @@
1
+ 0.5.4:
2
+ added new command #bi,#Bi and #bd,#Bd for blocks with itemize or description elements (see Readme)
3
+ added a .chomp after reading a line from rbt-file before processing content
4
+ changes in Latex-header:
5
+ added Columntype "C" for tables
6
+ added package colortbl with some colordefs
7
+ added package eurosym
8
+ added new fontsize (Fontvi for tables)
1
9
  0.5.3:
2
10
  fixed a problem in section #{| : Did not restore sep-symbols in tables
3
11
  0.5.2:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbeamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-01 00:00:00.000000000 Z
12
+ date: 2013-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop
16
- requirement: &70138810 !ruby/object:Gem::Requirement
16
+ requirement: &83159470 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70138810
24
+ version_requirements: *83159470
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: parseconfig
27
- requirement: &70138420 !ruby/object:Gem::Requirement
27
+ requirement: &83159210 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 1.0.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70138420
35
+ version_requirements: *83159210
36
36
  description: Helps you building beamer-presentations
37
37
  email: rbbeamer@gmail.com
38
38
  executables: