Use 'factored out' configuration settings.

This commit is contained in:
thepurpleblob 2005-07-22 13:59:19 +00:00
parent 1d88a9644e
commit 5b540fa98f
2 changed files with 9 additions and 7 deletions

View File

@ -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";

View File

@ -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 );