# Latex plug-in for tikzpicture

1. Mar 14, 2013

### I like Serena

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:

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:

• ###### earth_satelite.png
File size:
3.9 KB
Views:
556
2. Mar 14, 2013

### robphy

3. Mar 14, 2013

### Greg Bernhardt

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.

4. Mar 14, 2013

### AlephZero

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.

5. Mar 14, 2013

### I like Serena

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...

6. Mar 14, 2013

### Jameson

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.

7. Mar 14, 2013

### Greg Bernhardt

XyJax is what I am testing. It also has a very large overhead.

8. Mar 14, 2013

### FastWing

That code looks ridiculously complicated to produce such a simple image.

9. Mar 16, 2013

### Ben Niehoff

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?

10. Mar 16, 2013

### Staff: Mentor

Hosting several millions images was not what the server liked.

11. Mar 16, 2013

### I like Serena

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.

12. Mar 16, 2013

### Ben Niehoff

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.

13. Mar 16, 2013

### 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.

14. Mar 16, 2013

### Ben Niehoff

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.

15. Mar 16, 2013