diff --git a/filter/tex/latex.php b/filter/tex/latex.php index cc957fc0eb4..74219a9bc16 100644 --- a/filter/tex/latex.php +++ b/filter/tex/latex.php @@ -5,11 +5,6 @@ // software installed. // Much of this inspired/copied from Benjamin Zeiss' work - //Preamble should be configurable from Filter Config - define('TEX_DOC_PREAMBLE', " \\usepackage[latin1]{inputenc}\n \\usepackage{amsmath}\n \\usepackage{amsfonts}\n"); - //Preamble for Russian - //define('TEX_DOC_PREAMBLE', " \\usepackage{mathtext}\n \\usepackage[T2A]{fontenc}\n \\usepackage[cp1251]{inputenc}\n \\usepackage[russian]{babel}\n"); - class latex { var $temp_dir; @@ -85,8 +80,10 @@ */ function construct_latex_document( $formula, $fontsize=12 ) { // $fontsize don't affects to formula's size. $density can change size + + global $CFG; $doc = "\\documentclass[{$fontsize}pt]{article}\n"; - $doc .= TEX_DOC_PREAMBLE; + $doc .= $CFG->filter_tex_latexpreamble; $doc .= "\\pagestyle{empty}\n"; $doc .= "\\begin{document}\n"; $doc .= "$ {$formula} $\n"; diff --git a/filter/tex/pix.php b/filter/tex/pix.php index f7e777213c2..0b79fba73f8 100644 --- a/filter/tex/pix.php +++ b/filter/tex/pix.php @@ -7,11 +7,14 @@ require_once('../../config.php'); require_once($CFG->libdir.'/filelib.php'); + require_once('defaultsettings.php' ); require_once('latex.php'); $CFG->texfilterdir = 'filter/tex'; $CFG->teximagedir = 'filter/tex'; + // check/initialise default configuration for filter (in defaultsettings.php) + tex_defaultsettings(); $cmd = ''; // Initialise these variables $status = ''; @@ -38,7 +41,9 @@ // try and render with latex first $latex = new latex(); - $latex_path = $latex->render( $texcache->rawtext, $md5, 12, 120, '#FFFFFF' ); + $density = $CFG->filter_tex_density; + $background = $CFG->filter_tex_latexbackground; + $latex_path = $latex->render( $texcache->rawtext, $md5, 12, $density, $background ); if ($latex_path) { copy( $latex_path, $pathname ); $latex->clean_up( $md5 );