Can tikzpicture be Used as a Plug-in for vBulletin?

  • Context: LaTeX 
  • Thread starter Thread starter I like Serena
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary

Discussion Overview

The discussion revolves around the feasibility of integrating tikzpicture, a LaTeX extension for creating graphics, as a plug-in for vBulletin. Participants explore the potential for rendering tikz graphics within forum posts, comparing it to the current MathJax implementation and discussing the limitations and challenges associated with both systems.

Discussion Character

  • Debate/contested
  • Technical explanation
  • Exploratory

Main Points Raised

  • Some participants express interest in using tikz for quick drawings in posts, suggesting it could be installed as part of the LaTeX engine.
  • Others note that MathJax does not currently support complex graphics like those created with tikz, and mention that it primarily uses MathML.
  • A participant mentions testing an obscure MathJax extension that might allow basic diagram creation but acknowledges the limitations of MathML for complex drawings.
  • Concerns are raised about the differences between MathJax and TeX, highlighting that rendering graphics involves separate back-end programs that may not function uniformly across implementations.
  • Some participants recall that Physics Forums previously used a server-side LaTeX renderer, which was efficient and easy to extend, but switched to MathJax due to issues with hosting large numbers of images.
  • There are suggestions about possibly supporting both LaTeX and tikz, with conditional rendering based on the content type, though uncertainty remains about the feasibility of this approach.
  • Participants discuss the potential for caching strategies to manage image storage effectively, indicating a trade-off between storage space and computation time for regenerating images.
  • One participant shares their experience with writing a PHP script for caching and image generation, expressing uncertainty about integrating it with vBulletin due to lack of familiarity with its codebase.

Areas of Agreement / Disagreement

Participants generally agree that MathJax has limitations regarding complex graphics and that tikz could provide a solution, but there is no consensus on the feasibility of integrating tikz as a plug-in for vBulletin. Multiple competing views on the best approach to rendering graphics and managing image storage are present.

Contextual Notes

Participants note that the previous server-side LaTeX renderer was effective but faced challenges with image storage. The discussion includes various assumptions about the capabilities of MathJax and tikz, as well as the technical complexities involved in integrating them into vBulletin.

I like Serena
Science Advisor
Homework Helper
MHB
Messages
16,335
Reaction score
258
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:
\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}).
 

Attachments

  • earth_satelite.png
    earth_satelite.png
    2.9 KB · Views: 1,162
Physics news on Phys.org
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.
 
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.
 
Greg Bernhardt said:
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.

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...
 
Greg Bernhardt said:
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.

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.
 
Jameson said:
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.

XyJax is what I am testing. It also has a very large overhead.
 
That code looks ridiculously complicated to produce such a simple image.
 
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
Ben Niehoff said:
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?

Hosting several millions images was not what the server liked.
 
  • #11
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
Borek said:
Hosting several millions images was not what the server liked.

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
Ben Niehoff said:
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.

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
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
Ben Niehoff said:
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.

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.
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
6K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K