--- loncom/xml/lonxml.pm	2006/04/20 02:58:14	1.411
+++ loncom/xml/lonxml.pm	2006/10/04 19:50:43	1.415.2.1
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.411 2006/04/20 02:58:14 albertel Exp $
+# $Id: lonxml.pm,v 1.415.2.1 2006/10/04 19:50:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -366,13 +366,14 @@ sub latex_special_symbols {
 	return $string;
     }
     if ($where eq 'header') {
-	$string =~ s/(\\|_|\^)/ /g;
+	$string =~ s/\\/\$\\backslash\$/g; # \  -> $\backslash$ per LaTex line by line pg  10.
 	$string =~ s/(\$|%|\{|\})/\\$1/g;
-	$string =~ s/_/ /g;
 	$string=&Apache::lonprintout::character_chart($string);
 	# any & or # leftover should be safe to just escape
         $string=~s/([^\\])\&/$1\\\&/g;
         $string=~s/([^\\])\#/$1\\\#/g;
+	$string =~ s/_/\\_/g;              # _ -> \_
+	$string =~ s/\^/\\\^{}/g;          # ^ -> \^{} 
     } else {
 	$string=~s/\\/\\ensuremath{\\backslash}/g;
 	$string=~s/\\\%|\%/\\\%/g;
@@ -1013,7 +1014,7 @@ sub store_counter {
     }
 
     sub remember_problem_counter {
-	&Apache::lonnet::transfer_profile_to_env();
+	&Apache::lonnet::transfer_profile_to_env(undef,undef,1);
 	$state = $env{'form.counter'};
     }
 
@@ -1024,7 +1025,7 @@ sub store_counter {
     }
     sub get_problem_counter {
 	if ($Apache::lonxml::counter_changed) { &store_counter() }
-	&Apache::lonnet::transfer_profile_to_env();
+	&Apache::lonnet::transfer_profile_to_env(undef,undef,1);
 	return $env{'form.counter'};
     }
 }
@@ -1328,7 +1329,6 @@ $cleanbut
 <input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" />
 BUTTONS
       $buttons.=&Apache::lonhtmlcommon::spelllink('xmledit','filecont');
-      $buttons.=&Apache::lonhtmlcommon::htmlareaselectactive('filecont');
       my $editfooter=(<<ENDFOOTER);
 $initialize
 <hr />
@@ -1419,7 +1419,7 @@ sub handler {
     my $filecontents=&Apache::lonnet::getfile($file);
     if ($filecontents eq -1) {
 	my $start_page=&Apache::loncommon::start_page('File Error');
-	my $end_page=&Apache::loncommon::end_page('File Error');
+	my $end_page=&Apache::loncommon::end_page();
 	my $fnf=&mt('File not found');
 	$result=(<<ENDNOTFOUND);
 $start_page
@@ -1539,7 +1539,8 @@ sub error {
 	    #public or browsers
 	    $errormsg=&mt("An error occured while processing this resource. The author has been notified.");
 	}
-	my $msg = join('<br />',@_);
+	my $host=$Apache::lonnet::perlvar{'lonHostID'};
+	my $msg = join('<br />',(@_,"The occured on host <tt>$host</tt>"));
 	#notify author
 	&Apache::lonmsg::author_res_msg($env{'request.filename'},$msg);
 	#notify course