[LON-CAPA-cvs] cvs: loncom /homework randomlabel.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Mon, 23 May 2005 11:02:16 -0000
foxr Mon May 23 07:02:16 2005 EDT
Modified files:
/loncom/homework randomlabel.pm
Log:
Get gnuplot to print.. Looks ok, but I need to test label placement
more thoroughly.
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.73 loncom/homework/randomlabel.pm:1.74
--- loncom/homework/randomlabel.pm:1.73 Mon May 16 17:58:19 2005
+++ loncom/homework/randomlabel.pm Mon May 23 07:02:13 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.73 2005/05/16 21:58:19 foxr Exp $
+# $Id: randomlabel.pm,v 1.74 2005/05/23 11:02:13 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -174,16 +174,22 @@
if ($src =~ /^\\graphicspath/) {
- $height_param = $Apache::lonplot::plot{'height'}*0.3;
- $width_param = $Apache::lonplot::plot{'width'}*0.3;
+ $height_param = $Apache::lonplot::plot{'height'};
+ my $initial_width= $Apache::lonplot::plot{'width'};
+ $width_param = $Apache::lonplot::plot{'texwidth'};
+ $scale_factor = $width_param / $initial_width;
+ $height_param = $height_param*$scale_factor;
&Apache::lonxml::debug("height $height_param");
&Apache::lonxml::debug("Width $width_param");
- $scale_factor=1.0;
+
my $dirty_width = $width_param + 5;
$result .= '\parbox{'.$dirty_width.'mm}{';
- $result .= $src;
+ $result .= $src."\n";
+ $result .= '\setlength{\unitlength}{1mm}'."\n";
$result .= '\begin{picture}('."$height_param,$width_param)";
$result .= "(0,-$height_param)";
+ $result .= "\n";
+
} else {