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

Latex plug-in for tikzpicture

  1. Mar 14, 2013 #1

    I like Serena

    User Avatar
    Homework Helper

    Lately I've been interested in tikz, which is a latex extension.
    Since I would still like some way to quickly draw something in a post, I'd like to recommend tikz.
    It is a latex extension of which I hope it can be installed as part of the latex engine.
    I have no clue however if it can be installed as a plug-in in vBulletin.

    Let me give an example.
    The following latex code:
    Code (Text):
    \begin{tikzpicture}
    \draw (-4,0) -- (4,0);
    \draw (-4,0) circle (1.5);
    \draw (-4,-1.5) -- (4,-.2);
    \fill[draw=black!50,top color=blue!80,bottom color=black!40]
        (-4,0) circle (.5) node {Earth};
    \fill[draw=black!50,top color=orange!80,bottom color=black!40]
        (4,0) circle (1) node {Sun};
    \fill[draw=black!50,top color=gray,bottom color=black!20]
        (-4,-1.5) circle (.1) node[below = 1pt] {Satellite};
    \end{tikzpicture}
    yields this picture:
    attachment.php?attachmentid=56711&stc=1&d=1363272283.png

    To get this picture to work, it suffices to install MikTEX in Windows and simply try to render the latex code (in a document wrapper that includes \usepackage{tikz}).
     

    Attached Files:

  2. jcsd
  3. Mar 14, 2013 #2

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

  4. Mar 14, 2013 #3
    MathJax's underlying structure is MathML. I'm afraid "complex" drawing is outside the scope of MathML. However there is an obscure extension for MathJax that may allow the design of some basic diagrams which I am testing. I'll update when I have anything concrete.
     
  5. Mar 14, 2013 #4

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    The first problem is that MathJax ##\ne## TeX. It's a different system, where the input just happens to be very similar to a subset of TeX.

    The second problem is that the code that actually renders the OP's graphics isn't really part of TeX either. It's a separate back-end -program that converts the TeX output into a PDF, or PostScript, or other graphics formats. Different implementations of TeX, and different back-end programs, don't all work the same way.
     
  6. Mar 14, 2013 #5

    I like Serena

    User Avatar
    Homework Helper

    Sounds good!

    Btw, I remember a time when we didn't use MathJax yet.
    At that time latex was rendered server side in the form of pictures...
     
  7. Mar 14, 2013 #6
    We are looking into the same thing at our site too, Greg. The only program/extention I've found that is compatible with Mathjax is XyJax but the the feedback has been negative due to the strange syntax structure of it. I look forward to seeing what you come up with.
     
  8. Mar 14, 2013 #7
    XyJax is what I am testing. It also has a very large overhead.
     
  9. Mar 14, 2013 #8
    That code looks ridiculously complicated to produce such a simple image.
     
  10. Mar 16, 2013 #9

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    I remember before MathJax, Physics Forums used a standard LaTeX renderer to render images server-side. It was very snappy, and easy to extend by just installing LaTeX packages on the server. Whatever happened to that? What was wrong with it that made you decide to switch to MathJax?
     
  11. Mar 16, 2013 #10

    Borek

    User Avatar

    Staff: Mentor

    Hosting several millions images was not what the server liked.
     
  12. Mar 16, 2013 #11

    I like Serena

    User Avatar
    Homework Helper

    I'm wondering if it's possible to support both.

    Latex can default to MathJax, unless it contains a tikzpicture.
    Or perhaps with for instance [TIKZ] tags generating a tikz picture.

    It seems unlikely that the site will be flooded with tikz pictures any time soon.

    Of course this may be near impossible to do, but I do not know this.
     
  13. Mar 16, 2013 #12

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    You mean you never deleted the old ones? It's not hard to write a caching script that deletes, say, any LaTeX image that hasn't been viewed in the last 3 days. Then on the off-chance someone looks at an old thread in the future, it can be regenerated. You shouldn't have to store millions of images...I'd say more like thousands, or maybe tens of thousands. There's a tradeoff between storage space and computation time needed to regenerate deleted images...it would probably take some experimentation to find the sweet spot.
     
  14. Mar 16, 2013 #13

    Borek

    User Avatar

    Staff: Mentor

    You may need to wait for Greg to comment as I was not involved. My understanding is that old system was implemented many years ago by Chroot using tools available at the time (I believe LaTeX was converted to postscript and then to png) - and was not easy to modify, it was easier to implement it from scratch. Switching to MathJax was the simplest and the safest solution.
     
  15. Mar 16, 2013 #14

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    I've actually written a PHP script that handles the caching, and generates images using dvipng (i.e., no intermediate Postscript). This needs to be coupled with a cron job that removes old images. I wrote this up because a few years ago I was planning on starting a site with LaTeX enabled.

    I am only vaguely familiar with vBulletin code, though. They've gone through a lot of versions since the last time I looked at it. So I don't know exactly where such code should hook into the plugin system. I also don't know if I would have the time to figure it out; I'm trying to finish my PhD.
     
  16. Mar 16, 2013 #15
    Yes and I don't doubt it. Chroot wrote the old program, but wasn't interested in "maintaining" or "extending" it. I don't have the expertise or time to write something proper. MathJax is nice because it's good enough for 90% of our needs, is professionally developed and processing is nearly done all on the client side. No mess. I am looking forward to future versions of MathJax.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Latex plug-in for tikzpicture
  1. Problem with latex (Replies: 2)

  2. Latex test (Replies: 2)

  3. Facebook and Latex (Replies: 3)

  4. LaTeX incomplete (Replies: 2)

  5. Latex broken? (Replies: 2)

Loading...