Added additional features/fixes noted in bug #3795 by Dmitry Pupinin.

This commit is contained in:
thepurpleblob 2005-07-22 09:01:34 +00:00
parent 3e20cb563c
commit 25d7779cf2
2 changed files with 9 additions and 3 deletions

View file

@ -88,7 +88,7 @@ function tex_filter ($courseid, $text) {
global $CFG;
/// Do a quick check using stripos to avoid unnecessary work
if (!preg_match('/<tex/i',$text) and !strstr($text,'$$')) {
if (!preg_match('/<tex/i',$text) and !strstr($text,'$$') and !strstr($text,'\\[')) { //added one more tag (dlnsk)
return $text;
}
@ -119,13 +119,15 @@ function tex_filter ($courseid, $text) {
// <tex> TeX expression </tex>
// or $$ TeX expression $$
preg_match_all('/<tex>(.+?)<\/tex>|\$\$(.+?)\$\$/is', $text, $matches);
// or \[ TeX expression \] // original tag of MathType and TeXaide (dlnsk)
preg_match_all('/<tex>(.+?)<\/tex>|\$\$(.+?)\$\$|\\\\\[(.+?)\\\\\]/is', $text, $matches);
for ($i=0; $i<count($matches[0]); $i++) {
$texexp = $matches[1][$i] . $matches[2][$i];
$texexp = $matches[1][$i] . $matches[2][$i] . $matches[3][$i];
$texexp = str_replace('<nolink>','',$texexp);
$texexp = str_replace('</nolink>','',$texexp);
$texexp = str_replace('<span class="nolink">','',$texexp);
$texexp = str_replace('</span>','',$texexp);
$texexp = eregi_replace("<br[[:space:]]*\/?>", '', $texexp); //dlnsk
$align = "middle";
if (preg_match('/^align=bottom /',$texexp)) {
$align = "text-bottom";

View file

@ -71,6 +71,10 @@
$cmd = "\"$CFG->dirroot/$CFG->texfilterdir/mimetex.darwin\" -e \"$pathname\" -- ". escapeshellarg($texexp);
break;
case "FreeBSD":
$cmd = "\"$CFG->dirroot/$CFG->texfilterdir/mimetex.freebsd\" -e \"$pathname\" ". escapeshellarg($texexp);
break;
default: /// Nothing was found, so tell them how to fix it.
if ($CFG->debug > 7) {
echo "Make sure you have an appropriate MimeTeX binary here:\n\n";