Math type

Math type

by deepak ratra -
Number of replies: 9
hi everyone,

when we add any math type in the editor, it display math type as image with a link having alttext.


I want to remove that link and alttext .
how will i do that ??

regards deepak
Average of ratings: -
In reply to deepak ratra

Re: Math type

by Mauno Korpelainen -

It would be easier to answer if you could first explain what you mean by

"when we add any math type in the editor..." - read

http://moodle.org/mod/forum/discuss.php?d=127295

I suppose you mean TeX and if you want to remove links from TeX images that tex filter produces you should edit file filter/tex/filter.php and function string_file_picture_tex - different versions of moodle have a little different code but I guess you want to do the same as Maher in http://moodle.org/mod/forum/discuss.php?d=101134#p485237

If you want to remove links from all users you should also delete that row

          $output .= "<a href=\"$CFG->wwwroot/filter/tex/texdebug.php\">";

(otherwise         $output .= "</a>";   later leaves link tags open for administrators... )

Average of ratings: Useful (1)
In reply to Mauno Korpelainen

Re: Math type

by Mauno Korpelainen -

So the current 1.9 version of that function could look like this if you want to delete also those alt tags and titles and show only img tags

function string_file_picture_tex($imagefile, $tex= "", $height="", $width="", $align="middle", $alt='') {
    global $CFG;

    // Work out any necessary inline style.
    $rules = array();
    if ($align !== 'middle') {
        $rules[] = 'vertical-align:' . $align . ';';
    }
    if ($height) {
        $rules[] = 'height:' . $height . 'px;';
    }
    if ($width) {
        $rules[] = 'width:' . $width . 'px;';
    }
    if (!empty($rules)) {
        $style = ' style="' . implode('', $rules) . '" ';
    } else {
        $style = '';
    }

    // Prepare the title attribute.
    if ($tex) {
        $tex = str_replace('&','&amp;',$tex);
        $tex = str_replace('<','&lt;',$tex);
        $tex = str_replace('>','&gt;',$tex);
        $tex = str_replace('"','&quot;',$tex);
        $tex = str_replace("\'",'&#39;',$tex);
    }

    // Build the output.
    $output = "";
    if ($imagefile) {

        $output .= "<img class=\"texrender\" src=\"";
        if ($CFG->slasharguments) {        // Use this method if possible for better caching
            $output .= "$CFG->wwwroot/filter/tex/pix.php/$imagefile";
        } else {
            $output .= "$CFG->wwwroot/filter/tex/pix.php?file=$imagefile";
        }
        $output .= "\" $style/>";
    } else {
        $output .= "Error: must pass URL or course";
    }
    return $output;
}

Average of ratings: Useful (1)
In reply to Mauno Korpelainen

Re: Math type

by deepak ratra -
hi Mauno Korpelainen,

Thank You ,Thank You ,Thank You ,Thank You ,Thank You ,Thank You ,Thank You .
You hav solved my problem .
I got stuck in this problem form last 4 days.

Thank u very much , u are a great man.

regards
deepak

In reply to deepak ratra

Re: Math type

by Bob Mathews -
I'm just wondering why you'd want to remove the alt text. It is very useful for blind students, and it is useful for anyone who wants to use the equations in MathType.

As you can see, it is optional, so it would be very worthwhile to leave in the alt text unless in your specific course you have a special need to remove it.

Cheers,
Bob
In reply to Bob Mathews

Re: Math type

by deepak ratra -
hi Dude,

As Our Site is www.talentbarometer.com ,this site is for School going students , we are providing then test papers.
I thing there is no need for the Math type image alttext . coz it shows math type code.

regards
dEePaKsmile
In reply to deepak ratra

Re: Math type

by Bob Mathews -
Deepak, it's a very attractive site. You've done a great job with it. Even if you don't think anyone will use the equations in MathType software, I don't see how it is to your disadvantage to leave the alt text. If a blind student wanted to buy some of your tests to help him in a math course, he wouldn't be able to use it because the software that reads the web page to him would skip over the equations and formulas. With the alt text in place, the screen reading software would read the alt text, allowing the student to understand the math. So you are excluding part of the population from being able to use your site. A very small part of the population, sure. But if I'm the one who's blind, it doesn't matter how many other people are affected; it just means the site isn't useful for me.
In reply to Bob Mathews

Re: Math type

by Mauno Korpelainen -

The alt tags that TeX filter gives are pure LaTeX - I don't personally know any blind people who have used screen readers etc to test usability of latex tags but here's one discussion about subject from other forums:

http://accessgarage.wordpress.com/2009/01/09/tools-for-accessible-math-conversion/

MathML or ASCIIMathML rendering MathML in Firefox might be more accessible math for blind student - or some other tools than TeX in the future...

http://www.dessci.com/en/solutions/access/default.htm has a really intersting list of some math accessibility tools.

In reply to Bob Mathews

Re: Math type

by Mauno Korpelainen -

Most people feel alt tags useful for another important reason - it is possible to learn syntax of LaTeX or other maths if you see the code with alt tag (on hover) - like this expression

$$\displaystyle\phi_n(\kappa) = \frac{1}{4\pi^2\kappa^2} \int_0^\infty \frac{\sin(\kappa R)}{\kappa R} \frac{\partial}{\partial R} \left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR$$

to be able to write something similar even without TeX guides or TeX editors.

Maths is sometimes complex to read and write online even if you can see and write. Maybe the original reason why Deepak wanted to cut alt tags was the heavy content (many images causing a lot of HTTP requests and slow rendering of code...)

In reply to Bob Mathews

Re: Math type

by deepak ratra -
Whatever Mr. Bob , It was my bosss' requirement .It is now solved , so it is very big thing for me to make my boss happywink.

I am still thankfull to Mauno.

best regards
deepak