weekly release 1.9.12+
[moodle.git] / filter / tex / filtersettings.php
blobbf73f7c04524135cf3e83bc38d98b5f6cdbaf145
1 <?php //$Id$
3 require_once($CFG->dirroot.'/filter/tex/lib.php');
5 $items = array();
6 $items[] = new admin_setting_heading('filter_tex_latexheading', get_string('latexsettings', 'admin'), '');
7 $items[] = new admin_setting_configtextarea('filter_tex_latexpreamble', get_string('latexpreamble','admin'),
8 '', "\\usepackage[latin1]{inputenc}\n\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\RequirePackage{amsmath,amssymb,latexsym}\n");
9 $items[] = new admin_setting_configtext('filter_tex_latexbackground', get_string('backgroundcolour', 'admin'), '', '#FFFFFF');
10 $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);
12 if (PHP_OS=='Linux') {
13 $default_filter_tex_pathlatex = "/usr/bin/latex";
14 $default_filter_tex_pathdvips = "/usr/bin/dvips";
15 $default_filter_tex_pathconvert = "/usr/bin/convert";
17 } else if (PHP_OS=='Darwin') {
18 // most likely needs a fink install (fink.sf.net)
19 $default_filter_tex_pathlatex = "/sw/bin/latex";
20 $default_filter_tex_pathdvips = "/sw/bin/dvips";
21 $default_filter_tex_pathconvert = "/sw/bin/convert";
23 } else if (PHP_OS=='WINNT' or PHP_OS=='WIN32' or PHP_OS=='Windows') {
24 // note: you need Ghostscript installed (standard), miktex (standard)
25 // and ImageMagick (install at c:\ImageMagick)
26 $default_filter_tex_pathlatex = "\"c:\\texmf\\miktex\\bin\\latex.exe\" ";
27 $default_filter_tex_pathdvips = "\"c:\\texmf\\miktex\\bin\\dvips.exe\" ";
28 $default_filter_tex_pathconvert = "\"c:\\imagemagick\\convert.exe\" ";
30 } else {
31 $default_filter_tex_pathlatex = '';
32 $default_filter_tex_pathdvips = '';
33 $default_filter_tex_pathconvert = '';
36 $items[] = new admin_setting_configexecutable('filter_tex_pathlatex', get_string('pathlatex', 'admin'), '', $default_filter_tex_pathlatex);
37 $items[] = new admin_setting_configexecutable('filter_tex_pathdvips', get_string('pathdvips', 'admin'), '', $default_filter_tex_pathdvips);
38 $items[] = new admin_setting_configexecutable('filter_tex_pathconvert', get_string('pathconvert', 'admin'), '', $default_filter_tex_pathconvert);
40 // Even if we offer GIF and PNG formats here, in the update callback we check whether
41 // all the paths actually point to executables. If they don't, we force the setting
42 // to GIF, as that's the only format mimeTeX can produce.
43 $formats = array('gif' => 'GIF', 'png' => 'PNG');
44 $items[] = new admin_setting_configselect('filter_tex_convertformat', get_string('convertformat', 'admin'), get_string('configconvertformat', 'admin'), 'gif', $formats);
46 foreach ($items as $item) {
47 $item->set_updatedcallback('filter_tex_updatedcallback');
48 $settings->add($item);