Module Webby::Helpers::TexImgHelper
In: lib/webby/helpers/tex_img_helper.rb

Methods

tex2img  

Public Instance methods

The +tex2img+ method converts a a section of mathematical TeX script into an image and embeds the resulting image into the page. The TeX engine must be installed on your system along with the ImageMagick convert program.

Options can be passed to the TeX engine via attributes in the +tex2img+ method.

   <% tex2img( "wave_eq", :path => "images", :alt => "wave equation" ) do -%>
     $\psi_{tot}(x,-t_0,r) = \frac{1}{(2\pi)^2} \int\!\!\!\int
     \tilde\Psi_{tot}\left(k_x,\frac{c}{2}\sqrt{k_x^2 + k_r^2},r=0\right)$
   <% end -%>

The supported TeX options are the following:

   :path         : where generated images will be stored
                   [default is "/"]
   :type         : the type of image to generate (png, jpeg, gif)
                   [default is png]
   :bg           : the background color of the image (color name,
                   TeX color spec, or #aabbcc) [default is white]
   :fg           : the foreground color of the image (color name,
                   TeX color spec, or #aabbcc) [default is black]
   :resolution   : the desired resolution in dpi (HxV)
                   [default is 150x150]

   the following options are passed as-is to the generated <img /> tag
   :style    : CSS styles to apply to the <img />
   :class    : CSS class to apply to the <img />
   :id       : HTML identifier
   :alt      : alternate text for the <img />

[Validate]