--- loncom/homework/structuretags.pm 2008/10/24 16:22:54 1.433 +++ loncom/homework/structuretags.pm 2008/11/10 11:44:54 1.434 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.433 2008/10/24 16:22:54 bisitz Exp $ +# $Id: structuretags.pm,v 1.434 2008/11/10 11:44:54 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use Apache::File(); use Apache::lonmenu; use Apache::lonlocal; use Apache::lonxml; +use Apache::londefdef; use Apache::lonenc(); use Time::HiRes qw( gettimeofday tv_interval ); use lib '/home/httpd/lib/perl/'; @@ -74,6 +75,13 @@ sub start_tex { if ($target ne 'edit' && $target ne 'modified') { my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser,$style); if ($target eq 'tex') { + + # If inside a table, occurrences of \\ must be removed; + # else the table blows up. + + if (&Apache::londefdef::is_inside_of($tagstack, "table")) { + $bodytext =~ s/\\\\//g; + } return $bodytext.'{}'; } } elsif ($target eq "edit" ) { @@ -148,8 +156,10 @@ sub page_start { $extra_head .= &homework_js(); - unless ($env{'environment.wysiwygeditor'} eq 'on') { - $extra_head .= &Apache::lonhtmlcommon::dragmath_js(); + if ($env{'environment.wysiwygeditor'} eq 'on') { + $extra_head .= &Apache::lonhtmlcommon::dragmath_js("FCKEditMathPopup"); + } else { + $extra_head .= &Apache::lonhtmlcommon::dragmath_js("EditMathPopup"); } my %body_args; @@ -1896,20 +1906,21 @@ sub end_startouttext { if ($target eq 'edit') { my $areaid = 'homework_edit_'.$Apache::lonxml::curdepth; $text=&Apache::lonxml::get_all_text("endouttext",$parser,$style); - $result.=&Apache::edit::start_table($token)."".&mt('Text Block')."" - .''.&mt('Delete?').' ' - .&Apache::edit::deletelist($target,$token) - .''; + + $result.=&Apache::edit::start_table($token)."".&mt('Text Block')." +".&mt('Delete:'). + &Apache::edit::deletelist($target,$token) + .""; unless ($env{'environment.wysiwygeditor'} eq 'on') { - $result.='' - .&Apache::lonhtmlcommon::dragmath_button($areaid,1) - .'' - .'' - .&Apache::edit::insertlist($target,$token) - .''; - } + $result .= '' + .&Apache::lonhtmlcommon::dragmath_button($areaid,1) + .'' + .'' + .&Apache::edit::insertlist($target,$token) + .''; + } $result.='' . - &Apache::loncommon::helpLatexCheatsheet(). + &Apache::loncommon::helpLatexCheatsheet(). &Apache::edit::end_row(). &Apache::edit::start_spanning_row()."\n". &Apache::edit::editfield($token->[1],$text,"",80,8,1);