Dear All,
I installed the mimtex mod to my forum (with some manual editing to place everything correctly in the Subs-Editor). But mimetex only supports the math environment of latex, and this in a suboptimal fashion.
To make it prettier I use the link given above (which I'm not allowed to post...).
BUT: If it paste some latex code from some text editor, neither mimetex nor the codecogs works anymore. (I tried with various text editors...)
Both encounters unknown characters for different reasons (I believe).
If I delete all spaces that I copied from the editor and use the space bar in the SMF editor, it works.
Since I like the codecogs version better anyways I tried a little around with this first. If you copy the same latex code right after the question mark of the link (as it is done in the Subs.php via
http://latex.codecogs.com/gif.latex?$1) it works all right.
The problem is the character set of the URL space. So you have to replace e.g. a space with %20.
This can be actually done with the rawurlencode function of php.
What I tried is:
array(
'tag' => 'tex',
'type' => 'unparsed_content',
'content' => '<img src="../cgi-bin/mimetex.cgi?$1" alt="$1" border="0" align="absmiddle" /><br /><img src="http://latex.codecogs.com/gif.latex?', rawurlencode('$1'),'" alt="$1" border="0" align="absmiddle" />',
but it won't work.
I tried to break it down and tried a much simpler version of the code. What works is
array(
'tag' => 'tex',
'type' => 'unparsed_content',
'content' => (rawurlencode('bla blub %123 '),
),
As expected, whatever I write in my post, I get the URL version of the string 'bla blub %123 '.
What not works is:
array(
'tag' => 'tex',
'type' => 'unparsed_content',
'content' => (rawurlencode('$1'),
),
Does any of you have an idea how I can get this working? Do I need to make $1 a global variable first or something like that?
Thanks a lot
Jochen
PS: I have no idea on php, but I know some IDL/fortran/python...