diff --git a/filter/algebra/algebradebug.php b/filter/algebra/algebradebug.php index 5e2ad3272f0..4883263e479 100644 --- a/filter/algebra/algebradebug.php +++ b/filter/algebra/algebradebug.php @@ -61,10 +61,14 @@ $output = algebra2tex($algebra); $output = refineTeX($output); } - if (strpos($query,'ShowImage')) { + if (strpos($query,'ShowImage')||strpos($query,'SlashArguments')) { $output = algebra2tex($algebra); $output = refineTeX($output); - tex2image($output, $md5); + if (strpos($query,'ShowImage')) { + tex2image($output, $md5); + } else { + slasharguments($output, $md5); + } } else { outputText($output); } @@ -193,7 +197,7 @@ function outputText($texexp) { echo "\n"; } -function tex2image($texexp, $md5) { +function tex2image($texexp, $md5, $return=false) { global $CFG; $error_message1 = "Your system is not configured to run mimeTeX. "; $error_message1 .= "You need to download the appropriate
executable "; @@ -250,6 +254,9 @@ function tex2image($texexp, $md5) { } system($cmd, $status); } + if ($return) { + return $image; + } if ($texexp && file_exists($pathname)) { $lastmodified = filemtime($pathname); header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT"); @@ -288,6 +295,24 @@ function tex2image($texexp, $md5) { echo "Image not found!"; } } + +function slasharguments($texexp, $md5) { + global $CFG; + $admin = $CFG->wwwroot . '/' . $CFG->admin . '/config.php'; + $image = tex2image($texexp,$md5,true); + echo "

If the following image displays correctly, set your "; + echo "Administration->Configuration->Variables "; + echo "setting for slasharguments to file.php/pic.jpg: "; + echo "

\n"; + echo "

Otherwise set it to file.php?file=pic.jpg "; + echo "It should display correctly as "; + echo "

\n"; + echo "

If neither equation image displays correctly, please seek "; + echo "further help at moodle.org at the "; + echo ""; + echo "Mathematics Tools Forum

"; +} + ?> @@ -310,8 +335,10 @@ function tex2image($texexp, $md5) { A preliminary translation into TeX will appear in the box below.
  • Next click on this button . A more refined translation into TeX will appear in the box below.
  • -
  • Finally click on this button +
  • Then click on this button to show a graphic image of the algebraic expression.
  • +
  • Finally check your slash arguments setting +