# TeX in Ruby on Rails

**URL:** <https://www.ruby-forum.com/t/tex-in-ruby-on-rails/115673>\
**Category:** Rails\
**Created:** [September 27, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/tex-in-ruby-on-rails/115673 "2007-09-27T15:22:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [September 27, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/tex-in-ruby-on-rails/115673/1 "2007-09-27T15:22:49Z")

</div>

Hello,  
I’m new to ruby on rails, but I’m looking for a possibility to  
integrate TeX documents in my blog! I thought it might be possible to  
convert a TeX document to Xml and then sent the file to the webpage.  
On the server there should be a function that looks for new files and  
automatically integrate them on the webpage, by just adding them  
depending on the date and category (both mentioned in the file).  
Do you know such a solution ? or can you tell me how to do it more  
easy ?  
Hope you can help me!  
Snoop1990

---

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [September 27, 2007, 3:41pm UTC](https://www.ruby-forum.com/t/tex-in-ruby-on-rails/115673/2 "2007-09-27T15:41:00Z")

</div>

On Thu, Sep 27, 2007 at 06:21:20AM -0700, Snoop1990 wrote:

> Hello,  
> I’m new to ruby on rails, but I’m looking for a possibility to  
> integrate TeX documents in my blog! I thought it might be possible to  
> convert a TeX document to Xml and then sent the file to the webpage.  
> On the server there should be a function that looks for new files and  
> automatically integrate them on the webpage, by just adding them  
> depending on the date and category (both mentioned in the file).  
> Do you know such a solution ? or can you tell me how to do it more  
> easy ?

You have three independent problems here:

1. converting TeX documents to a web-friendly format (if you mean PDF,  
this  
is easy; if you mean HTML, it’s also reasonably easy but you may be  
unhappy with the results)

2. checking for new files periodically and invoking this conversion

3. integrating the resulting files into a Rails-based blog

Once it’s broken down like this, attacking each part the problem is much  
simpler than treating it as a single problem.

The first of these is unrelated to Ruby or Rails, and you should do a  
Google search to find the conversion software you need. Don’t expect it  
to  
be written in Ruby.

The second is a cron job, presumably running a Ruby script, maybe using  
the  
Rails script/runner. You’ll need to use the File API to check for new  
files  
and call Kernel#system to invoke the conversion.

The third part is really part of the script from the second part. You’ll  
need to do some text processing on the files themselves to determine  
date  
and category. You can then place the converted documents somewhere  
suitable  
for Rails to serve it, based on the date and category. This is likely to  
involve some modification of your Rails database to include the posts,  
and  
will require updating content indices if you are providing a full-text  
search on your site.

> Hope you can help me!  
> Snoop1990  
> –Greg

---

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [September 28, 2007, 3:40pm UTC](https://www.ruby-forum.com/t/tex-in-ruby-on-rails/115673/3 "2007-09-28T15:40:26Z")

</div>

Thank you for your support so far ! Depending the first part I found  
“rfil-0.3 (Library for TeX font installation)” on  
[http://www.gemjack.com/](http://www.gemjack.com/).  
Just to understand it write rfil is a TEX interpreter or ? (http://  
[rfil.rubyforge.org/rdoc/index.html](http://rfil.rubyforge.org/rdoc/index.html)) So this will view the TEX files on  
my ruby web blog ?  
Snoop 1990
