Index: includes/DefaultSettings.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/DefaultSettings.php,v
retrieving revision 1.433
diff -u -r1.433 DefaultSettings.php
--- includes/DefaultSettings.php	10 Feb 2006 09:34:30 -0000	1.433
+++ includes/DefaultSettings.php	10 Feb 2006 18:09:17 -0000
@@ -1064,6 +1064,8 @@
  * Please see math/README for more information.
  */
 $wgUseTeX = false;
+/** Additional TeX preamble */
+$wgTeXPreambleAdditional = "";
 /** Location of the texvc binary */
 $wgTexvc = './math/texvc';
 
Index: includes/Math.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Math.php,v
retrieving revision 1.28
diff -u -r1.28 Math.php
--- includes/Math.php	3 Feb 2006 06:36:05 -0000	1.28
+++ includes/Math.php	10 Feb 2006 18:09:18 -0000
@@ -31,7 +31,7 @@
 	}
 
 	function render() {
-		global $wgTmpDirectory, $wgInputEncoding;
+		global $wgTmpDirectory, $wgInputEncoding, $wgTeXPreambleAdditional;
 		global $wgTexvc;
 		$fname = 'MathRenderer::render';
 
@@ -57,7 +57,8 @@
 					escapeshellarg( $wgTmpDirectory ).' '.
 					escapeshellarg( $wgTmpDirectory ).' '.
 					escapeshellarg( $this->tex ).' '.
-					escapeshellarg( $wgInputEncoding );
+					escapeshellarg( $wgInputEncoding ).' '.
+					escapeshellarg( $wgTeXPreambleAdditional);
 
 			if ( wfIsWindows() ) {
 				# Invoke it within cygwin sh, because texvc expects sh features in its default shell
Index: math/texutil.ml
===================================================================
RCS file: /cvsroot/wikipedia/phase3/math/texutil.ml,v
retrieving revision 1.15
diff -u -r1.15 texutil.ml
--- math/texutil.ml	31 Jan 2006 01:13:04 -0000	1.15
+++ math/texutil.ml	10 Feb 2006 18:09:30 -0000
@@ -37,6 +37,7 @@
 let modules_nonascii = ref false
 let modules_encoding = ref UTF8
 let modules_color = ref false
+let modules_additional_contents = ref "\n"
 
 let tex_use_ams ()     = modules_ams := true
 let tex_use_nonascii () = modules_nonascii := true
@@ -52,6 +53,7 @@
               (if !modules_nonascii then get_encoding !modules_encoding else "") ^
               (if !modules_ams then "\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\usepackage{amssymb}\n" else "") ^
               (if !modules_color then "\\usepackage[dvips,usenames]{color}\n" else "") ^
+	      !modules_additional_contents ^
               "\\pagestyle{empty}\n\\begin{document}\n$$\n"
 let get_footer  ()  = "\n$$\n\\end{document}\n"
 
@@ -61,6 +63,9 @@
   | "ISO-8859-2" -> modules_encoding := LATIN2
   | _ -> modules_encoding := UTF8
 
+let set_additional_preamble contents=
+  modules_additional_contents:=contents^"\n"
+
 (* Turn that into hash table lookup *)
 exception Illegal_tex_function of string
 
Index: math/texutil.mli
===================================================================
RCS file: /cvsroot/wikipedia/phase3/math/texutil.mli,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 texutil.mli
--- math/texutil.mli	14 Apr 2003 23:10:41 -0000	1.1.1.1
+++ math/texutil.mli	10 Feb 2006 18:09:30 -0000
@@ -1,6 +1,7 @@
 val render_tex : Tex.t -> string
 
 val set_encoding : string -> unit
+val set_additional_preamble : string -> unit
 val tex_use_nonascii: unit -> unit
 val tex_use_ams: unit -> unit
 
Index: math/texvc.ml
===================================================================
RCS file: /cvsroot/wikipedia/phase3/math/texvc.ml,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 texvc.ml
--- math/texvc.ml	14 Apr 2003 23:10:41 -0000	1.1.1.1
+++ math/texvc.ml	10 Feb 2006 18:09:30 -0000
@@ -23,6 +23,7 @@
     end
 let _ =
     Texutil.set_encoding (try Sys.argv.(4) with _ -> "UTF-8");
+    Texutil.set_additional_preamble (try Sys.argv.(5) with _ -> "\n");
     try render Sys.argv.(1) Sys.argv.(2) (Parser.tex_expr lexer_token_safe (Lexing.from_string Sys.argv.(3)))
     with Parsing.Parse_error -> print_string "S"
        | LexerException _ -> print_string "E"
