public
Description: Ruby LaTeX to PDF preprocessor (and Rails plugin)
Homepage: http://rtex.rubyforge.org
Clone URL: git://github.com/bruce/rtex.git
Search Repo:
Click here to lend your support to: rtex and make a donation at www.pledgie.com !
bruce (author)
Mon Apr 21 16:32:19 -0700 2008
commit  6dd96a728c9af0a44fc9e7fbd136f27c52666faa
tree    a09bcbba26018f332f2be09c0ee64085b148a95f
parent  418116fa7bd14d96ff71ab1cbce1fe26fd54064f
rtex / README_RAILS.rdoc
100644 45 lines (30 sloc) 0.927 kb

RTeX Rails plugin

Installation

  sudo gem install rtex
  rtex --install /path/to/rails/app

Dependencies

  • Rails >= 2.0.1

Usage

Create files with rtex or +pdf.rtex+ extensions (eg, +index.rtex+, +index.pdf.rtex+) using standard LaTeX markup.

  • Layouts are supported, eg: +application.pdf.rtex+
  • Partials are supported, eg: +_item.pdf.rtex+

Example

With the following:

  # app/controllers/items_controller.rb
  def index
    @items = Item.find(:all)
  end

  # app/views/items/index.pdf.rtex
  \section*{Items}
  \begin{itemize}
  <%= render :partial => @items %>
  \end{itemize}

  # app/views/items/_item.pdf.rtex
  \item <%=l item.name %> \\

  # app/layouts/application.pdf.rtex
  \documentclass[12pt]{article}
  \begin{document}
  <%= yield %>
  \end{document}

If you hit +http://the.server.url/items.pdf+, you end up with a nice PDF listing of items.

Obviously a simplistic example.