Can Greek Letters be Added to the Reply Menu in Online Forums?

  • Thread starter chemisttree
  • Start date
In summary: The only downside is that MathJax doesn't fully support TeX functions since it must translate in the end to an HTML environment. Still I'd say it supports the vast majority of what LaTeX does. MathJax supports most of LaTeX's functionality, but it does not support TeX functions.
  • #36
OMG... I must say that I'm really into MathJax now: neat, and beautiful... :x Hope that it'll soon be implemented on our server. :)

Oh, and btw, how can I enter a new line in MathJax?
 
Physics news on Phys.org
  • #37
The LaTeX code for new line is \\, but it doesn't seem to work in the default environment. It does however work in the align environment, so I would suggest that you use that. For example,

\begin{align} x &= 1\\
y &=2
\end{align}

Alternatively, I'm guessing that we're going to have to put some kind of tags around the math expressions, so you could just put separate tags around expressions that are to appear on different lines. This is of course how we do this now.

[tex]1[/tex]

[tex]2[/tex]
 
  • #38
Still not working.
 
  • #39
Kurdt said:
Still not working.
What happens when you try? (It's working fine for me).
 
  • #40
Fredrik said:
What happens when you try? (It's working fine for me).

Errors on page, then nothing.
 
  • #41
Did you try this page?

Greg Bernhardt said:
ok try now at https://www.physicsforums.com/mathjax/test/preview.html

Fredrik said:
The LaTeX code for new line is \\, but it doesn't seem to work in the default environment. It does however work in the align environment, so I would suggest that you use that. For example,

\begin{align} x &= 1\\
y &=2
\end{align}

Alternatively, I'm guessing that we're going to have to put some kind of tags around the math expressions, so you could just put separate tags around expressions that are to appear on different lines. This is of course how we do this now.

[tex]1[/tex]

[tex]2[/tex]

Yeah, I think there should be some kind of tags, or there may be some way to work around, like enabling \\ by putting \begin{align}, and \end{align} at 2 ends of every post.
 
Last edited by a moderator:
  • #42
VietDao29 said:
Did you try this page?

Yep.
 
  • #43
What does "press RETURN" means? Or more precisely - what it DOES? I know how to hit Enter, but unless I click outside of the edit field (as it was required previously) nothing happens.
 
  • #44
Borek said:
What does "press RETURN" means? Or more precisely - what it DOES? I know how to hit Enter, but unless I click outside of the edit field (as it was required previously) nothing happens.
It's the same for me. I just assumed that the app is working as it should, and that the text is wrong about what you should do.

Kurdt said:
Errors on page, then nothing.
Does it work when you try it in another browser?

VietDao29 said:
Yeah, I think there should be some kind of tags, or there may be some way to work around, like enabling \\ by putting \begin{align}, and \end{align} at 2 ends of every post.
You rarely need newlines in LaTeX expressions in a forum post, but a button or a key combination (like Ctrl+A) that inserts

\begin{align}

\end{align}

when you click/press it would be nice. I wouldn't want them inserted by default.
 
Last edited:
  • #45
The eqnarray environment works.
 
  • #46
I think eqnarray is considered more or less obsolete. align is easier to use and the output looks better. See e.g. this blog post.
 
  • #47
Thanks for that; played around a bit with both environments and I'm inclined to agree.
 
  • #48
I did a "view source" on one of their demo pages. It appears that the tags to begin and start a math expression are \( and \) respectively. Those are pretty annoying to type on a Swedish keyboard, where you have to hold down Alt Gr to type \ and Shift to type ( or ), so I hope there will be a button that we can click to insert the tags. It would be awesome if that feature is sophisticated enough to check if some text is currently selected, and in that case insert the tags before and after that text. (MediaWiki (e.g. Wikipedia) has this feature). This would enable us to type the math expression first, highlight it, and then click the button.

I'm probably just suggesting things that Greg and chroot have already thought of, but it's not like I have anything better to do right now. :smile:

Edit: Looks like \( \) is used where we would use itex tags, and \[ \] where we would use tex tags.
 
Last edited:
  • #49
Fredrik said:
I think eqnarray is considered more or less obsolete. align is easier to use and the output looks better. See e.g. this blog post.
Thanks for that Fredrik. I think I can even learn how to do this.

Hopefully Greg will provide a little tutorial but I'm bookmarking your link for now.
 
  • #50
Fredrik said:
I did a "view source" on one of their demo pages. It appears that the tags to begin and start a math expression are \( and \) respectively.

Could be wrong but I bet that is something we can easily change. In fact, thinking about it, we'll need to change it to our tex tags so past equations are preserved on once the old latex images are gone.
 
  • #51
Greg Bernhardt said:
Won't be necessary. We will look into switching to mathjax once 1.1 is out of beta.

That's now.

http://www.mathjax.org/news/
 
  • #54
Looking forward to it.
 
  • #55
Greg Bernhardt said:
Could be wrong but I bet that is something we can easily change. In fact, thinking about it, we'll need to change it to our tex tags so past equations are preserved on once the old latex images are gone.
The Stack Exchange network uses MathJaX with $ (inline) and $$ (block) as the delimiters, so it definitely should be possible to change that. At worst I'd imagine it's a matter of changing a couple of constants in the source code.
 
  • #56
It would be nice to have delimiters that are easier to type than [noparse][/itex][/noparse]. $ and $$ are easy enough, but \( and \[ are not. An Alt Gr shortcut would be an OK alternative. For example, if you type "Alt Gr+i" now, "[noparse][/noparse]" is typed, and the cursor is placed between the tags. If you select some text first, the tags are placed around that block of text. We could have e.g. Alt Gr+f and Alt Gr+d for the tags. Assuming of course that this can be configured in vBulletin. If function keys can be used this way, then I would suggest F8 and F9 (or F4 and F5).
 
  • #57
I suppose it shouldn't be too hard* to use '$', '$$', and tex tags to delimit TeX. That way, backwards compatibility is maintained and it's easier to type in LaTeX.*I haven't read the source.
 
  • #58
Fredrik said:
It would be nice to have delimiters that are easier to type than [noparse][/itex][/noparse]. $ and $$ are easy enough, but \( and \[ are not. An Alt Gr shortcut would be an OK alternative. For example, if you type "Alt Gr+i" now, "[noparse][/noparse]" is typed, and the cursor is placed between the tags. If you select some text first, the tags are placed around that block of text. We could have e.g. Alt Gr+f and Alt Gr+d for the tags. Assuming of course that this can be configured in vBulletin. If function keys can be used this way, then I would suggest F8 and F9 (or F4 and F5).
Whatever is done, it'll have to also work for people who don't have an AltGr key (i.e. most US keyboards).
 
  • #59
Fredrik said:
It would be nice to have delimiters that are easier to type than [noparse][/itex][/noparse].
If we have different delimiters, then Greg will have to ensure that the tex and itex tags used in all previous posts be automatically changed to the new ones, so we don't lose the ability to read old TeX. I don't know if that is trivial to do.
 
  • #60
diazona said:
Whatever is done, it'll have to also work for people who don't have an AltGr key (i.e. most US keyboards).
They don't have Alt Gr keys!? :eek: That country is just completely crazy. :wink:

Gokul43201 said:
If we have different delimiters, then Greg will have to ensure that the tex and itex tags used in all previous posts be automatically changed to the new ones, so we don't lose the ability to read old TeX. I don't know if that is trivial to do.
I expect that it will only be trivial if we can have several different delimiters mean the same thing.
 
  • #61
Fredrik said:
I expect that it will only be trivial if we can have several different delimiters mean the same thing.
Of course! That sounds simple enough to do.
 
  • #62
It shouldn't be too hard. I read over the source a bit, and multiple delimiters could probably be done just by changing the regexp.

(Is it just my editor, or did the MathJax developers throw all the code into one line?)
 
Last edited:
  • #63
jhae2.718 said:
(Is it just my editor, or did the MathJax developers throw all the code into one line?)

The code is minified.
 
  • #64
Okay, just found the unpacked and commented source.

Just found this:
http://www.mathjax.org/docs/1.1/upgrade.html#change-in-default-tex-delimiters
Code:
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    jax: ["input/TeX","output/HTML-CSS"],
    extensions: ["tex2jax.js"],
    tex2jax: {
      inlineMath: [ ['$','$'], ['\\(','\\)'] ],
      processEscapes: true
    }
  });
</script>
<script type="text/javascript" src="/MathJax/MathJax.js"></script>

Also, in tex2jax.js:
Code:
MathJax.Extension.tex2jax = {
  version: "1.1",
  config: {
    element: null,             // The ID of the element to be processed
                               //   (defaults to full document)

    inlineMath: [              // The start/stop pairs for in-line math
//    ['$','$'],               //  (comment out any you don't want, or add your own, but
      ['\\(','\\)']            //  be sure that you don't have an extra comma at the end)
    ],

    displayMath: [             // The start/stop pairs for display math
      ['$$','$$'],             //  (comment out any you don't want, or add your own, but
      ['\\[','\\]']            //  be sure that you don't have an extra comma at the end)
    ],

    skipTags: ["script","noscript","style","textarea","pre","code"],
                               // The names of the tags whose contents will not be
                               // scanned for math delimiters

    ignoreClass: "tex2jax_ignore",    // the class name of elements whose contents should
                                      // NOT be processed by tex2jax.  Note that this
                                      // is a regular expression, so be sure to quote any
                                      // regexp special characters

    processClass: "tex2jax_process",  // the class name of elements whose contents SHOULD
                                      // be processed when they appear inside ones that
                                      // are ignored.  Note that this is a regular expression,
                                      // so be sure to quote any regexp special characters

    processEscapes: false,     // set to true to allow \$ to produce a dollar without
                               //   starting in-line math mode

    processEnvironments: true, // set to true to process \begin{xxx}...\end{xxx} outside
                               //   of math mode, false to prevent that

    preview: "TeX"             // set to "none" to not insert MathJax_Preview spans
                               //   or set to an array specifying an HTML snippet
                               //   to use the same preview for every equation.

  },
 
Last edited by a moderator:
  • #65
Cool. I don't know javascript, but it looks like it's trivial to configure whatever we want as math delimiters, and like they have made it trivial to have several different ones that mean the same thing. I'm a bit confused by the fact that you seem to be able to configure it in two different places, but I'm guessing that the tex2jax: {blah-blah} command essentially says, "use these definitions instead of the ones you find in that stupid file".

So it probably won't be a problem at all to use all of these:
[noparse]
[itex] [/itex]
\( \)
$ $

[tex] [/tex]
\[ \]
$$ $$
[/noparse]
No wait...I do see a problem: Old posts that include $ signs. Not sure how to deal with those. Maybe someone can run a script to replace them all with \$. Or maybe we should just stick with the old delimiters. They would be less annoying if we can configure say F8 and F9 to type a pair of them.
 
  • #66
It does appear trivial to modify delimiters. The first block with the configuration options seems to override the settings found in the actual source. I posted both code blocks as I wasn't sure which would be best to modify in the case of PF.
 
Back
Top