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

Ivars Finvers ifinvers at ucalgary.ca
Thu Sep 7 12:35:30 EDT 2006


Bill,

Thanks for the code examples. It basically does what I want once I  
change the set_size routine to:

     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'
         t.tex_preview_paper_width = width.to_s + 'in'
         t.tex_preview_paper_height = height.to_s + 'in'
         t.tex_preview_hoffset = "-1in"
         t.tex_preview_voffset = "-1in"
     end

where I have added the paper width/height and hoffset/voffset setting  
so that the final pdf page size is of the desired size (since this is  
what LaTeX will use when sizing and placing the figure).

Looking through the rest of the code, it contains most of the things  
that I had tried except for 3 bits:

	t.set_device_pagesize(width*units_per_inch, height*units_per_inch)

This had a huge impact. I'm still not clear how it interacts with the  
rest of the system, but if I leave it out, the font sizes are all  
wrong even if the rest of the commands remain the same.

	t.tex_preview_tiogafigure_command = 'tiogafiguresized'

This makes sense.

	set_bbox_to_fill_page

I'm still confused about how the bounds affects the bounding box (and  
the relationship and impact of the various coordinate systems,  
frames, bounds, etc.) and exactly what the update_bbox routine does.  
I'll have to dig into the code.

So in the end, the positioning instruction in the \makebox command of  
the .txt file don't need to be changed as I suggested previously. The  
difference between your approach and my original attempt was that I  
changed the font size using tex_preview_fontsize, whereas you used  
set_default_font_size. Being the author of the code obviously helps  
in knowing what commands exist! (Perhaps the \makebox positioning  
commands should be altered so that the tex_preview_fontsize command  
is more usable).

Thanks so much for the help.

Ivars



On 6-Sep-06, at 6:12 PM, Bill Paxton wrote:

> 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.
>
>
> <fixed_size.rb>
>
> 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