'measure' => 'name'
argument to show_text
, and you can get information about the text size using get_text_size('name')
. I used this new feature in figures.rb
for a small demonstration:
def text_size t.stroke_rect(0,0,1,1) t.rescale(0.5) equation = '\int_{-\infty}^{\infty} \! e^{-x^{2}}\, \! dx = \sqrt{\pi}' text = "\\fbox{$\\displaystyle #{equation}$}" nb = 5 nb.times do |i| scale = 0.5 + i * 0.2 angle = i * 37 x = (i+1)/(nb+1.0) y = x color = [1.0 - i * 0.2, i*0.2, 0] t.show_text('text' => text, 'color' => color, 'x' => x, 'y' => x, 'alignment' => ALIGNED_AT_MIDHEIGHT, 'scale' => scale , 'measure' => "box#{i}", 'angle' => angle ) size = t.get_text_size("box#{i}") w = size['width'] h = size['height'] t.stroke_color = color t.stroke_rect(x - w/2, x - h/2, w, h) end end
This works really simply: Tioga uses a wrapper TeX function that displays the size of the text on pdflatex
output. If Tioga detects that a size was requested, it fills in the information, gives it back to the program via get_text_size
and runs pdflatex
a second time use the information. For the first call, dummy values are given by get_text_size
. It seems that the last showstopper of Tioga has finally fallen today !
No comments:
Post a Comment