Sha256: 6cd8362be2c97d9870dcd7fb35e62bc27bbe1ee72d9a863ba2c17e6d69243181

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

= Rails-LaTeX

* Git: http://github.com/jacott/rails-latex
* Author: Geoff Jacobsen   
* Copyright: 2009-2010    
* License: MIT-LICENSE

== Description

rails-latex is a renderer for rails 3 which allows tex files with erb to be turned into an inline pdf.

== Synopsis

app/helpers/application_helper.rb:
   def lesc(text)
     LatexToPdf.escape_latex(text)
   end

app/views/stories/show.html.erb:
   ...
   <%= link_to "print", story_path(@story,:format => :pdf) %>


app/views/stories/show.pdf.erb:
   ...   
   <%= lesc @story.name % >

app/views/layouts/application.pdf.erbtex:
   \documentclass[12pt,a4paper,sloppy,< %= @landscape % >]{article}
   ...
   < %= yield % >
   \end{document}


config/initializers/mime_types.rb:
   ...     
   Mime::Type.register "application/pdf", :pdf, ['text/pdf'], ['pdf']


Only the file containing the \\documentclass should be of type: .pdf.erbtex . Partials and views (when there is a layout)
should be of type .pdf.erb .

If a LaTeX package requires two parses then add the following to the .pdf.erbtex file:

   <% @latex_parse_twice=true %>

See the rails application under examples/rails-latex-demo/ for a working example.

== Requirements

* ruby 1.8 or 1.9
* rails 3

== Install

* gem install rails-latex

== Development

Developing rails-latex requires jeweler

* rake test
* rake build

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-latex-1.0.1 README.rdoc