[DRE-commits] [ruby-tioga] 01/03: Imported Upstream version 1.16
Vincent Fourmond
fourmond at alioth.debian.org
Mon Aug 26 21:53:44 UTC 2013
This is an automated email from the git hooks/post-receive script.
fourmond pushed a commit to branch master
in repository ruby-tioga.
commit a3363ffd2e4d067b9efea5b38654f388804a2e28
Author: Vincent Fourmond <fourmond at debian.org>
Date: Mon Aug 26 22:24:52 2013 +0200
Imported Upstream version 1.16
---
Tioga_README | 24 +-
bin/tioga | 2 +-
ext/Dobjects/Dvector/dvector.c | 149 ++++++++++++-
ext/Dobjects/Dvector/dvector_intern.h | 4 +
ext/Tioga/FigureMaker/generic.c | 2 +-
ext/Tioga/FigureMaker/shared/axes.c | 12 +-
ext/Tioga/FigureMaker/shared/pdfcolor.c | 2 +-
lib/Tioga/FigMkr.rb | 118 +++++++---
lib/Tioga/TexPreamble.rb | 372 +++++++++++++++++++++++++++++++
lib/Tioga/tioga_ui_cmds.rb | 4 +-
misc/tioga.sty | 355 +++++++++++++++++++++++++++++
tests/tc_Dvector.rb | 36 +++
tests/tc_FMkr.rb | 12 +
tioga.gemspec | 6 +-
14 files changed, 1043 insertions(+), 55 deletions(-)
diff --git a/Tioga_README b/Tioga_README
index 42c6410..e6d213f 100644
--- a/Tioga_README
+++ b/Tioga_README
@@ -22,13 +22,10 @@ This is the README for the Tioga kernel, version 1.14, June 10, 2011.
<< What's new >>
- Tioga 1.14 fixes all known problems of Tioga with Ruby 1.9.1 and
-higher (to the point that it runs with ctioga2, and the samples run
-too !).
+ Tioga 1.16 brings in a bug fix by Josiah Schwab in handling some
+HLS triplets. It also provides facilities to extract the pdflatex
+errors.
- It also brings in the possibility to customize the number of major
-ticks after which log plots don't show minor ticks, via the
-log_minor_ticks_limit accessor.
<< Quick Installation of Tioga >>
@@ -172,6 +169,20 @@ Bill Paxton
Here are the old release messages:
+ Tioga 1.15 brings in some new iterators in Dvector and some minor
+bug fixes (in particular for gem builds).
+
+ Tioga 1.14 fixes all known problems of Tioga with Ruby 1.9.1 and
+higher (to the point that it runs with ctioga2, and the samples run
+too !).
+
+ It also brings in the possibility to customize the number of major
+ticks after which log plots don't show minor ticks, via the
+log_minor_ticks_limit accessor.
+
+ --------------------------------------------------
+
+
Tioga 1.13 brings in a fix for a well-hidden memory leak that was
unlikely to hit you unless you were allocating a huge number of
vectors.
@@ -180,6 +191,7 @@ vectors.
FigureMaker's internal state (color conversion functions and
contouring algorithms) were made available as module functions too.
+ --------------------------------------------------
Tioga 1.12 has seen quite a lot of action. The first and major
change is the switch from a custom rewrite of mkmf.rb for
diff --git a/bin/tioga b/bin/tioga
old mode 100755
new mode 100644
index 9cb67e2..3103a8f
--- a/bin/tioga
+++ b/bin/tioga
@@ -1,4 +1,4 @@
-#! /usr/bin/ruby1.8
+#! /usr/bin/ruby1.9.1
require 'Tioga/tioga_ui.rb'
diff --git a/ext/Dobjects/Dvector/dvector.c b/ext/Dobjects/Dvector/dvector.c
index d8b5c94..646ed19 100644
--- a/ext/Dobjects/Dvector/dvector.c
+++ b/ext/Dobjects/Dvector/dvector.c
@@ -1202,6 +1202,40 @@ PRIVATE
PRIVATE
/*
* call-seq:
+ * dvector.each3(other1, other2) {|x,y, z| block }
+ *
+ * Calls <i>block</i> once for each element in _dvector_, passing that
+ * element as a parameter along with the corresponding element from the _other1_ and _other2_ vectors.
+ * The three vectors must be the same length.
+ *
+ * a = Dvector[ 1, 0, -1 ]
+ * b = Dvector[ 3, 4, 5 ]
+ * c = Dvector[ 6, 9, 2 ]
+ * a.each3(b, c) {|x,y,z| print "(", x ",", y, ", ", z, ") " }
+ *
+ * produces:
+ *
+ * (1,3,6) (0,4,9) (-1,5,2)
+ */ VALUE dvector_each3(VALUE ary, VALUE ary2, VALUE ary3) {
+ Dvector *d = Get_Dvector(ary);
+ Dvector *d2 = Get_Dvector(ary2);
+ Dvector *d3 = Get_Dvector(ary3);
+ long i;
+ if (d->len != d2->len) {
+ rb_raise(rb_eArgError, "vectors with different lengths (%ld vs %ld) for each3", d->len, d2->len);
+ }
+ if (d->len != d3->len) {
+ rb_raise(rb_eArgError, "vectors with different lengths (%ld vs %ld) for each3", d->len, d3->len);
+ }
+ for (i=0; i < d->len; i++) {
+ rb_yield_values(3, rb_float_new(d->ptr[i]), rb_float_new(d2->ptr[i]), rb_float_new(d3->ptr[i]));
+ }
+ return ary;
+}
+
+PRIVATE
+/*
+ * call-seq:
* dvector.each_index {|index| block } -> dvector
*
* Same as <code>Dvector#each</code>, but passes the index of the element
@@ -1270,6 +1304,40 @@ PRIVATE
PRIVATE
/*
* call-seq:
+ * dvector.each3_with_index(other1, other2) {|x,y,z,i| block }
+ *
+ * Calls <i>block</i> once for each element in _dvector_, passing that
+ * element as a parameter along with the corresponding element from the _other1_ and _other2_ vectors and the index.
+ * The three vectors must be the same length.
+ *
+ * a = Dvector[ 1, 0, -1 ]
+ * b = Dvector[ 3, 4, 5 ]
+ * c = Dvector[ 6, 9, 2 ]
+ * a.each3(b, c) {|x,y,z,i| print "(", x ",", y, ", ", z, ",", i, ") " }
+ *
+ * produces:
+ *
+ * (1,3,6,0) (0,4,9,1) (-1,5,2,2)
+ */ VALUE dvector_each3_with_index(VALUE ary, VALUE ary2, VALUE ary3) {
+ Dvector *d = Get_Dvector(ary);
+ Dvector *d2 = Get_Dvector(ary2);
+ Dvector *d3 = Get_Dvector(ary3);
+ long i;
+ if (d->len != d2->len) {
+ rb_raise(rb_eArgError, "vectors with different lengths (%ld vs %ld) for each3", d->len, d2->len);
+ }
+ if (d->len != d3->len) {
+ rb_raise(rb_eArgError, "vectors with different lengths (%ld vs %ld) for each3", d->len, d3->len);
+ }
+ for (i=0; i < d->len; i++) {
+ rb_yield_values(4, rb_float_new(d->ptr[i]), rb_float_new(d2->ptr[i]), rb_float_new(d3->ptr[i]), LONG2NUM(i));
+ }
+ return ary;
+}
+
+PRIVATE
+/*
+ * call-seq:
* dvector.reverse_each {|x| block }
*
* Same as <code>Dvector#each</code>, but traverses _dvector_ in reverse
@@ -1327,6 +1395,42 @@ PRIVATE
PRIVATE
/*
* call-seq:
+ * dvector.reverse_each3(other1, other2) {|x,y,z| block }
+ *
+ * Same as <code>Dvector#each3</code>, but traverses vectors in reverse
+ * order. The vectors must have the same size.
+ *
+ * a = Dvector[ 1, 0, -1 ]
+ * b = Dvector[ 3, 4, 5 ]
+ * c = Dvector[ 6, 9, 2 ]
+ * a.reverse_each3(b, c) {|x,y,z| print "(", x ",", y, ", ", z, ") " }
+ *
+ * produces:
+ *
+ * (-1,5,2) (0,4,9) (1,3,6)
+ */ VALUE dvector_reverse_each3(VALUE ary, VALUE ary2, VALUE ary3) {
+ Dvector *d = Get_Dvector(ary);
+ Dvector *d2 = Get_Dvector(ary2);
+ Dvector *d3 = Get_Dvector(ary3);
+ long len = d->len;
+ if (len != d2->len) {
+ rb_raise(rb_eArgError, "vectors with different lengths (%ld vs %ld) for reverse_each3", len, d2->len);
+ }
+ if (len != d3->len) {
+ rb_raise(rb_eArgError, "vectors with different lengths (%ld vs %ld) for reverse_each3", len, d3->len);
+ }
+ while (len--) {
+ rb_yield_values(3, rb_float_new(d->ptr[len]), rb_float_new(d2->ptr[len]), rb_float_new(d3->ptr[len]));
+ if (d->len < len) {
+ len = d->len;
+ }
+ }
+ return ary;
+}
+
+PRIVATE
+/*
+ * call-seq:
* dvector.reverse_each_index {|index| block } -> array
*
* Same as <code>Dvector#reverse_each</code>, but passes the index of the element
@@ -1411,6 +1515,45 @@ PRIVATE
PRIVATE
/*
* call-seq:
+ * dvector.reverse_each3_with_index {|x,y,z,index| block } -> dvector
+ *
+ * Same as <code>Dvector#each3_with_index</code>, but traverses the vectors in reverse
+ * order.
+ *
+ * a = Dvector[ 1, 0, -1 ]
+ * b = Dvector[ 3, 4, 5 ]
+ * c = Dvector[ 6, 9, 2 ]
+ * a.reverse_each3_with_index(b,c) {|x,y,i| print "(", x ",", y, "," i, ") " }
+ * a.each3(b, c) {|x,y,z,i| print "(", x ",", y, ", ", z, ",", i, ") " }
+ *
+ * produces:
+ *
+ * (-1,5,2,2) (0,4,9,1) (1,3,6,0)
+ */ VALUE dvector_reverse_each3_with_index(VALUE ary, VALUE ary2, VALUE ary3) {
+ Dvector *d = Get_Dvector(ary);
+ Dvector *d2 = Get_Dvector(ary2);
+ Dvector *d3 = Get_Dvector(ary3);
+ long len = d->len;
+ if (len != d2->len) {
+ rb_raise(rb_eArgError, "vectors with different lengths (%ld vs %ld) for reverse_each3_with_index",
+ len, d3->len);
+ }
+ if (len != d3->len) {
+ rb_raise(rb_eArgError, "vectors with different lengths (%ld vs %ld) for reverse_each3_with_index",
+ len, d3->len);
+ }
+ while (len--) {
+ rb_yield_values(4, rb_float_new(d->ptr[len]), rb_float_new(d2->ptr[len]), rb_float_new(d3->ptr[len]), LONG2NUM(len));
+ if (d->len < len) {
+ len = d->len;
+ }
+ }
+ return ary;
+}
+
+PRIVATE
+/*
+ * call-seq:
* dvector.length -> int
*
* Returns the number of elements in _dvector_.
@@ -3025,7 +3168,7 @@ PRIVATE
*
* Returns square root of the dot product of the vector with itself.
*
- * a = Dvector[ 3, 5 ]
+ * a = Dvector[ 3, 4 ]
* a.vector_length -> 5.0
*/
VALUE dvector_vector_length(VALUE ary) {
@@ -6080,6 +6223,10 @@ void Init_Dvector() {
rb_define_method(cDvector, "each2_with_index", dvector_each2_with_index, 1);
rb_define_method(cDvector, "reverse_each2", dvector_reverse_each2, 1);
rb_define_method(cDvector, "reverse_each2_with_index", dvector_reverse_each2_with_index, 1);
+ rb_define_method(cDvector, "each3", dvector_each3, 2);
+ rb_define_method(cDvector, "each3_with_index", dvector_each3_with_index, 2);
+ rb_define_method(cDvector, "reverse_each3", dvector_reverse_each3, 2);
+ rb_define_method(cDvector, "reverse_each3_with_index", dvector_reverse_each3_with_index, 2);
rb_define_method(cDvector, "collect2", dvector_collect2, 1);
rb_define_method(cDvector, "collect2!", dvector_collect2_bang, 1);
diff --git a/ext/Dobjects/Dvector/dvector_intern.h b/ext/Dobjects/Dvector/dvector_intern.h
index d5c5281..824b1b4 100644
--- a/ext/Dobjects/Dvector/dvector_intern.h
+++ b/ext/Dobjects/Dvector/dvector_intern.h
@@ -87,6 +87,10 @@ PRIVATE VALUE dvector_reverse_each2(VALUE ary, VALUE ary2);
PRIVATE VALUE dvector_reverse_each_index(VALUE ary);
PRIVATE VALUE dvector_reverse_each_with_index(VALUE ary);
PRIVATE VALUE dvector_reverse_each2_with_index(VALUE ary, VALUE ary2);
+PRIVATE VALUE dvector_each3(VALUE ary, VALUE ary2, VALUE ary3);
+PRIVATE VALUE dvector_each3_with_index(VALUE ary, VALUE ary2, VALUE ary3);
+PRIVATE VALUE dvector_reverse_each3(VALUE ary, VALUE ary2, VALUE ary3);
+PRIVATE VALUE dvector_reverse_each3_with_index(VALUE ary, VALUE ary2, VALUE ary3);
PRIVATE VALUE dvector_length(VALUE ary);
PRIVATE VALUE dvector_empty_p(VALUE ary);
PRIVATE VALUE dvector_dup(VALUE ary);
diff --git a/ext/Tioga/FigureMaker/generic.c b/ext/Tioga/FigureMaker/generic.c
index 5864b33..9fb9376 100644
--- a/ext/Tioga/FigureMaker/generic.c
+++ b/ext/Tioga/FigureMaker/generic.c
@@ -115,7 +115,7 @@ OBJ_PTR COLOR_PREAMBLE(OBJ_PTR fmkr, int *ierr) { return rb_const_get(CLASS_OF(f
void GIVE_WARNING(const char *fmt, const char *str) { rb_warn(fmt,str); }
-void RAISE_ERROR(char *str, int *ierr) { *ierr = -1; rb_raise(rb_eArgError,str); }
+void RAISE_ERROR(char *str, int *ierr) { *ierr = -1; rb_raise(rb_eArgError,"%s", str); }
#define err_buff_len 256
void RAISE_ERROR_s(char *fmt, char *s, int *ierr) {
diff --git a/ext/Tioga/FigureMaker/shared/axes.c b/ext/Tioga/FigureMaker/shared/axes.c
index e592c26..c15844e 100644
--- a/ext/Tioga/FigureMaker/shared/axes.c
+++ b/ext/Tioga/FigureMaker/shared/axes.c
@@ -107,9 +107,14 @@ static void figure_join(OBJ_PTR fmkr, FM *p,
figure_lineto(fmkr, p, x1, y1, ierr);
}
-static void axis_stroke(OBJ_PTR fmkr, FM *p, int *ierr)
+static void axis_stroke(OBJ_PTR fmkr, FM *p, int *ierr, int cap)
{
+ int old_cap = p->line_cap;
+ if(old_cap != cap) /* Save cap */
+ c_line_cap_set(fmkr, p, cap, ierr);
c_stroke(fmkr,p, ierr);
+ if(old_cap != cap) /* Restore cap */
+ c_line_cap_set(fmkr, p, old_cap, ierr);
}
static void figure_join_and_stroke(OBJ_PTR fmkr, FM *p,
@@ -759,7 +764,8 @@ static void draw_major_ticks(OBJ_PTR fmkr, FM *p, PlotAxis *s, int *ierr)
did_line = true;
if (*ierr != 0) return;
}
- if (did_line) axis_stroke(fmkr,p, ierr);
+ if (did_line)
+ axis_stroke(fmkr,p, ierr, LINE_CAP_BUTT);
}
static double log_subintervals[8] = {
@@ -864,7 +870,7 @@ static void draw_minor_ticks(OBJ_PTR fmkr, FM *p, PlotAxis *s, int *ierr)
/* And we free the array returned by get_minor_ticks_location */
free(locs);
if (did_line)
- axis_stroke(fmkr,p, ierr);
+ axis_stroke(fmkr,p, ierr, LINE_CAP_BUTT);
}
static void show_numeric_label(OBJ_PTR fmkr, FM *p, PlotAxis *s,
diff --git a/ext/Tioga/FigureMaker/shared/pdfcolor.c b/ext/Tioga/FigureMaker/shared/pdfcolor.c
index 6b7a735..125d384 100644
--- a/ext/Tioga/FigureMaker/shared/pdfcolor.c
+++ b/ext/Tioga/FigureMaker/shared/pdfcolor.c
@@ -402,7 +402,7 @@ convert_rgb_to_hls(double r, double g, double b, double *p_h, double *p_l,
}
*p_h = h;
*p_l = l;
- *p_s = s;
+ *p_s = MIN( 1., MAX( s, 0. ));
}
diff --git a/lib/Tioga/FigMkr.rb b/lib/Tioga/FigMkr.rb
index 8c99dc6..b661297 100644
--- a/lib/Tioga/FigMkr.rb
+++ b/lib/Tioga/FigMkr.rb
@@ -38,7 +38,7 @@ class FigureMaker
# This URL will contain tioga-(...) when it is exported from the
# SVN repository. This is where we'll look for version information.
- SVN_URL = '$HeadURL: svn+ssh://rubyforge.org/var/svn/tioga/tags/tioga/Tioga%201.14/lib/Tioga/FigMkr.rb $'
+ SVN_URL = '$HeadURL: svn+ssh://rubyforge.org/var/svn/tioga/tags/tioga/Tioga%201.16/lib/Tioga/FigMkr.rb $'
TIOGA_VERSION = if SVN_URL =~ /tags\/tioga\/Tioga%20([^\/]+)/
$1
@@ -62,8 +62,14 @@ class FigureMaker
end
def FigureMaker.pdflatex
- @@which_pdflatex = 'pdflatex' if @@which_pdflatex == nil
- @@which_pdflatex
+ if ! @@which_pdflatex
+ @@which_pdflatex = if ENV.key? 'TIOGA_PDFLATEX'
+ ENV['TIOGA_PDFLATEX']
+ else
+ "pdflatex"
+ end
+ end
+ return @@which_pdflatex
end
def FigureMaker.pdflatex=(s)
@@ -164,6 +170,8 @@ class FigureMaker
# as it causes a systematic second run of pdflatex.
attr_accessor :measure_legends
+ # Stores the errors recorded in the last run of pdflatex.
+ attr_accessor :pdflatex_errors
# old preview attributes -- to be removed later
@@ -2304,43 +2312,79 @@ class FigureMaker
quiet = @quiet_mode
run_directory = @run_dir
- if (@save_dir == nil)
- logname = "pdflatex.log"
- else
- logname = "#{@save_dir}/pdflatex.log"
- end
-
- if (@save_dir == nil)
- syscmd = "#{pdflatex} -interaction nonstopmode #{name}.tex"
- else
- syscmd = "cd #{@save_dir}; #{pdflatex} -interaction nonstopmode #{name}.tex"
- end
- # Now fun begins:
- # We use IO::popen for three reasons:
- # * first, we want to be able to read back information from
- # pdflatex (see \tiogameasure)
- # * second, this way of doing should be portable to win, while
- # the > trick might not be that much...
- # * third, closing the standard input of pdflatex will remove
- # painful bugs, when pdflatex gets interrupted but waits
- # for an input for which it didn't prompt.
-
- @measures = {}
- IO::popen(syscmd, "r+") do |f|
- f.close_write # We don't need that.
- log = File.open(logname, "w")
- for line in f
- log.print line
- if line =~ /^(.*)\[(\d)\]=(.+pt)/
- n = $1
- num = $2.to_i
- dim = Utils::tex_dimension_to_bp($3)
- @measures[n] ||= []
- @measures[n][num] = dim
+ logname = "pdflatex.log"
+
+ new_dir = @save_dir || "."
+ syscmd = "#{pdflatex} -interaction nonstopmode #{name}.tex"
+
+ popen_error = nil
+ @pdflatex_errors = []
+ Dir.chdir(new_dir) do
+ # Now fun begins:
+ # We use IO::popen for three reasons:
+ # * first, we want to be able to read back information from
+ # pdflatex (see \tiogameasure)
+ # * second, this way of doing should be portable to win, while
+ # the > trick might not be that much...
+ # * third, closing the standard input of pdflatex will remove
+ # painful bugs, when pdflatex gets interrupted but waits
+ # for an input for which it didn't prompt.
+
+ @measures = {}
+ begin
+ IO::popen(syscmd, "r+") do |f|
+ f.close_write # We don't need that.
+ log = File.open(logname, "w")
+ error_pending = false
+ for line in f
+ log.print line
+ if line =~ /^(.*)\[(\d)\]=(.+pt)/
+ n = $1
+ num = $2.to_i
+ dim = Utils::tex_dimension_to_bp($3)
+ @measures[n] ||= []
+ @measures[n][num] = dim
+ elsif line =~ /^!/
+ error_pending = true
+ elsif line =~ /^\s*$/ # errors seem to stop at blank lines
+ error_pending = false
+ end
+ if error_pending
+ @pdflatex_errors << line
+ end
+ end
end
+ rescue SystemCallError => e
+ popen_error = e
end
end
+
+ if ($?.exitstatus == 127) or popen_error
+ $stderr.puts <<"EOE"
+ERROR: Tioga doesn't seem to find pdflatex (as '#{pdflatex}').
+
+This probably means that you don't have any working version of
+pdflatex, in which case you can get it there:
+
+http://www.tug.org/texlive/
+
+or try installing texlive with your favorite package manager.
+
+Alternatively, if you're positive that you have a working version of
+pdflatex installed, either make sur it is in your path or define the
+TIOGA_PDFLATEX environment variable to its full path, by adding for
+instance:
+export TIOGA_PDFLATEX=/path/to/pdflatex
+
+in your ~/.bashrc.
+EOE
+
+ if popen_error
+ $stderr.puts "Error: #{popen_error.inspect}"
+ end
+ end
+
# Now passing the saved measures to the C code.
for key, val in @measures
# p @fm_data
@@ -2349,7 +2393,7 @@ class FigureMaker
result = $?
if !result
- puts "ERROR: #{pdflatex} failed."
+ $stderr.puts "ERROR: #{pdflatex} failed with error code #{$?.exitstatus}"
file = File.open(logname)
if file == nil
puts "cannot open #{logname}"
diff --git a/lib/Tioga/TexPreamble.rb b/lib/Tioga/TexPreamble.rb
new file mode 100644
index 0000000..83fbc96
--- /dev/null
+++ b/lib/Tioga/TexPreamble.rb
@@ -0,0 +1,372 @@
+# This file is automatically generated from Tioga/tioga.sty.in
+# using the Tioga/mk_tioga_sty.rb script.
+#
+# Please do not modify this file directly as all changes would
+# be lost !!
+
+module Tioga
+ class FigureMaker
+ TEX_PREAMBLE = <<'End_of_preamble'
+\makeatletter
+% Here are some command to ease the use of pictures produced by Tioga
+% within a LaTeX document.
+
+
+% \tiogafigurefullpage[minwhitespace]{figurename}
+%
+% \tiogafigurefullpage shows a version of the picture scaled to fit the
+% paper size minus the minwhitespace. The minwhitespace is the sum of
+% the margins on both sides, top and bottom or left and right.
+% The minwhitespace defaults to 2 inches.
+%
+\newcommand{\tiogafigurefullpage}[2][2in]{
+ \tiogafigurescaledtofit{#2}{\paperwidth - (#1)}{\paperheight - (#1)}}
+
+
+% \tiogafigurescaledtofit{figurename}{maxwidth}{maxheight}
+%
+% \tiogafigurescaledtofit shows a version of the picture scaled to fit the
+% given width and height while preserving the aspect ratio.
+% The 1st arg is the base name for the pdf and txt files.
+% The 2nd arg determines the maximum figure width.
+% The 3rd arg determines the maximum figure height.
+\newcommand{\tiogafigurescaledtofit}[3]{
+ \setkeys{Gin}{keepaspectratio=true}
+ \resizebox{#2}{#3}{\tiogafigureshow{#1}}}
+
+
+% \tiogafigurescaled{figurename}{scalefactor}
+%
+% \tiogafigurescaled shows a scaled version of the picture
+% The 1st arg is the base name for the pdf and txt files.
+% The 2nd arg determines the scale.
+\newcommand{\tiogafigurescaled}[2]{
+ \scalebox{#2}{\tiogafigureshow{#1}}}
+
+
+% \tiogafigurescaledxy{figurename}{xscalefactor}{yscalefactor}
+%
+% \tiogafigurescaledxy shows a scaled version of the picture where you
+% can use different scaling factors in the horizontal and vertical directions.
+% The 1st arg is the base name for the pdf and txt files.
+% The 2nd arg determines the horizontal scale.
+% The 3rd arg determines the vertical scale.
+\newcommand{\tiogafigurescaledxy}[3]{
+ \scalebox{#2}[#3]{\tiogafigureshow{#1}}}
+
+
+% \tiogafiguresized{figurename}{figurewidth}{figureheight}
+%
+% \tiogafiguresized shows a scaled version of the picture, where you
+% can specify the actual size you want. If either length is
+% given as !, the one scale factor is used in both directions.
+% The 1st arg is the base name for the pdf and txt files.
+% The 2nd arg determines the figure width.
+% The 3rd arg determines the figure height.
+\newcommand{\tiogafiguresized}[3]{
+ \resizebox{#2}{#3}{\tiogafigureshow{#1}}}
+
+
+% \tiogaprefix can be used to set a path for the figure pdf and txt files.
+%
+\newcommand{\tiogaprefix}{}
+% The prefix is initialized to an empty string.
+% To change it, use \renewcommand as in the following example:
+% \renewcommand{\tiogaprefix}{plot_out/}
+
+
+% \tiogafigurecentered{figurename}{targetwidth}{targetheight}
+%
+% \tiogafigurecentered displays an unscaled figure centered within
+% a box of targetwidth *targetheight.
+\newcommand{\tiogafigurecentered}[3]{
+\vbox to #3{%
+\vspace*{\fill}%
+\hbox to #2{\hfill%
+\tiogafigureshow{#1}%
+\hspace*{\fill}}%
+\vspace*{\fill}%
+}}
+
+% \tiogafigurecentereddebug{figurename}{targetwidth}{targetheight}
+%
+% \tiogafigurecentereddebug has the same effect as \tiogafigurecentered
+% except that the figure is included in a \fbox, which makes it easier
+% to track problems.
+\newcommand{\tiogafigurecentereddebug}[3]{
+\vbox to #3{%
+\vspace*{\fill}%
+\hbox to #2{\hfill%
+\fbox{\tiogafigureshow{#1}}
+\hspace*{\fill}}%
+\vspace*{\fill}%
+}}
+
+
+% \tiogafigureshow{figurename}
+%
+% \tiogafigureshow shows the figure and the accompanying text.
+% Inside a box, it first creates a picture that includes the pdf
+% file with the graphics for the figure, then it includes the text.
+% The \tiogaprefix is added at the start of the file names for both.
+\newcommand{\tiogafigureshow}[1]{%
+ \mbox{\begin{picture}(0,0)(0,0)%
+ \put(0,0){\includegraphics{\tiogaprefix#1_figure.pdf}}%
+ \end{picture}%
+ \input{\tiogaprefix#1_figure.txt}}}
+
+% Commands for text properties:
+% Font size (two parameters)
+% {sz}{line_sp}, 1st is size of font in points,
+% 2nd is line spacing (not used by Tioga)
+\newcommand\tiog at fontsize{{10.0}{10pt}}
+\newcommand\settiogafontsize[2][10pt]{\renewcommand\tiog at fontsize{{#2}{#1}}}
+
+% Font family
+% \rmdefault, \sfdefault, \ttdefault -- roman, sans serif, typewriter
+\newcommand\tiog at fontfamily{\rmdefault}
+\newcommand\settiogafontfamily[1]{\renewcommand\tiog at fontfamily{#1}}
+
+% Font series
+% \mddefault, \bfdefault -- medium, bold
+\newcommand\tiog at fontseries{\mddefault}
+\newcommand\settiogafontseries[1]{\renewcommand\tiog at fontseries{#1}}
+
+% Font shape
+% \updefault, \itdefault, \sldefault, \scdefault -- upright, italic, slant, small caps
+\newcommand\tiog at fontshape{\updefault}
+\newcommand\settiogafontshape[1]{\renewcommand\tiog at fontshape{#1}}
+
+% \SetTiogaFontInfo is called from within the figure.txt file with the TeX
+% for the text of the figure. Do not modify this function directly, it
+% is way better to use the previous settiogafont* commands.
+\newcommand\SetTiogaFontInfo{%
+\expandafter\fontsize\tiog at fontsize%
+\fontfamily{\tiog at fontfamily}%
+\fontseries{\tiog at fontseries}%
+\fontshape{\tiog at fontshape}%
+}
+
+% This command is used inside the _figure.txt files. You can use it directly
+% as well, if you really want to make sure you get the same fonts. But I
+% personnaly doubt it would really come in useful ;-)...
+\newcommand\tiogasetfont{\reset at font\SetTiogaFontInfo%
+\selectfont}%
+
+
+% This commands typesets its second argument while sending to the
+% standard output successively the width, height and depth of the
+% box produced.
+%
+% These informations are collected when Tioga runs pdflatex.
+\newlength{\tiogatempdim}
+\newcommand{\tiogameasure}[2]{%
+\settowidth{\tiogatempdim}{#2}\typeout{#1[0]=\the\tiogatempdim}%
+\settoheight{\tiogatempdim}{#2}\typeout{#1[1]=\the\tiogatempdim}%
+\settodepth{\tiogatempdim}{#2}\typeout{#1[2]=\the\tiogatempdim}%
+{#2}}
+
+\makeatother
+End_of_preamble
+ COLOR_PREAMBLE = <<'End_of_preamble'
+% Color constants, generated from ColorConstants.rb
+\definecolor{AliceBlue}{rgb}{0.940,0.972,1.000}
+\definecolor{AntiqueWhite}{rgb}{0.980,0.920,0.844}
+\definecolor{Aqua}{rgb}{0.000,1.000,1.000}
+\definecolor{Aquamarine}{rgb}{0.498,1.000,0.830}
+\definecolor{Avocado}{rgb}{0.600,0.600,0.000}
+\definecolor{Azure}{rgb}{0.940,1.000,1.000}
+\definecolor{Beige}{rgb}{0.960,0.960,0.864}
+\definecolor{Bisque}{rgb}{1.000,0.894,0.770}
+\definecolor{Black}{rgb}{0.000,0.000,0.000}
+\definecolor{BlanchedAlmond}{rgb}{1.000,0.920,0.804}
+\definecolor{Blue}{rgb}{0.000,0.000,1.000}
+\definecolor{BlueGreen}{rgb}{0.000,0.600,0.400}
+\definecolor{BlueViolet}{rgb}{0.540,0.170,0.888}
+\definecolor{BrickRed}{rgb}{0.645,0.000,0.129}
+\definecolor{BrightBlue}{rgb}{0.000,0.400,1.000}
+\definecolor{BrightPink}{rgb}{1.000,0.400,0.800}
+\definecolor{Brown}{rgb}{0.648,0.165,0.165}
+\definecolor{Burgundy}{rgb}{0.600,0.000,0.200}
+\definecolor{BurlyWood}{rgb}{0.870,0.720,0.530}
+\definecolor{CadetBlue}{rgb}{0.372,0.620,0.628}
+\definecolor{Cement}{rgb}{0.800,0.800,0.600}
+\definecolor{Chartreuse}{rgb}{0.498,1.000,0.000}
+\definecolor{Chiffon}{rgb}{0.980,0.980,0.824}
+\definecolor{Chocolate}{rgb}{0.824,0.410,0.116}
+\definecolor{Coral}{rgb}{1.000,0.498,0.312}
+\definecolor{CornflowerBlue}{rgb}{0.392,0.585,0.930}
+\definecolor{Cornsilk}{rgb}{1.000,0.972,0.864}
+\definecolor{Crimson}{rgb}{0.800,0.000,0.200}
+\definecolor{Cyan}{rgb}{0.000,1.000,1.000}
+\definecolor{DarkBlue}{rgb}{0.000,0.000,0.545}
+\definecolor{DarkChocolate}{rgb}{0.400,0.200,0.000}
+\definecolor{DarkCyan}{rgb}{0.000,0.545,0.545}
+\definecolor{DarkGoldenrod}{rgb}{0.720,0.525,0.044}
+\definecolor{DarkGray}{rgb}{0.664,0.664,0.664}
+\definecolor{DarkGreen}{rgb}{0.000,0.392,0.000}
+\definecolor{DarkGrey}{rgb}{0.664,0.664,0.664}
+\definecolor{DarkKhaki}{rgb}{0.740,0.716,0.420}
+\definecolor{DarkLavender}{rgb}{0.400,0.200,0.600}
+\definecolor{DarkMagenta}{rgb}{0.545,0.000,0.545}
+\definecolor{DarkOliveGreen}{rgb}{0.332,0.420,0.185}
+\definecolor{DarkOrange}{rgb}{1.000,0.550,0.000}
+\definecolor{DarkOrchid}{rgb}{0.600,0.196,0.800}
+\definecolor{DarkPeriwinkle}{rgb}{0.400,0.400,1.000}
+\definecolor{DarkPurpleBlue}{rgb}{0.400,0.000,0.800}
+\definecolor{DarkRed}{rgb}{0.545,0.000,0.000}
+\definecolor{DarkRoyalBlue}{rgb}{0.000,0.200,0.800}
+\definecolor{DarkSalmon}{rgb}{0.912,0.590,0.480}
+\definecolor{DarkSeaGreen}{rgb}{0.560,0.736,0.560}
+\definecolor{DarkSlateBlue}{rgb}{0.284,0.240,0.545}
+\definecolor{DarkSlateGray}{rgb}{0.185,0.310,0.310}
+\definecolor{DarkSlateGrey}{rgb}{0.185,0.310,0.310}
+\definecolor{DarkSmoke}{rgb}{0.920,0.920,0.920}
+\definecolor{DarkTurquoise}{rgb}{0.000,0.808,0.820}
+\definecolor{DarkViolet}{rgb}{0.580,0.000,0.828}
+\definecolor{DeepPink}{rgb}{1.000,0.080,0.576}
+\definecolor{DeepSkyBlue}{rgb}{0.000,0.750,1.000}
+\definecolor{DimGray}{rgb}{0.410,0.410,0.410}
+\definecolor{DimGrey}{rgb}{0.410,0.410,0.410}
+\definecolor{DodgerBlue}{rgb}{0.116,0.565,1.000}
+\definecolor{FireBrick}{rgb}{0.698,0.132,0.132}
+\definecolor{FloralWhite}{rgb}{1.000,0.980,0.940}
+\definecolor{ForestGreen}{rgb}{0.132,0.545,0.132}
+\definecolor{Fuchsia}{rgb}{1.000,0.000,1.000}
+\definecolor{Gainsboro}{rgb}{0.864,0.864,0.864}
+\definecolor{GhostWhite}{rgb}{0.972,0.972,1.000}
+\definecolor{Gold}{rgb}{1.000,0.844,0.000}
+\definecolor{GoldenBrown}{rgb}{0.600,0.400,0.000}
+\definecolor{Goldenrod}{rgb}{0.855,0.648,0.125}
+\definecolor{GrassGreen}{rgb}{0.200,0.600,0.000}
+\definecolor{Gray}{rgb}{0.500,0.500,0.500}
+\definecolor{GrayBlue}{rgb}{0.000,0.400,0.600}
+\definecolor{Green}{rgb}{0.000,0.500,0.000}
+\definecolor{GreenYellow}{rgb}{0.680,1.000,0.185}
+\definecolor{Grey}{rgb}{0.500,0.500,0.500}
+\definecolor{Honeydew}{rgb}{0.940,1.000,0.940}
+\definecolor{HotPink}{rgb}{1.000,0.410,0.705}
+\definecolor{IndianRed}{rgb}{0.804,0.360,0.360}
+\definecolor{Indigo}{rgb}{0.294,0.000,0.510}
+\definecolor{Ivory}{rgb}{1.000,1.000,0.940}
+\definecolor{Khaki}{rgb}{0.940,0.900,0.550}
+\definecolor{Lavender}{rgb}{0.900,0.900,0.980}
+\definecolor{LavenderBlue}{rgb}{0.400,0.200,1.000}
+\definecolor{LavenderBlush}{rgb}{1.000,0.940,0.960}
+\definecolor{LawnGreen}{rgb}{0.488,0.990,0.000}
+\definecolor{LemonChiffon}{rgb}{1.000,0.980,0.804}
+\definecolor{LightBlue}{rgb}{0.680,0.848,0.900}
+\definecolor{LightBrightGreen}{rgb}{0.000,0.800,0.200}
+\definecolor{LightCoral}{rgb}{0.940,0.500,0.500}
+\definecolor{LightCrimson}{rgb}{0.864,0.080,0.235}
+\definecolor{LightCyan}{rgb}{0.880,1.000,1.000}
+\definecolor{LightDullGreen}{rgb}{0.400,1.000,0.600}
+\definecolor{LightGold}{rgb}{0.800,0.800,0.400}
+\definecolor{LightGrassGreen}{rgb}{0.400,1.000,0.400}
+\definecolor{LightGray}{rgb}{0.828,0.828,0.828}
+\definecolor{LightGreen}{rgb}{0.565,0.932,0.565}
+\definecolor{LightGrey}{rgb}{0.828,0.828,0.828}
+\definecolor{LightMustard}{rgb}{1.000,0.800,0.400}
+\definecolor{LightOliveGreen}{rgb}{0.600,0.800,0.600}
+\definecolor{LightOrchid}{rgb}{0.600,0.400,0.800}
+\definecolor{LightPlum}{rgb}{0.800,0.600,0.800}
+\definecolor{LightRose}{rgb}{1.000,0.600,0.800}
+\definecolor{LightSalmon}{rgb}{1.000,0.628,0.480}
+\definecolor{LightSandyBrown}{rgb}{1.000,0.800,0.600}
+\definecolor{LightSeaGreen}{rgb}{0.125,0.698,0.668}
+\definecolor{LightSienna}{rgb}{0.800,0.400,0.000}
+\definecolor{LightSkyBlue}{rgb}{0.530,0.808,0.980}
+\definecolor{LightSlateGray}{rgb}{0.468,0.532,0.600}
+\definecolor{LightSlateGrey}{rgb}{0.468,0.532,0.600}
+\definecolor{LightSteelBlue}{rgb}{0.690,0.770,0.870}
+\definecolor{LightTurquoise}{rgb}{0.200,1.000,0.800}
+\definecolor{LightYellow}{rgb}{1.000,1.000,0.880}
+\definecolor{LightYellowGreen}{rgb}{0.800,0.800,0.200}
+\definecolor{Lilac}{rgb}{0.800,0.600,1.000}
+\definecolor{Lime}{rgb}{0.000,1.000,0.000}
+\definecolor{LimeGreen}{rgb}{0.196,0.804,0.196}
+\definecolor{Linen}{rgb}{0.980,0.940,0.900}
+\definecolor{Magenta}{rgb}{1.000,0.000,1.000}
+\definecolor{Maroon}{rgb}{0.500,0.000,0.000}
+\definecolor{Mauve}{rgb}{0.800,0.200,0.400}
+\definecolor{MediumAquamarine}{rgb}{0.400,0.804,0.668}
+\definecolor{MediumBlue}{rgb}{0.000,0.000,0.804}
+\definecolor{MediumGreen}{rgb}{0.000,0.600,0.000}
+\definecolor{MediumOrange}{rgb}{1.000,0.400,0.000}
+\definecolor{MediumOrchid}{rgb}{0.730,0.332,0.828}
+\definecolor{MediumPurple}{rgb}{0.576,0.440,0.860}
+\definecolor{MediumSeaGreen}{rgb}{0.235,0.700,0.444}
+\definecolor{MediumSlateBlue}{rgb}{0.484,0.408,0.932}
+\definecolor{MediumSpringGreen}{rgb}{0.000,0.980,0.604}
+\definecolor{MediumTurquoise}{rgb}{0.284,0.820,0.800}
+\definecolor{MediumVioletRed}{rgb}{0.780,0.084,0.520}
+\definecolor{YellowGreen}{rgb}{0.800,0.800,0.000}
+\definecolor{MidnightBlue}{rgb}{0.098,0.098,0.440}
+\definecolor{MintCream}{rgb}{0.960,1.000,0.980}
+\definecolor{MistyRose}{rgb}{1.000,0.894,0.884}
+\definecolor{Moccasin}{rgb}{1.000,0.894,0.710}
+\definecolor{MustardSeed}{rgb}{0.800,0.600,0.000}
+\definecolor{NavajoWhite}{rgb}{1.000,0.870,0.680}
+\definecolor{Navy}{rgb}{0.000,0.000,0.500}
+\definecolor{OldLace}{rgb}{0.992,0.960,0.900}
+\definecolor{Olive}{rgb}{0.500,0.500,0.000}
+\definecolor{OliveDrab}{rgb}{0.420,0.556,0.136}
+\definecolor{Orange}{rgb}{1.000,0.648,0.000}
+\definecolor{OrangeRed}{rgb}{1.000,0.270,0.000}
+\definecolor{Orchid}{rgb}{0.855,0.440,0.840}
+\definecolor{PaleGoldenrod}{rgb}{0.932,0.910,0.668}
+\definecolor{PaleGreen}{rgb}{0.596,0.985,0.596}
+\definecolor{PaleTurquoise}{rgb}{0.688,0.932,0.932}
+\definecolor{PaleVioletRed}{rgb}{0.860,0.440,0.576}
+\definecolor{PapayaWhip}{rgb}{1.000,0.936,0.835}
+\definecolor{PeachPuff}{rgb}{1.000,0.855,0.725}
+\definecolor{Periwinkle}{rgb}{0.600,0.000,1.000}
+\definecolor{Peru}{rgb}{0.804,0.520,0.248}
+\definecolor{Pink}{rgb}{1.000,0.752,0.796}
+\definecolor{Plum}{rgb}{0.868,0.628,0.868}
+\definecolor{PowderBlue}{rgb}{0.690,0.880,0.900}
+\definecolor{Pumpkin}{rgb}{1.000,0.600,0.200}
+\definecolor{Purple}{rgb}{0.500,0.000,0.500}
+\definecolor{PurpleBlue}{rgb}{0.400,0.200,0.800}
+\definecolor{PurpleGray}{rgb}{0.600,0.600,0.800}
+\definecolor{Red}{rgb}{1.000,0.000,0.000}
+\definecolor{RedBrown}{rgb}{0.800,0.400,0.200}
+\definecolor{RedOrange}{rgb}{0.800,0.200,0.000}
+\definecolor{Rose}{rgb}{1.000,0.400,0.600}
+\definecolor{RosyBrown}{rgb}{0.736,0.560,0.560}
+\definecolor{RoyalBlue}{rgb}{0.255,0.410,0.884}
+\definecolor{RoyalPurple}{rgb}{0.400,0.000,0.600}
+\definecolor{SaddleBrown}{rgb}{0.545,0.270,0.075}
+\definecolor{LightChartreuse}{rgb}{0.800,1.000,0.400}
+\definecolor{Saffron}{rgb}{1.000,0.800,0.000}
+\definecolor{Salmon}{rgb}{0.980,0.500,0.448}
+\definecolor{SalmonRed}{rgb}{1.000,0.400,0.400}
+\definecolor{SandyBrown}{rgb}{0.956,0.644,0.376}
+\definecolor{SeaGreen}{rgb}{0.180,0.545,0.340}
+\definecolor{Seashell}{rgb}{1.000,0.960,0.932}
+\definecolor{Sienna}{rgb}{0.628,0.320,0.176}
+\definecolor{Silver}{rgb}{0.752,0.752,0.752}
+\definecolor{SkyBlue}{rgb}{0.530,0.808,0.920}
+\definecolor{SlateBlue}{rgb}{0.415,0.352,0.804}
+\definecolor{SlateGray}{rgb}{0.440,0.500,0.565}
+\definecolor{SlateGrey}{rgb}{0.440,0.500,0.565}
+\definecolor{Smoke}{rgb}{0.950,0.950,0.950}
+\definecolor{Snow}{rgb}{1.000,0.980,0.980}
+\definecolor{SoftYellow}{rgb}{1.000,1.000,0.400}
+\definecolor{SpringGreen}{rgb}{0.000,1.000,0.498}
+\definecolor{SteelBlue}{rgb}{0.275,0.510,0.705}
+\definecolor{Tan}{rgb}{0.824,0.705,0.550}
+\definecolor{Teal}{rgb}{0.000,0.500,0.500}
+\definecolor{Thistle}{rgb}{0.848,0.750,0.848}
+\definecolor{Tomato}{rgb}{1.000,0.390,0.280}
+\definecolor{Turquoise}{rgb}{0.250,0.880,0.815}
+\definecolor{Violet}{rgb}{0.932,0.510,0.932}
+\definecolor{WarmGray}{rgb}{0.678,0.660,0.562}
+\definecolor{Wheat}{rgb}{0.960,0.870,0.700}
+\definecolor{White}{rgb}{1.000,1.000,1.000}
+\definecolor{WhiteSmoke}{rgb}{0.970,0.970,0.970}
+\definecolor{Yellow}{rgb}{1.000,1.000,0.000}
+
+End_of_preamble
+ end
+end
\ No newline at end of file
diff --git a/lib/Tioga/tioga_ui_cmds.rb b/lib/Tioga/tioga_ui_cmds.rb
index 47b42e4..e4337b0 100644
--- a/lib/Tioga/tioga_ui_cmds.rb
+++ b/lib/Tioga/tioga_ui_cmds.rb
@@ -21,7 +21,7 @@
require 'Tioga/tioga.rb'
require "rbconfig.rb"
-include Config
+include RbConfig
include Tioga
include FigureConstants
@@ -309,7 +309,7 @@ class TiogaUI
# set the standard defaults
$tioga_args = Array.new(args.length) {|i| args[i]} # copy the args
$change_working_directory = true
- if Config::CONFIG["target"] =~ /darwin/i
+ if RbConfig::CONFIG["target"] =~ /darwin/i
$pdf_viewer = "repreview"
#$mac_command_key = true
else
diff --git a/misc/tioga.sty b/misc/tioga.sty
new file mode 100644
index 0000000..4d36caa
--- /dev/null
+++ b/misc/tioga.sty
@@ -0,0 +1,355 @@
+\ProvidesPackage{tioga}[2013/08/26]
+% Here are some command to ease the use of pictures produced by Tioga
+% within a LaTeX document.
+
+
+% \tiogafigurefullpage[minwhitespace]{figurename}
+%
+% \tiogafigurefullpage shows a version of the picture scaled to fit the
+% paper size minus the minwhitespace. The minwhitespace is the sum of
+% the margins on both sides, top and bottom or left and right.
+% The minwhitespace defaults to 2 inches.
+%
+\newcommand{\tiogafigurefullpage}[2][2in]{
+ \tiogafigurescaledtofit{#2}{\paperwidth - (#1)}{\paperheight - (#1)}}
+
+
+% \tiogafigurescaledtofit{figurename}{maxwidth}{maxheight}
+%
+% \tiogafigurescaledtofit shows a version of the picture scaled to fit the
+% given width and height while preserving the aspect ratio.
+% The 1st arg is the base name for the pdf and txt files.
+% The 2nd arg determines the maximum figure width.
+% The 3rd arg determines the maximum figure height.
+\newcommand{\tiogafigurescaledtofit}[3]{
+ \setkeys{Gin}{keepaspectratio=true}
+ \resizebox{#2}{#3}{\tiogafigureshow{#1}}}
+
+
+% \tiogafigurescaled{figurename}{scalefactor}
+%
+% \tiogafigurescaled shows a scaled version of the picture
+% The 1st arg is the base name for the pdf and txt files.
+% The 2nd arg determines the scale.
+\newcommand{\tiogafigurescaled}[2]{
+ \scalebox{#2}{\tiogafigureshow{#1}}}
+
+
+% \tiogafigurescaledxy{figurename}{xscalefactor}{yscalefactor}
+%
+% \tiogafigurescaledxy shows a scaled version of the picture where you
+% can use different scaling factors in the horizontal and vertical directions.
+% The 1st arg is the base name for the pdf and txt files.
+% The 2nd arg determines the horizontal scale.
+% The 3rd arg determines the vertical scale.
+\newcommand{\tiogafigurescaledxy}[3]{
+ \scalebox{#2}[#3]{\tiogafigureshow{#1}}}
+
+
+% \tiogafiguresized{figurename}{figurewidth}{figureheight}
+%
+% \tiogafiguresized shows a scaled version of the picture, where you
+% can specify the actual size you want. If either length is
+% given as !, the one scale factor is used in both directions.
+% The 1st arg is the base name for the pdf and txt files.
+% The 2nd arg determines the figure width.
+% The 3rd arg determines the figure height.
+\newcommand{\tiogafiguresized}[3]{
+ \resizebox{#2}{#3}{\tiogafigureshow{#1}}}
+
+
+% \tiogaprefix can be used to set a path for the figure pdf and txt files.
+%
+\newcommand{\tiogaprefix}{}
+% The prefix is initialized to an empty string.
+% To change it, use \renewcommand as in the following example:
+% \renewcommand{\tiogaprefix}{plot_out/}
+
+
+% \tiogafigurecentered{figurename}{targetwidth}{targetheight}
+%
+% \tiogafigurecentered displays an unscaled figure centered within
+% a box of targetwidth *targetheight.
+\newcommand{\tiogafigurecentered}[3]{
+\vbox to #3{%
+\vspace*{\fill}%
+\hbox to #2{\hfill%
+\tiogafigureshow{#1}%
+\hspace*{\fill}}%
+\vspace*{\fill}%
+}}
+
+% \tiogafigurecentereddebug{figurename}{targetwidth}{targetheight}
+%
+% \tiogafigurecentereddebug has the same effect as \tiogafigurecentered
+% except that the figure is included in a \fbox, which makes it easier
+% to track problems.
+\newcommand{\tiogafigurecentereddebug}[3]{
+\vbox to #3{%
+\vspace*{\fill}%
+\hbox to #2{\hfill%
+\fbox{\tiogafigureshow{#1}}
+\hspace*{\fill}}%
+\vspace*{\fill}%
+}}
+
+
+% \tiogafigureshow{figurename}
+%
+% \tiogafigureshow shows the figure and the accompanying text.
+% Inside a box, it first creates a picture that includes the pdf
+% file with the graphics for the figure, then it includes the text.
+% The \tiogaprefix is added at the start of the file names for both.
+\newcommand{\tiogafigureshow}[1]{%
+ \mbox{\begin{picture}(0,0)(0,0)%
+ \put(0,0){\includegraphics{\tiogaprefix#1_figure.pdf}}%
+ \end{picture}%
+ \input{\tiogaprefix#1_figure.txt}}}
+
+% Commands for text properties:
+% Font size (two parameters)
+% {sz}{line_sp}, 1st is size of font in points,
+% 2nd is line spacing (not used by Tioga)
+\newcommand\tiog at fontsize{{10.0}{10pt}}
+\newcommand\settiogafontsize[2][10pt]{\renewcommand\tiog at fontsize{{#2}{#1}}}
+
+% Font family
+% \rmdefault, \sfdefault, \ttdefault -- roman, sans serif, typewriter
+\newcommand\tiog at fontfamily{\rmdefault}
+\newcommand\settiogafontfamily[1]{\renewcommand\tiog at fontfamily{#1}}
+
+% Font series
+% \mddefault, \bfdefault -- medium, bold
+\newcommand\tiog at fontseries{\mddefault}
+\newcommand\settiogafontseries[1]{\renewcommand\tiog at fontseries{#1}}
+
+% Font shape
+% \updefault, \itdefault, \sldefault, \scdefault -- upright, italic, slant, small caps
+\newcommand\tiog at fontshape{\updefault}
+\newcommand\settiogafontshape[1]{\renewcommand\tiog at fontshape{#1}}
+
+% \SetTiogaFontInfo is called from within the figure.txt file with the TeX
+% for the text of the figure. Do not modify this function directly, it
+% is way better to use the previous settiogafont* commands.
+\newcommand\SetTiogaFontInfo{%
+\expandafter\fontsize\tiog at fontsize%
+\fontfamily{\tiog at fontfamily}%
+\fontseries{\tiog at fontseries}%
+\fontshape{\tiog at fontshape}%
+}
+
+% This command is used inside the _figure.txt files. You can use it directly
+% as well, if you really want to make sure you get the same fonts. But I
+% personnaly doubt it would really come in useful ;-)...
+\newcommand\tiogasetfont{\reset at font\SetTiogaFontInfo%
+\selectfont}%
+
+
+% This commands typesets its second argument while sending to the
+% standard output successively the width, height and depth of the
+% box produced.
+%
+% These informations are collected when Tioga runs pdflatex.
+\newlength{\tiogatempdim}
+\newcommand{\tiogameasure}[2]{%
+\settowidth{\tiogatempdim}{#2}\typeout{#1[0]=\the\tiogatempdim}%
+\settoheight{\tiogatempdim}{#2}\typeout{#1[1]=\the\tiogatempdim}%
+\settodepth{\tiogatempdim}{#2}\typeout{#1[2]=\the\tiogatempdim}%
+{#2}}
+% Color constants, generated from ColorConstants.rb
+\definecolor{AliceBlue}{rgb}{0.940,0.972,1.000}
+\definecolor{AntiqueWhite}{rgb}{0.980,0.920,0.844}
+\definecolor{Aqua}{rgb}{0.000,1.000,1.000}
+\definecolor{Aquamarine}{rgb}{0.498,1.000,0.830}
+\definecolor{Avocado}{rgb}{0.600,0.600,0.000}
+\definecolor{Azure}{rgb}{0.940,1.000,1.000}
+\definecolor{Beige}{rgb}{0.960,0.960,0.864}
+\definecolor{Bisque}{rgb}{1.000,0.894,0.770}
+\definecolor{Black}{rgb}{0.000,0.000,0.000}
+\definecolor{BlanchedAlmond}{rgb}{1.000,0.920,0.804}
+\definecolor{Blue}{rgb}{0.000,0.000,1.000}
+\definecolor{BlueGreen}{rgb}{0.000,0.600,0.400}
+\definecolor{BlueViolet}{rgb}{0.540,0.170,0.888}
+\definecolor{BrickRed}{rgb}{0.645,0.000,0.129}
+\definecolor{BrightBlue}{rgb}{0.000,0.400,1.000}
+\definecolor{BrightPink}{rgb}{1.000,0.400,0.800}
+\definecolor{Brown}{rgb}{0.648,0.165,0.165}
+\definecolor{Burgundy}{rgb}{0.600,0.000,0.200}
+\definecolor{BurlyWood}{rgb}{0.870,0.720,0.530}
+\definecolor{CadetBlue}{rgb}{0.372,0.620,0.628}
+\definecolor{Cement}{rgb}{0.800,0.800,0.600}
+\definecolor{Chartreuse}{rgb}{0.498,1.000,0.000}
+\definecolor{Chiffon}{rgb}{0.980,0.980,0.824}
+\definecolor{Chocolate}{rgb}{0.824,0.410,0.116}
+\definecolor{Coral}{rgb}{1.000,0.498,0.312}
+\definecolor{CornflowerBlue}{rgb}{0.392,0.585,0.930}
+\definecolor{Cornsilk}{rgb}{1.000,0.972,0.864}
+\definecolor{Crimson}{rgb}{0.800,0.000,0.200}
+\definecolor{Cyan}{rgb}{0.000,1.000,1.000}
+\definecolor{DarkBlue}{rgb}{0.000,0.000,0.545}
+\definecolor{DarkChocolate}{rgb}{0.400,0.200,0.000}
+\definecolor{DarkCyan}{rgb}{0.000,0.545,0.545}
+\definecolor{DarkGoldenrod}{rgb}{0.720,0.525,0.044}
+\definecolor{DarkGray}{rgb}{0.664,0.664,0.664}
+\definecolor{DarkGreen}{rgb}{0.000,0.392,0.000}
+\definecolor{DarkGrey}{rgb}{0.664,0.664,0.664}
+\definecolor{DarkKhaki}{rgb}{0.740,0.716,0.420}
+\definecolor{DarkLavender}{rgb}{0.400,0.200,0.600}
+\definecolor{DarkMagenta}{rgb}{0.545,0.000,0.545}
+\definecolor{DarkOliveGreen}{rgb}{0.332,0.420,0.185}
+\definecolor{DarkOrange}{rgb}{1.000,0.550,0.000}
+\definecolor{DarkOrchid}{rgb}{0.600,0.196,0.800}
+\definecolor{DarkPeriwinkle}{rgb}{0.400,0.400,1.000}
+\definecolor{DarkPurpleBlue}{rgb}{0.400,0.000,0.800}
+\definecolor{DarkRed}{rgb}{0.545,0.000,0.000}
+\definecolor{DarkRoyalBlue}{rgb}{0.000,0.200,0.800}
+\definecolor{DarkSalmon}{rgb}{0.912,0.590,0.480}
+\definecolor{DarkSeaGreen}{rgb}{0.560,0.736,0.560}
+\definecolor{DarkSlateBlue}{rgb}{0.284,0.240,0.545}
+\definecolor{DarkSlateGray}{rgb}{0.185,0.310,0.310}
+\definecolor{DarkSlateGrey}{rgb}{0.185,0.310,0.310}
+\definecolor{DarkSmoke}{rgb}{0.920,0.920,0.920}
+\definecolor{DarkTurquoise}{rgb}{0.000,0.808,0.820}
+\definecolor{DarkViolet}{rgb}{0.580,0.000,0.828}
+\definecolor{DeepPink}{rgb}{1.000,0.080,0.576}
+\definecolor{DeepSkyBlue}{rgb}{0.000,0.750,1.000}
+\definecolor{DimGray}{rgb}{0.410,0.410,0.410}
+\definecolor{DimGrey}{rgb}{0.410,0.410,0.410}
+\definecolor{DodgerBlue}{rgb}{0.116,0.565,1.000}
+\definecolor{FireBrick}{rgb}{0.698,0.132,0.132}
+\definecolor{FloralWhite}{rgb}{1.000,0.980,0.940}
+\definecolor{ForestGreen}{rgb}{0.132,0.545,0.132}
+\definecolor{Fuchsia}{rgb}{1.000,0.000,1.000}
+\definecolor{Gainsboro}{rgb}{0.864,0.864,0.864}
+\definecolor{GhostWhite}{rgb}{0.972,0.972,1.000}
+\definecolor{Gold}{rgb}{1.000,0.844,0.000}
+\definecolor{GoldenBrown}{rgb}{0.600,0.400,0.000}
+\definecolor{Goldenrod}{rgb}{0.855,0.648,0.125}
+\definecolor{GrassGreen}{rgb}{0.200,0.600,0.000}
+\definecolor{Gray}{rgb}{0.500,0.500,0.500}
+\definecolor{GrayBlue}{rgb}{0.000,0.400,0.600}
+\definecolor{Green}{rgb}{0.000,0.500,0.000}
+\definecolor{GreenYellow}{rgb}{0.680,1.000,0.185}
+\definecolor{Grey}{rgb}{0.500,0.500,0.500}
+\definecolor{Honeydew}{rgb}{0.940,1.000,0.940}
+\definecolor{HotPink}{rgb}{1.000,0.410,0.705}
+\definecolor{IndianRed}{rgb}{0.804,0.360,0.360}
+\definecolor{Indigo}{rgb}{0.294,0.000,0.510}
+\definecolor{Ivory}{rgb}{1.000,1.000,0.940}
+\definecolor{Khaki}{rgb}{0.940,0.900,0.550}
+\definecolor{Lavender}{rgb}{0.900,0.900,0.980}
+\definecolor{LavenderBlue}{rgb}{0.400,0.200,1.000}
+\definecolor{LavenderBlush}{rgb}{1.000,0.940,0.960}
+\definecolor{LawnGreen}{rgb}{0.488,0.990,0.000}
+\definecolor{LemonChiffon}{rgb}{1.000,0.980,0.804}
+\definecolor{LightBlue}{rgb}{0.680,0.848,0.900}
+\definecolor{LightBrightGreen}{rgb}{0.000,0.800,0.200}
+\definecolor{LightCoral}{rgb}{0.940,0.500,0.500}
+\definecolor{LightCrimson}{rgb}{0.864,0.080,0.235}
+\definecolor{LightCyan}{rgb}{0.880,1.000,1.000}
+\definecolor{LightDullGreen}{rgb}{0.400,1.000,0.600}
+\definecolor{LightGold}{rgb}{0.800,0.800,0.400}
+\definecolor{LightGrassGreen}{rgb}{0.400,1.000,0.400}
+\definecolor{LightGray}{rgb}{0.828,0.828,0.828}
+\definecolor{LightGreen}{rgb}{0.565,0.932,0.565}
+\definecolor{LightGrey}{rgb}{0.828,0.828,0.828}
+\definecolor{LightMustard}{rgb}{1.000,0.800,0.400}
+\definecolor{LightOliveGreen}{rgb}{0.600,0.800,0.600}
+\definecolor{LightOrchid}{rgb}{0.600,0.400,0.800}
+\definecolor{LightPlum}{rgb}{0.800,0.600,0.800}
+\definecolor{LightRose}{rgb}{1.000,0.600,0.800}
+\definecolor{LightSalmon}{rgb}{1.000,0.628,0.480}
+\definecolor{LightSandyBrown}{rgb}{1.000,0.800,0.600}
+\definecolor{LightSeaGreen}{rgb}{0.125,0.698,0.668}
+\definecolor{LightSienna}{rgb}{0.800,0.400,0.000}
+\definecolor{LightSkyBlue}{rgb}{0.530,0.808,0.980}
+\definecolor{LightSlateGray}{rgb}{0.468,0.532,0.600}
+\definecolor{LightSlateGrey}{rgb}{0.468,0.532,0.600}
+\definecolor{LightSteelBlue}{rgb}{0.690,0.770,0.870}
+\definecolor{LightTurquoise}{rgb}{0.200,1.000,0.800}
+\definecolor{LightYellow}{rgb}{1.000,1.000,0.880}
+\definecolor{LightYellowGreen}{rgb}{0.800,0.800,0.200}
+\definecolor{Lilac}{rgb}{0.800,0.600,1.000}
+\definecolor{Lime}{rgb}{0.000,1.000,0.000}
+\definecolor{LimeGreen}{rgb}{0.196,0.804,0.196}
+\definecolor{Linen}{rgb}{0.980,0.940,0.900}
+\definecolor{Magenta}{rgb}{1.000,0.000,1.000}
+\definecolor{Maroon}{rgb}{0.500,0.000,0.000}
+\definecolor{Mauve}{rgb}{0.800,0.200,0.400}
+\definecolor{MediumAquamarine}{rgb}{0.400,0.804,0.668}
+\definecolor{MediumBlue}{rgb}{0.000,0.000,0.804}
+\definecolor{MediumGreen}{rgb}{0.000,0.600,0.000}
+\definecolor{MediumOrange}{rgb}{1.000,0.400,0.000}
+\definecolor{MediumOrchid}{rgb}{0.730,0.332,0.828}
+\definecolor{MediumPurple}{rgb}{0.576,0.440,0.860}
+\definecolor{MediumSeaGreen}{rgb}{0.235,0.700,0.444}
+\definecolor{MediumSlateBlue}{rgb}{0.484,0.408,0.932}
+\definecolor{MediumSpringGreen}{rgb}{0.000,0.980,0.604}
+\definecolor{MediumTurquoise}{rgb}{0.284,0.820,0.800}
+\definecolor{MediumVioletRed}{rgb}{0.780,0.084,0.520}
+\definecolor{YellowGreen}{rgb}{0.800,0.800,0.000}
+\definecolor{MidnightBlue}{rgb}{0.098,0.098,0.440}
+\definecolor{MintCream}{rgb}{0.960,1.000,0.980}
+\definecolor{MistyRose}{rgb}{1.000,0.894,0.884}
+\definecolor{Moccasin}{rgb}{1.000,0.894,0.710}
+\definecolor{MustardSeed}{rgb}{0.800,0.600,0.000}
+\definecolor{NavajoWhite}{rgb}{1.000,0.870,0.680}
+\definecolor{Navy}{rgb}{0.000,0.000,0.500}
+\definecolor{OldLace}{rgb}{0.992,0.960,0.900}
+\definecolor{Olive}{rgb}{0.500,0.500,0.000}
+\definecolor{OliveDrab}{rgb}{0.420,0.556,0.136}
+\definecolor{Orange}{rgb}{1.000,0.648,0.000}
+\definecolor{OrangeRed}{rgb}{1.000,0.270,0.000}
+\definecolor{Orchid}{rgb}{0.855,0.440,0.840}
+\definecolor{PaleGoldenrod}{rgb}{0.932,0.910,0.668}
+\definecolor{PaleGreen}{rgb}{0.596,0.985,0.596}
+\definecolor{PaleTurquoise}{rgb}{0.688,0.932,0.932}
+\definecolor{PaleVioletRed}{rgb}{0.860,0.440,0.576}
+\definecolor{PapayaWhip}{rgb}{1.000,0.936,0.835}
+\definecolor{PeachPuff}{rgb}{1.000,0.855,0.725}
+\definecolor{Periwinkle}{rgb}{0.600,0.000,1.000}
+\definecolor{Peru}{rgb}{0.804,0.520,0.248}
+\definecolor{Pink}{rgb}{1.000,0.752,0.796}
+\definecolor{Plum}{rgb}{0.868,0.628,0.868}
+\definecolor{PowderBlue}{rgb}{0.690,0.880,0.900}
+\definecolor{Pumpkin}{rgb}{1.000,0.600,0.200}
+\definecolor{Purple}{rgb}{0.500,0.000,0.500}
+\definecolor{PurpleBlue}{rgb}{0.400,0.200,0.800}
+\definecolor{PurpleGray}{rgb}{0.600,0.600,0.800}
+\definecolor{Red}{rgb}{1.000,0.000,0.000}
+\definecolor{RedBrown}{rgb}{0.800,0.400,0.200}
+\definecolor{RedOrange}{rgb}{0.800,0.200,0.000}
+\definecolor{Rose}{rgb}{1.000,0.400,0.600}
+\definecolor{RosyBrown}{rgb}{0.736,0.560,0.560}
+\definecolor{RoyalBlue}{rgb}{0.255,0.410,0.884}
+\definecolor{RoyalPurple}{rgb}{0.400,0.000,0.600}
+\definecolor{SaddleBrown}{rgb}{0.545,0.270,0.075}
+\definecolor{LightChartreuse}{rgb}{0.800,1.000,0.400}
+\definecolor{Saffron}{rgb}{1.000,0.800,0.000}
+\definecolor{Salmon}{rgb}{0.980,0.500,0.448}
+\definecolor{SalmonRed}{rgb}{1.000,0.400,0.400}
+\definecolor{SandyBrown}{rgb}{0.956,0.644,0.376}
+\definecolor{SeaGreen}{rgb}{0.180,0.545,0.340}
+\definecolor{Seashell}{rgb}{1.000,0.960,0.932}
+\definecolor{Sienna}{rgb}{0.628,0.320,0.176}
+\definecolor{Silver}{rgb}{0.752,0.752,0.752}
+\definecolor{SkyBlue}{rgb}{0.530,0.808,0.920}
+\definecolor{SlateBlue}{rgb}{0.415,0.352,0.804}
+\definecolor{SlateGray}{rgb}{0.440,0.500,0.565}
+\definecolor{SlateGrey}{rgb}{0.440,0.500,0.565}
+\definecolor{Smoke}{rgb}{0.950,0.950,0.950}
+\definecolor{Snow}{rgb}{1.000,0.980,0.980}
+\definecolor{SoftYellow}{rgb}{1.000,1.000,0.400}
+\definecolor{SpringGreen}{rgb}{0.000,1.000,0.498}
+\definecolor{SteelBlue}{rgb}{0.275,0.510,0.705}
+\definecolor{Tan}{rgb}{0.824,0.705,0.550}
+\definecolor{Teal}{rgb}{0.000,0.500,0.500}
+\definecolor{Thistle}{rgb}{0.848,0.750,0.848}
+\definecolor{Tomato}{rgb}{1.000,0.390,0.280}
+\definecolor{Turquoise}{rgb}{0.250,0.880,0.815}
+\definecolor{Violet}{rgb}{0.932,0.510,0.932}
+\definecolor{WarmGray}{rgb}{0.678,0.660,0.562}
+\definecolor{Wheat}{rgb}{0.960,0.870,0.700}
+\definecolor{White}{rgb}{1.000,1.000,1.000}
+\definecolor{WhiteSmoke}{rgb}{0.970,0.970,0.970}
+\definecolor{Yellow}{rgb}{1.000,1.000,0.000}
diff --git a/tests/tc_Dvector.rb b/tests/tc_Dvector.rb
index 43b4cbc..bf11712 100644
--- a/tests/tc_Dvector.rb
+++ b/tests/tc_Dvector.rb
@@ -153,6 +153,42 @@ class TestDvector < Test::Unit::TestCase
assert_equal(ans, a.div(b))
end
+ def test_each3
+ a = Dvector[ 1, 0, -1 ]
+ b = Dvector[ 3, 4, 5 ]
+ c = Dvector[ 6, 9, 2 ]
+ new = Dvector[]
+ a.each3(b,c){|x,y,z| new << x << y << z}
+ assert_equal Dvector[1,3,6,0,4,9,-1,5,2], new
+ end
+
+ def test_each3_with_index
+ a = Dvector[ 1, 0, -1 ]
+ b = Dvector[ 3, 4, 5 ]
+ c = Dvector[ 6, 9, 2 ]
+ new = Dvector[]
+ a.each3_with_index(b,c){|x,y,z, i| new << x << y << z << i}
+ assert_equal Dvector[1,3,6,0,0,4,9,1,-1,5,2,2], new
+ end
+
+ def test_reverse_each3
+ a = Dvector[ 1, 0, -1 ]
+ b = Dvector[ 3, 4, 5 ]
+ c = Dvector[ 6, 9, 2 ]
+ new = Dvector[]
+ a.reverse_each3(b,c){|x,y,z| new << x << y << z}
+ assert_equal Dvector[-1,5,2,0,4,9,1,3,6], new
+ end
+
+ def test_reverse_each3_with_index
+ a = Dvector[ 1, 0, -1 ]
+ b = Dvector[ 3, 4, 5 ]
+ c = Dvector[ 6, 9, 2 ]
+ new = Dvector[]
+ a.reverse_each3_with_index(b,c){|x,y,z,i| new << x << y << z << i}
+ assert_equal Dvector[-1,5,2,2,0,4,9,1,1,3,6,0], new
+ end
+
def test_math
a = Dvector[11, 22, 33]
b = Dvector[6.3, -2.1, 3e-40]
diff --git a/tests/tc_FMkr.rb b/tests/tc_FMkr.rb
index 29d4d26..eef291b 100644
--- a/tests/tc_FMkr.rb
+++ b/tests/tc_FMkr.rb
@@ -140,6 +140,18 @@ class TestFMkr < Test::Unit::TestCase
assert_equal(b['biniou'], 0)
end
+ def test_hls_to_rgb
+ t = Tioga::FigureMaker.default
+ rgb_old = [0.1, 0.1, 1.0]
+ rgb_new = t.hls_to_rgb(t.rgb_to_hls(rgb_old))
+ 3.times do |i|
+ # Exact conversion is not expected, but that shouldn't be so
+ # bad.
+ assert((rgb_old[i] - rgb_new[i]).abs < 1e-5)
+ end
+ end
+
+
end
diff --git a/tioga.gemspec b/tioga.gemspec
index e7f716f..2953db4 100644
--- a/tioga.gemspec
+++ b/tioga.gemspec
@@ -6,10 +6,10 @@
spec = Gem::Specification.new do |s|
s.files += Dir["ext/**/*.[ch]"] +
Dir["lib/**/*.rb"] +
- Dir["split/*/include/*.h"] + Dir["split/**/*.rb"] +
- Dir["split/*.h"] + Dir["split/*.c"]
s.files += Dir["tests/*"]
s.files += %w(Tioga_README lgpl.txt)
+ # We explicitly add TexPreamble so that it doesn't get forgotten
+ s.files += ["lib/Tioga/TexPreamble.rb"]
s.test_files = Dir["tests/tsc_*.rb"]
s.extensions +=
%w{Flate Tioga/FigureMaker Dobjects/Dvector Dobjects/Dtable Dobjects/Function}.map do |d|
@@ -18,7 +18,7 @@ spec = Gem::Specification.new do |s|
s.bindir = 'bin'
s.executables << 'tioga'
s.name = 'tioga'
- s.version = '1.14'
+ s.version = '1.16'
s.summary = 'Tioga - a powerful scientific plotting library'
s.homepage = 'http://tioga.rubyforge.org'
s.authors = [
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-tioga.git
More information about the Pkg-ruby-extras-commits
mailing list