## Miscellaneous

### Test jsMath

by Michael Gage -
Number of replies: 6
Typing math

$$\int_0^\pi \frac{1}{x^2+1} \, ds$$

You can use double dollar signs work for display math or use the
Latex command with backslash square brackets.

As of today you must use the LateX code: backslash left paren ..... backslash right paren in order to typeset inline math codes. The single dollar sign shortcut is not currently enabled.

### Re: Test jsMath

by Davide Cervone -
Thanks for getting the jsMath filter installed. We may want to think about changing the default configuration in two ways. First, we could turn off mimeTeX mode, since there are no back-compatibility issues with this site, and some mimeTeX changes are non-standard.

Second, we may want to consider changing the sequences used to delimit math modes. The $$...$$ and $...$ sequences are used in PG code, and so using them for jsMath will make it harder to post code snippets. We may need to decide which we think will be more frequently used. (I suspect it will be code snippets.)

You can use special HTML tags to turn off jsMath processing for part of a message (e.g. for a code block), and it is already turned off for <PRE>...</PRE> blocks automatically, so perhaps that is good enough, if people remember to use that. Otherwise, we will need to decide what should be used. Some sites have used $$...$$ and $$...$$$for in-line and display math. It is also possible to use something like <tex>...</tex>, but I'm not sure I like "fake" tags like that. What do you think? Davide In reply to Davide Cervone ### Re: Test jsMath by Sam Hathaway - Testing... $$...$$ $$\int_0^\pi \frac{1}{x^2+1} \, ds$$ $...$ $\int_0^\pi \frac{1}{x^2+1} \, ds$ $...$$ \int_0^\pi \frac{1}{x^2+1} \, ds $$$...$$ $$\int_0^\pi \frac{1}{x^2+1} \, ds$$ In reply to Davide Cervone ### Re: Test jsMath by Sam Hathaway - Regarding the delimiters: pretty much every non-alphanumeric character that is easily typed is used in Perl code. :( Using fake HTML tags wouldn't be very practical, since one has to switch out of WYSIWYG mode in order to type literal HTML. (I usually compose in raw mode, but I doubt others do.) Fortunately, the editor does allow you to enter "Preformatted" text, which gets wrapped in <pre> tags, but that's not really convenient for one-liners. What do you think of something like $...$ for inline and [dmath]...[/dmath] for display? It's easy to type in the WYSIWYG editor, and that pattern is be very unlikely to show up in Perl code. Could jsMath do that? Once I hear back from you, I'll ask Andrew Schretter to fix the config (as well as give us write access to the chameleon CSS files). -sam In reply to Sam Hathaway ### Re: Test jsMath by Davide Cervone - Sorry for taking so long to reply. The term is ending here, and I was a bit overwhelmed. pretty much every non-alphanumeric character that is easily typed is used in Perl code Yes, but not all pairs of characters. One could use something like $$...$$ for in-line math and $$...$$$ for display math, as these are unlikely to occur in PG files, and at least have a feel of familiarity to them. I'm satisfied with $...$ and [dmath]...[/dmath], however, if that's what you want to go with.

Could jsMath do that?

Sure. To make the change, someone needs to edit the moodle/filter/jsmath/javascript.php file and change the settings at the top of the file. I recommend changing the following from their defaults:

    processSlashParens: 0,      // process $$...$$ in text?
processSlashBrackets: 0,    // process $...$ in text?
processDoubleDollars: 0,    // process $$...$$ in text?
mimetexCompatible: 0,       // make jsMath handle mimetex better?

and then uncomment the custom delimiter settings below that and change them to
     jsMath.Moodle.customDelimiters = [
'$','$',        // to begin and end in-line math
'[dmath]','[/dmath]'       // to begin and end display math
];

Of course, that will make those tags in your message above be processed as math. :-) Note that you can prevent jsMath from processing a portion of a message by placing it within a tag that has CLASS="tex2math_ignore", usually a DIV tag.

Davide

### Re: Test jsMath

by Sam Hathaway -
Testing math:

$\int_0^\pi \frac{1}{x^2+1} \, ds$

[dmath]\int_0^\pi \frac{1}{x^2+1} \, ds[/dmath]

As of last week, the jsMath delimiters are $...$ for inline math, and [dmath]...[/dmath] for display math. For example:
 Consider the expression $\int_0^\pi \frac{1}{x^2+1} \, ds$. Consider the following expression: [dmath]\int_0^\pi \frac{1}{x^2+1} \, ds[/dmath] Consider the expression $\int_0^\pi \frac{1}{x^2+1} \, ds$. [dmath]\int_0^\pi \frac{1}{x^2+1} \, ds[/dmath]
To cause jsMath to ignore a $...$ or [dmath]...[/dmath] section, enclose the section in an HTML element with class tex2math_ignore. This can be a <div> or a <span> or whatever you like. jsMath always ignores delimiters that occur within <pre> tags.