Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

My Latex Converter

  1. Jan 3, 2006 #1

    -Job-

    User Avatar
    Science Advisor

    I've playing around with Latex lately and put together a webbased converter that can convert Latex code into either an image (like in these forums) or HTML. I think there's some Latex tags that aren't supported very well, particularly in the hml conversion.
    For the Latex to .png i'm using a couple of executables that come with MikTex. As for the Latex to Html conversion i'm using Ian Hutchinson's TTH C source code which i altered so that it can be used efficiently from a web service.
    I planning on doing a full Latex editor on my independent study class this semester, so this is just a warm up. :smile: What i'd really like to do is port TTH from C to another language, like C++, VB.NET and even Javascript, but the code was generated with Flex, it's messy and it's 27000 lines long, so i'm a little reluctant. I think this Tex/Latex scene is a little disorganized. Anyway, here's a link:
    http://www.bloo.us/tex/services/
     
  2. jcsd
  3. Jan 4, 2006 #2
    Looks nice :smile:

    How long do the images stick around on the server? Could I link to them from another forum, for example?

    Integrals don't seem to work so well in HTML, by the way :wink:

    [​IMG]
     
  4. Jan 4, 2006 #3

    dduardo

    User Avatar
    Staff Emeritus

    Flex is pretty good. I'm actually working on a project that will use flex to generate code to parse a custom template system.

    Instead of trying to port the whole thing to javascript or whatever language, why don't you use xmlrpc to get real-time updating of the latex graphics. In order to save bandwidth slice the image into many little pieces so you only have to update what has changed.
     
  5. Jan 4, 2006 #4

    -Job-

    User Avatar
    Science Advisor

    Images stick around until i delete them manually. :)
    The HTML converter is not very good. Can you believe you have to pay $900 for that? I got for free because the author has it available as open source and free for non-comercial usage, but there are alot of issues with that tool. I'm considering making my own, but it's a moderately sized project.
    Is there a flex that generates non-c code? And is XMLRPC the equivalent to Ajax?
     
  6. Jan 4, 2006 #5

    dduardo

    User Avatar
    Staff Emeritus

    What you need to do is have html like this:

    Code (Text):

    <img alt="" src="latex_generator.py">
     
    And then have some code, perhaps mod_python, like this:

    Code (Text):

    req.content_type('image/jpeg')
    req.send_http_header()
    req.write(jpeg_binary_data)
     
    This way you're dealing with the image in memory, which is much faster than writing the image to disk and then having the program write the name of the file in the src field, which then gets fetched.

    You can make the program more robust by splitting the image into tiny pieces and caching them individually.

    -------------

    Why do you need an html converter? You get the formula from POST or GET, pass it through to a latex processor and then spit out to html.

    --------------

    There is a version that generates java.

    --------------

    AJAX is the marketing term
    XMLRPC is the technical term

    AJAX = XMLRPC
     
  7. Jan 4, 2006 #6

    -Job-

    User Avatar
    Science Advisor

    Let me tell you the full story. I want to do a full latex editor. One of the features i wanted to have is the ability to see what your Latex document will look like as you type it. Initially i had only the Latex to PNG ASP.NET script set up, so i considered doing what you've just suggested and split the image into pieces and only "redraw" whatever was needed. When i found out about the Latex-To-Html converter i thought that this would be alot better because with html it's much easier to only update the little portions of the Latex that have changed (not to mention it's faster and of smaller size). Of course the Latex-To-Html thing is not the best and that's why i thought about writing my own. Of course then what would be really good would be to write this tool in Javascript because this way it would run entirely on the client without a roundtrip to the server for each update.
    Last semester me and another guy in my group used Ajax to build a web application and that's what i was considering using for this Latex editor anyway. If it wasn't for the preview thing, which some might argue isn't really necessary, i wouldn't even care about the latex-to-html thing, but since none of the other Latex editors have it i thought it was worth considering.
    In any cas eit seems i can't avoid having to build a Lexical Analyzer for Latex because i want the editor to be smart and detect syntax errors. I was thinking since Latex is not a programming language it wouldn't be so hard, especially using Flex. I already had to write a compiler for a programming lanuguage so this seems alot easier.
     
  8. Jan 4, 2006 #7

    dduardo

    User Avatar
    Staff Emeritus

  9. Jan 4, 2006 #8

    -Job-

    User Avatar
    Science Advisor

    I actually have a Latex to MathML converter and i was going to add it to the Latex converter that i have. I believe you can only display MML with a plugin though right? What can i do with the MML that is generated?
     
  10. Jan 5, 2006 #9

    dduardo

    User Avatar
    Staff Emeritus

    Mathml is integrated in Firefox 1.5. IE does need a plugin.

    Mathml is xml. You can do XSL transformations on it to convert it to another format. For example you can convert it to SVG.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: My Latex Converter
  1. LaTeX Parser/Converter (Replies: 1)

Loading...