diff --git a/filter/algebra/filter.php b/filter/algebra/filter.php
index f8dbe85d1fa67..c38cda28a08df 100644
--- a/filter/algebra/filter.php
+++ b/filter/algebra/filter.php
@@ -41,7 +41,7 @@
/// Edit these lines to correspond to your installation
// File path to the directory where mathml_filter.php resides
$CFG->algebrafilterdir = "filter/algebra";
-
+ $CFG->texfilterdir = "filter/tex";
/// These lines are important - the variable must match the name
/// of the actual function below
@@ -76,8 +76,11 @@ function string_file_picture_algebra($imagefile, $tex= "", $height="", $width=""
if (!file_exists("$CFG->dataroot/$CFG->algebrafilterdir/$imagefile") && isadmin()) {
$output .= "wwwroot/$CFG->algebrafilterdir/algebradebug.php\">";
} else {
- $output .= "";
+ $output .= "wwwroot/$CFG->texfilterdir/displaytex.php?";
+ $output .= urlencode($tex) . "\" onClick=\"return openpopup('/$CFG->texfilterdir/displaytex.php?";
+ $output .= urlencode($tex) . "', 'popup', 'menubar=0,location=0,scrollbars,";
+ $output .= "resizable,width=300,height=240', 0);\">";
}
$output .= "slasharguments) { // Use this method if possible for better caching
diff --git a/filter/tex/displaytex.php b/filter/tex/displaytex.php
new file mode 100644
index 0000000000000..1a13d1c632e92
--- /dev/null
+++ b/filter/tex/displaytex.php
@@ -0,0 +1,9 @@
+
+TeX Source
+
+
+
+
diff --git a/filter/tex/filter.php b/filter/tex/filter.php
index 906e1068e500b..67c67e7ba705f 100644
--- a/filter/tex/filter.php
+++ b/filter/tex/filter.php
@@ -71,8 +71,11 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="") {
if (!file_exists("$CFG->dataroot/$CFG->texfilterdir/$imagefile") && isadmin()) {
$output .= "wwwroot/$CFG->texfilterdir/texdebug.php\">";
} else {
- $output .= "";
+ $output .= "wwwroot/$CFG->texfilterdir/displaytex.php?";
+ $output .= urlencode($tex) . "\" onClick=\"return openpopup('/$CFG->texfilterdir/displaytex.php?";
+ $output .= urlencode($tex) . "', 'popup', 'menubar=0,location=0,scrollbars,";
+ $output .= "resizable,width=300,height=240', 0);\">";
}
$output .= "slasharguments) { // Use this method if possible for better caching
@@ -125,7 +128,6 @@ function tex_filter ($courseid, $text) {
// TeX expression
// or $$ TeX expression $$
-
preg_match_all('/(.+?)<\/tex>|\$\$(.+?)\$\$/is', $text, $matches);
for ($i=0; $i