[Tioga-users] font size change using tex_preview_fontsize results in incorrect label positioning

Bill Paxton paxton at kitp.ucsb.edu
Wed Sep 6 20:12:52 EDT 2006


Hi Ivars,

Thanks for the email.   I'm glad you're willing to help dig into this  
one to get a good solution.  Attached is a first rough effort to make  
a figure with a 3 inch square bbox and using 12pt Times.    Once we  
getting a scheme that works, we'll need to provide a nicer packaging  
to make things pretty.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixed_size.rb
Type: text/x-ruby-script
Size: 2230 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/tioga-users/attachments/20060906/78cb6a99/attachment.bin 
-------------- next part --------------

The figure is 'splines' taken from samples/plots -- with the addition  
of an initial call to setup the page.

     def page_setup
         t.tex_preview_tiogafigure_command = 'tiogafiguresized'
         t.tex_preview_fullpage = false
         set_size(3,3)
         set_bbox_to_fill_page
         t.tex_preview_preamble = t.tex_preview_preamble + "\n\t\ 
\usepackage{times}\n"
         t.set_default_font_size(12)
         t.title_scale = 1
         t.xlabel_scale = 1
         t.ylabel_scale = 1
         t.set_frame_sides(0.2,0.8,0.8,0.2) # left, right, top,  
bottom in page coords
     end


The set_size routine adjusts the device pagesize and the preview  
figure size.

     def set_size(width,height) # in inches
         units_per_inch = 720
         t.set_device_pagesize(width*units_per_inch,  
height*units_per_inch)
         t.tex_preview_figure_width = width.to_s + 'in'
         t.tex_preview_figure_height = height.to_s + 'in'
     end


The set_bbox_to_fill_page routine sets the frame to cover the entire  
page and then adds points at the four corners to set the bbox.

     def set_bbox_to_fill_page
         t.set_frame_sides(0,1,1,0) # left, right, top, bottom in  
page coords
         t.set_bounds(
             'left_boundary' => 0, 'right_boundary' => 1,
             'top_boundary' => 1, 'bottom_boundary' => 0)
         t.update_bbox(0,0)
         t.update_bbox(0,1)
         t.update_bbox(1,0)
         t.update_bbox(1,1)
     end


In page_setup, I've added a \usepackage{times} -- this might be  
better done by changing the tex_preview_fontfamily, but I haven't  
tried that.  The default font size is changed to 12 and the scales  
for title and labels are set to 1 so that they will be done in the  
default size (which is now 12 point).

The last thing that page_setup does is reduce the frame back to the  
usual fraction of the bbox to allow room for title and labels outside  
of the figure.   This means that the figure box is of course less  
than 3 by 3.

The preview default is to scale the figure to fill the page.  This is  
changed by setting tex_preview_fullpage to false, changing  
tex_preview_tiogafigure_command to tiogafiguresized, and setting  
tex_preview_figure_width and tex_preview_figure_height to 3 inches.


Perhaps we can debug this until it does what you want!

Please take a look a let me know how it goes.

Thanks,
Bill





More information about the Tioga-users mailing list