Author |
Topic: Math Symbols Redux (Read 4128 times) |
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Math Symbols Redux
« on: Feb 7th, 2007, 12:50pm » |
Quote Modify
|
I'd like to put a question to the community: I'm working on bringing together the existing Firefox/Greasemonkey math symbol user scripts and adding a graphical entry interface to provide a single consistent math symbol entry and editing interface for those using Firefox with Greasemonkey; I'm wondering: what do you all feel would be the most convenient syntax for working with the symbols in the message edit box? The leading contenders are: 1) The old [symbol] and [smiley=symbol.gif] syntax William added to YaBB before the upgrade. Pros: simple, well understood, works similarly to existing posts and examples. Cons: people who aren't aware of the old functionality tend to enter all kinds of things in square brackets without intending them to be math symbols, so there's a large potential for misinterpretation. 2) The new $symbol$ syntax used by towr's symbol entry script. Pros: simple, relatively unambiguous. Cons: "ugly" (IMO) especially when strung together, departs from past usage. 3) A more LaTeX-like syntax, perhaps even making an attempt to interpret $\sum_{n=0}^\infty$ as [sum][sub]n=0[/sub][supinfty]. Pros: LaTeX syntax understood by most who would be using the text entry/editing functionality, compact, flexible. Cons: more complex, departs from past usage, substantially more time to program and debug. Once I have something put together and tested I'll post it to the math symbols FAQ where people might think to look for it. So what do you think? --SMQ
|
|
IP Logged |
--SMQ
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Math Symbols Redux
« Reply #1 on: Feb 7th, 2007, 1:06pm » |
Quote Modify
|
Well, of course for 2) it is meant to depart from past usage. That way you avoid misconceptions about on which side it is handled; tags like [blah] are handled by the server, and tags like $blah$ have to be processed userside (and should never been visible serverside). Of course option 3) would be preferable; but really, do you want to do that to yourself?
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Icarus
wu::riddles Moderator Uberpuzzler
Boldly going where even angels fear to tread.
Gender:
Posts: 4863
|
|
Re: Math Symbols Redux
« Reply #2 on: Feb 7th, 2007, 2:19pm » |
Quote Modify
|
Another problem with (3) is that you are not going to be able to implement a complete LaTeX syntax, or even close to it. This is going to cause LaTeX knowledgeable people consternation as they attempt things that won't work, resulting in an unfair dissatisfaction with what is already a fantastic application. It may be better just to implement (1) or (2) so as not to suggest more than you can deliver. (2) is ugly to look at, but is easier to read than the [smiley= ...] syntax, and I agree with towr that it is better to separate what the server does and what your tools do. on Feb 7th, 2007, 12:50pm, SMQ wrote:Once I have something put together and tested I'll post it to the math symbols FAQ where people might think to look for it. |
| I suggest starting a new FAQ thread. I've already been considering this, so you don't have 3 pages of no-longer-valid posts and schemes before coming to what works now. If you create a new thread, I'll make it sticky, and unstick the old one.
|
« Last Edit: Feb 7th, 2007, 2:22pm by Icarus » |
IP Logged |
"Pi goes on and on and on ... And e is just as cursed. I wonder: Which is larger When their digits are reversed? " - Anonymous
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Math Symbols Redux
« Reply #3 on: Feb 7th, 2007, 2:45pm » |
Quote Modify
|
on Feb 7th, 2007, 2:19pm, Icarus wrote:Another problem with (3) is that you are not going to be able to implement a complete LaTeX syntax, or even close to it. |
| If he spends enough time and effort on it, he could. And certainly some subset of it. It's not such a complicated markup language anyway (a lot of command words, but very few command structures)
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Icarus
wu::riddles Moderator Uberpuzzler
Boldly going where even angels fear to tread.
Gender:
Posts: 4863
|
|
Re: Math Symbols Redux
« Reply #4 on: Feb 7th, 2007, 6:10pm » |
Quote Modify
|
I was assuming that he is implementing this by means of the symbol gifs and the YaBB tags. That significantly limits what he can accomplish to something far less than a full LaTeX implementation.
|
|
IP Logged |
"Pi goes on and on and on ... And e is just as cursed. I wonder: Which is larger When their digits are reversed? " - Anonymous
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Math Symbols Redux
« Reply #5 on: Feb 8th, 2007, 5:41am » |
Quote Modify
|
I see where the problem could be in providing an (apparently) arbitrarily limited subset of LaTeX layout functionality. We do have available, however, a rich subset of LaTeX math symbols themselves, so what would you think of something like this: - symbols are denoted by a leading backslash, e.g. "\pi" becomes "[img].../pi.gif[/img]" when posted - non-alphanumeric LaTeX symbols are aliased so that they work, e.g. "\%" is equivalent to "\percent" (and, of course, "\sqrt" should be an alias for "\surd"). - for expository purposes, doubling the leading backslash denotes literal text rather than a symbol, e.g. "\\pi" becomes "\pi" when posted - to avoid confusion when symbols are run against literal text, a single, optional trailing space will be consumed in the translation if present (and the graphical entry will always insert a trailing space), e.g. "\sqrt\pi" and "\sqrt \pi" are both equivalent, whereas "\sqrt \pi" (two spaces) would place a space between the images, and "\frakca" is unambigously "[img].../frakca.gif[/img]" and not "[img].../frakc.gif[/img]a" --SMQ And incidentially, I've discovered another character sequence which generates the 500 error when attempting to post: ../ appearing anywhere in the posted text (!)
|
|
IP Logged |
--SMQ
|
|
|
Icarus
wu::riddles Moderator Uberpuzzler
Boldly going where even angels fear to tread.
Gender:
Posts: 4863
|
|
Re: Math Symbols Redux
« Reply #6 on: Feb 8th, 2007, 4:01pm » |
Quote Modify
|
That might work. I also suggest introducing some sort of tag and restricting the translation to only that part of a post inside. Say [ math ] [ /math ]. You might not want to put it in square brackets, though: {math} {/math}. This would mean that only those who are interested in posting mathematical symbols would. Someone who just wanted to put \a in their post for some reason wouldn't find it translated into .
|
|
IP Logged |
"Pi goes on and on and on ... And e is just as cursed. I wonder: Which is larger When their digits are reversed? " - Anonymous
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Math Symbols Redux
« Reply #7 on: Feb 8th, 2007, 5:02pm » |
Quote Modify
|
Well, that person might well not have the new greasemonkey script installed anyway, but yeah, some way to limit symbol expression by default sounds good. I'm just thinking though, that certainly in my case at least, I most often use the symbol features for an isolated pi or sqrt here or there, not a concentrated block of symbology; and open and close tags would make that sort of quick one-off usage a bit more cumbersome... What about a "include math symbols" checkbox underneath (like the "Notify of replies" and "Disable Smilies" checkboxes) which initially defaults off, but automatically becomes checked if any symbols are selected from the graphical interface (as opposed to just typed)? --SMQ
|
|
IP Logged |
--SMQ
|
|
|
Icarus
wu::riddles Moderator Uberpuzzler
Boldly going where even angels fear to tread.
Gender:
Posts: 4863
|
|
Re: Math Symbols Redux
« Reply #8 on: Feb 8th, 2007, 5:15pm » |
Quote Modify
|
That would work. Or you can just keep towr's Insert Symbols button. You only get math symbols if you press it. One other suggestion: how about moving the graphics to the side of the text box instead of on top? One problem I'm having with the proto version is that the selection tables keep popping up on top of my text entry box when I am only trying to move the mouse by. Everytime it does, I have to move my mouse out of the selection area to get the table to go away again, then move my mouse back in from another direction. It's a minor annoyance, but if symbols graphics were to the right of the text entry box, in particular, they would not be in a place where I move the mouse so often. [ARRGH! I keep running into that select ... from problem, except I don't see any "from"s. There must be other keywords that also set it off when used with "select".]
|
|
IP Logged |
"Pi goes on and on and on ... And e is just as cursed. I wonder: Which is larger When their digits are reversed? " - Anonymous
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Math Symbols Redux
« Reply #9 on: Feb 8th, 2007, 6:01pm » |
Quote Modify
|
on Feb 8th, 2007, 5:15pm, Icarus wrote:That would work. Or you can just keep towr's Insert Symbols button. You only get math symbols if you press it. |
| I thought about that, but I guess I'm trying to stick as close to the existing interface "paradigm" as I can, while keeping as much of the details behind the curtain as possible. At least in my head the checkbox solution "feels" more "right"; but once I have a new prototype together we'll see how it really works out... Quote:One other suggestion: how about moving the graphics to the side of the text box instead of on top? One problem I'm having with the proto version is that the selection tables keep popping up on top of my text entry box when I am only trying to move the mouse by. |
| Yeah, I'm experiencing that frustration myself. The problem is screen real estate; for someone running 800x600 there's no extra room to the right of the textarea... what about moving the symbol "panes" that pop up above rather than below the "section" symbols? I think there should consistently be room there no matter the screen layout, but they won't overlap the textarea on inadvertent cursor movement --SMQ Quote:I don't see any "from"s. There must be other keywords that also set it off when used with "select".] |
| Quote:then move my mouse back in from another direction. |
| [emphasis added]
|
|
IP Logged |
--SMQ
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Math Symbols Redux
« Reply #10 on: Feb 9th, 2007, 1:34am » |
Quote Modify
|
Perhaps if you needed to click to get the symbol list, rather than just move the mouse over; i.e. more like a menu. That would avoid it popping up when you don't want it.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Icarus
wu::riddles Moderator Uberpuzzler
Boldly going where even angels fear to tread.
Gender:
Posts: 4863
|
|
Re: Math Symbols Redux
« Reply #11 on: Feb 9th, 2007, 7:26pm » |
Quote Modify
|
Quote:then move my mouse back in from another direction. |
| Quote:[emphasis added] |
| I don't know how many times I read through that and failed to see that "from"!
|
|
IP Logged |
"Pi goes on and on and on ... And e is just as cursed. I wonder: Which is larger When their digits are reversed? " - Anonymous
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Math Symbols Redux
« Reply #12 on: Feb 14th, 2007, 2:17pm » |
Quote Modify
|
OK, here is the first release candidate of the new all-in-one math symbol user script for Firefow with Greasemonkey. Please uninstall any previous math symbol scripts (mine or towr's) before trying this one. Usage is hopefully self-explanatory, just remember to check the "Insert Math Symbols" checkbox if you're not using the graphical entry UI. Most of all, let me know what you think! If it's well-received, I'll start a new Math Symbols using Firefox and Greasemonkey FAQ as per Icarus' suggestion above. --SMQ
|
|
IP Logged |
--SMQ
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Math Symbols Redux
« Reply #14 on: Feb 14th, 2007, 5:33pm » |
Quote Modify
|
I've updated it with a minor bugfix for a problem where spacing between symbols wasn't preserved when previewing a post repeatedly. For some fun, go to the first post in the 0.999... thread and click quote. --SMQ
|
|
IP Logged |
--SMQ
|
|
|
Icarus
wu::riddles Moderator Uberpuzzler
Boldly going where even angels fear to tread.
Gender:
Posts: 4863
|
|
Re: Math Symbols Redux
« Reply #15 on: Feb 14th, 2007, 6:05pm » |
Quote Modify
|
Wow! That is cool. Makes me wish that post didn't suffer from the length restriction too, so I could redo it (of course, I've already wished that ) Maybe I ought to retire that 0.999... thread like I did the first and start over...
|
|
IP Logged |
"Pi goes on and on and on ... And e is just as cursed. I wonder: Which is larger When their digits are reversed? " - Anonymous
|
|
|
TenaliRaman
Uberpuzzler
I am no special. I am only passionately curious.
Gender:
Posts: 1001
|
|
Re: Math Symbols Redux
« Reply #16 on: Feb 14th, 2007, 8:34pm » |
Quote Modify
|
!! --
|
|
IP Logged |
Self discovery comes when a man measures himself against an obstacle - Antoine de Saint Exupery
|
|
|
ThudnBlunder
wu::riddles Moderator Uberpuzzler
The dewdrop slides into the shining Sea
Gender:
Posts: 4489
|
|
Re: Math Symbols Redux
« Reply #17 on: Feb 15th, 2007, 8:08am » |
Quote Modify
|
That's great, SMQ! Thanks for all your hard work!
|
|
IP Logged |
THE MEEK SHALL INHERIT THE EARTH.....................................................................er, if that's all right with the rest of you.
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Math Symbols Redux
« Reply #18 on: Feb 15th, 2007, 12:58pm » |
Quote Modify
|
Release Candidate 2 No functionality changes, but now tested and working under Internet Explorer 6 and above using Turnabout; and under Opera 8 and above using the build-in User Script functionality (and of course Firefox 1.5 and above using Greasemonkey). I think it should work under Safari using Creammonkey as well, but I don't have a Mac available to test it on... --SMQ
|
|
IP Logged |
--SMQ
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Math Symbols Redux
« Reply #19 on: Feb 15th, 2007, 2:56pm » |
Quote Modify
|
One small detail, which isn't relevant unless someone else runs script that may conflict with it; when you add/change eventlisteners, you might check if there already aren't ones, and if there are also run those (before or after the code of your own eventlistener). And also, after having finally looked at the code a bit, WOW!
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
SMQ
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 2084
|
|
Re: Math Symbols Redux
« Reply #20 on: Feb 15th, 2007, 4:06pm » |
Quote Modify
|
The addEventListener function already takes care of handling multiple listeners for you -- that's one of the reasons it was created (as opposed to the simpler object.onevent = function syntax). I believe IE's attachEvent works the same way. As for the rest of the code, the two data tables and the regular expressions do all the heavy lifting; the rest of it's pretty much simple string manipulations, fairly straightforward (and ugly) HTML generation, and a few fairly standard (as much as the term even applies to cross-browser web programming) mouse event handlers to drive the "menu". I even threw in some comments for good measure. Still, thanks. --SMQ
|
« Last Edit: Feb 15th, 2007, 4:08pm by SMQ » |
IP Logged |
--SMQ
|
|
|
|