LaTeX

edited February 2010 in Forum Game
For those of you who are not aware, Google Charts has been around for awhile. It basically lets you put a bunch of data in a URL, and Google automatically generates and serves out an image of a chart for you. It makes nice graphs and charts of various shapes and sizes.

Recently, Google Charts got a big upgrade. Most notably for us, it now supports formulas. I know people here want to do threads with equations and math. Well, you can start right now by using Google charts directly. For example, if you want to do the quadratic equation, you just take your URL-encoded LaTeX and stick it at the end of the chart URL like so.

http://chart.apis.google.com/chart?cht=tx&chl=x = \frac{-b \pm \sqrt {b^2-4ac}}{2a}

Put that URL as the src in an img tag and you get.

image

I know people have wanted this functionality in the forums, so I'm going to add it for you this weekend. I just need to know how you want it to work. Do you want it to work like this?

<math>mathgoeshere</math>
<latex>mathgoeshere</latex>

If so, which one?

If not that way, then how?

Comments

  • edited February 2010
    Either will do; go with the "math" tag because it's one character less. It's good to see this happen, though similar functionality was already available from other sites.
    Post edited by lackofcheese on
  • Either will do; go with the "math" tag because it's one character less. It's good to see this happen, though similar functionality was already available from other sites.
    All the other ones I found required that I run various servers/engines locally. The Google solution requires almost no code whatsoever on my side. It just goes in the same place as the <video> tag.
  • edited February 2010
    This site has been doing it for a while, e.g.:
    http://latex.codecogs.com/gif.latex?x = \frac{-b \pm \sqrt {b^2-4ac}}{2a}
    image
    I've posted equations from there on the forum before.
    Post edited by lackofcheese on
  • This sitehas been doing it for a while, e.g.:
    Ok, does that look like the kind of site you trust enough to build code on top of as opposed to Google? Also, I didn't know they existed, and Google's rendering is nicer.
  • This sitehas been doing it for a while, e.g.:
    Ok, does that look like the kind of site you trust enough to build code on top of as opposed to Google?
    They've been around for a long while, and are quite a prominent site in LaTeX-related searcehs, so I'd say they're reliable. In any case, I wasn't recommending them over Google, merely pointing out that kind of service is nothing new.
    Also, I didn't know they existed, and Google's rendering is nicer.
    Well, there's a few criteria on which to choose such a service. Google's is probably the best bet, though.
  • edited February 2010
    Direct comparison:
    image (CodeCogs gif)
    image (CodeCogs png)
    image (Google Charts)
    Personally, I'd say CodeCogs has the better rendering.
    Post edited by lackofcheese on
  • edited February 2010
    I vote for the tag since you can do more than just math.

    EDIT: Doh!
    Post edited by Dr. Timo on
  • I vote for the <latex></latex> tag since you can do more than just math.
  • ......
    edited February 2010
    I vote for <latex> since it's just that, LaTeX. Nice to see you doing this Scott.

    EDIT: Günter, BOOOO!
    Post edited by ... on
  • edited February 2010
    I vote for <latex> since it's just that, LaTeX. Nice to see you doing this Scott.

    EDIT: Günter, BOOOO!
    Fine, <latex> it is, but it's image, but that's only if you use CodeCogs. If you use Google Charts, it should be <tex>, because Google Chart's engine is image, not image
    Post edited by lackofcheese on
  • edited February 2010
    Challenge: Do this in Google Chart:
    image
    If it can't be done, then CodeCogs is clearly superior.
    Post edited by lackofcheese on
  • Challenge: Do this in Google Chart:
    Oooh. That's nifty.
  • edited February 2010
    The tag is <tex>.

    Testing

    x=3+4
    x = \frac{-b \pm \sqrt {b^2-4ac}}{2a}
    \Large\mathbb{Q}+\lim_{x\to3}\frac{1}{x}
    Post edited by Apreche on
  • edited February 2010
    Ok, so it works. However, there is one thing to be aware of. When you push the preview button in the forum, it will look wrong. However, when you save it will be correct. This is because of some extra escaping the preview does.

    Also, I'm not that good at TeX, so please try some really complicated formulas. If they don't work, send me the formula because I probably just need to fix the regular expression. If the formula shows up, but isn't what you wanted, then either your TeX is wrong, or Google has a bug that needs fixing.
    Post edited by Apreche on
  • edited February 2010
    ooh, new features...
    x=o+m+g
    Post edited by Victor Frost on
  • edited February 2010
    y^2=2\\ y=\pm \sqrt{2}
    The biggest problem with TeX rather than LaTeX is the lack of equation alignment, shown below with CodeCogs' engine:
    image
    Post edited by lackofcheese on
  • edited December 2010
    Lets give this a shot:

    {x^{x^{x^x_x}_{x^x_x}}_{x^{x^x_x}_{x^x_x}}}
    \sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+...}}}}}}}}}}}}}}}
    \frac{1}{1+\frac{1}{2+\frac{1}{3+\frac{1}{4+\frac{1}{5+\frac{1}{6+\frac{1}{7+\frac{1}{8+\frac{1}{9+...}}}}}}}}}

    Edit: looks good.
    Post edited by jmerm on
Sign In or Register to comment.