A half-solution to the problem of equations

A failed experiment whereby board users were invited to advise the Senate, and instead attempted to replace the Senate.
Locked
erik_t
Jedi Master
Posts: 1108
Joined: 2008-10-21 08:35pm

A half-solution to the problem of equations

Post by erik_t »

It's come to my attention that LaTeX is (or at least can be) supported for phpBB, but phongn has pointed out to me that there's some concern about arbitrary code execution within phpBB.

I note the following. I can type an equation that is hard to read in plaintext, say:

Code: Select all

del(u)/del(t) + u * del(u)/del(x) = del^2(u)/del x^2
(the nonlinear scalar 1-D wave equation with viscosity) and expect many people to not know what the hell I'm doing. However, it's much easier to interpret nice happy LaTeX. They even have a helpful friendly image-embedding system, but it doesn't seem to work here. I think question marks in links break everything. Anyway, I have found a workaround.

If you select the "url" option from the dropdown box, and then embed it in a (code) box, then folks can copy and paste to see a nice friendly version of the equation.

Like so.

Code: Select all

http://latex.codecogs.com/gif.latex?\frac{\partial&space;u}{\partial&space;t}&space;+&space;u&space;\frac{\partial&space;u}{\partial&space;x}&space;=&space;\frac{\partial^2&space;u}{\partial&space;x^2}
This awesome latex magic can be generated by hitting up the Code Cogs LaTeX equation editor and selecting "url" from the dropdown menu, then embedding the link in a (code) box. Copy and paste. Simple as pie.

Only problem I currently see is this could break page-formatting, as the links can get terribly long and you can't use (size) commands within a (code) box. Can anyone think of a resolution to this?

Even as it is, it seems useful for SLAM and things. I bet most of the folks typing hairy-ass equations already know LaTeX anyway.
erik_t
Jedi Master
Posts: 1108
Joined: 2008-10-21 08:35pm

Re: A half-solution to the problem of equations

Post by erik_t »

Aha! Tinyurl!

Image

A shame about the crappy transparency. Hmmm. Making it a link is the best thing I can think of. It might be less critical for those using a forum view other than THE ONE TRUE MILLENNIUM FALCON.
Last edited by erik_t on 2009-03-04 03:28pm, edited 2 times in total.
User avatar
Bounty
Emperor's Hand
Posts: 10767
Joined: 2005-01-20 08:33am
Location: Belgium

Re: A half-solution to the problem of equations

Post by Bounty »

Can anyone think of a resolution to this?
Save the gif, host it on Photobucket, embed as image from there?
erik_t
Jedi Master
Posts: 1108
Joined: 2008-10-21 08:35pm

Re: A half-solution to the problem of equations

Post by erik_t »

I am sympathetic to fears of tinyurl, so perhaps a better solution would be to link to the preview page:

http://preview.tinyurl.com/cahgxb

and have it be understood that latex.codecogs.com is effectively a whitelist.


Just throwing these things out there.
erik_t
Jedi Master
Posts: 1108
Joined: 2008-10-21 08:35pm

Re: A half-solution to the problem of equations

Post by erik_t »

Well, we wouldn't be the first board to just mooch off of Code Cogs. I don't think that anything short of a full equation renderer is sufficient, honestly. I can't imagine unicode and html would grant anything more than special characters, which are nice but IMHO insufficient (although now that we have super/subscript maybe the problem is less severe anyway).

This is truly a zero-work solution, though, on the part of the board administration. I mean I'm going to be doing things with this method from now on. I just think we should consider making it an officially-encouraged method, so that people know about it if nothing else.
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: A half-solution to the problem of equations

Post by phongn »

Destructionator XIII wrote:
erik_t wrote:I don't think that anything short of a full equation renderer is sufficient, honestly.
Do you have an example in mind?
Matrices, summations, combinations and permutations?
erik_t
Jedi Master
Posts: 1108
Joined: 2008-10-21 08:35pm

Re: A half-solution to the problem of equations

Post by erik_t »

There's an option to have the background be white instead of transparent.

And inlining tinyurl images leaves no more potential for abuse than inlining ANY images.

Image

Image

While the HTML/CSS/etc magic is impressive, this seems like an easy and permanent resolution to the problem.
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: A half-solution to the problem of equations

Post by phongn »

Destructionator XIII wrote:edit: oh drat, those probably wouldn't look so good if the matrix was 3x3 rather than 2x2, for example, since I hardcoded 2x font size. Some CSS trickery might be able to fix this though; I'll have to play around with it when I have more time.
There's an ongoing project to use CSS2 to display MathML, which gives significantly more precise layout compared to HTML tables.
User avatar
Darth Wong
Sith Lord
Sith Lord
Posts: 70028
Joined: 2002-07-03 12:25am
Location: Toronto, Canada
Contact:

Re: A half-solution to the problem of equations

Post by Darth Wong »

Thanks for looking into this, erik. It's still inelegant in the sense that it's not self-contained or editable (and posts reliant upon hosted images would become meaningless if those hosted images are taken off-line), but it's certainly better than clumsily trying to kludge together something the way we've done it in the past.
Image
"It's not evil for God to do it. Or for someone to do it at God's command."- Jonathan Boyd on baby-killing

"you guys are fascinated with the use of those "rules of logic" to the extent that you don't really want to discussus anything."- GC

"I do not believe Russian Roulette is a stupid act" - Embracer of Darkness

"Viagra commercials appear to save lives" - tharkûn on US health care.

http://www.stardestroyer.net/Mike/RantMode/Blurbs.html
User avatar
Surlethe
HATES GRADING
Posts: 12267
Joined: 2004-12-29 03:41pm

Re: A half-solution to the problem of equations

Post by Surlethe »

Would it take too much server time and space to have a script on the server end that takes whatever's between [latex][/latex] tags, turns it into an image, and embeds it where the tags were?
A Government founded upon justice, and recognizing the equal rights of all men; claiming higher authority for existence, or sanction for its laws, that nature, reason, and the regularly ascertained will of the people; steadily refusing to put its sword and purse in the service of any religious creed or family is a standing offense to most of the Governments of the world, and to some narrow and bigoted people among ourselves.
F. Douglass
darkjedi521
Youngling
Posts: 108
Joined: 2006-10-13 03:14pm
Location: Troy, NY

Re: A half-solution to the problem of equations

Post by darkjedi521 »

I know I've come across some server side scripts that can be passed a string of latex code and generate an image on the fly. Down side is the latex gets compiled every page load though. If there's interest, I'll go see if I can find them again.
Ex ASVS lurker and sometimes poster
Locked