Talk:LaTeX with Google chart

Jump to navigation Jump to search

I think there is a maximum limit to the length of the mathematical expression, because the content is sent on the URL (HTTP GET). Maybe this should be mentioned, because I didn't realise about it and I got stuck for quite a while trying to understand what went wrong with my syntax. What do you think? --Gozzilli 16:01, 19 May 2010 (UTC)

Is there any possible way to extend the script for google api to automatically render plus signs into %2B? I simply added $code=str_replace("+","%2B",$code); but as i have no php experience it well may be it is very wrong.

That works, but I got weirdness if there were spaces around the plus sign. Another option, use the urlencode() function of php. So the code will be:
# Place this file in extension directory as Mtag.php
# Add the following line to LocalSettings.php:
# include './extensions/Mtag.php';
# Mediawiki will render as LaTeX the code within <m> </m> tags.

$wgExtensionFunctions[] = "wfMtag";

function wfMtag() {
        global $wgParser;
        $wgParser->setHook( "m", "returnMtagged" );

function returnMtagged( $code, $argv)
        $txt='<img src=",s,FFFFFFFF&chco=000000&chl='.urlencode($code).'">';
        return $txt;