--- loncom/xml/londefdef.pm 2002/07/23 19:15:08 1.75 +++ loncom/xml/londefdef.pm 2002/07/25 15:28:26 1.78 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.75 2002/07/23 19:15:08 sakharuk Exp $ +# $Id: londefdef.pm,v 1.78 2002/07/25 15:28:26 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -91,6 +91,7 @@ sub start_m { #&Apache::lonxml::debug("M is ends with:$currentstring:"); } elsif ($target eq 'tex') { $currentstring = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); + if ($currentstring=~/\s*\\\\\s*/) {$currentstring = ' \vskip 0 mm ';} } else { my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); } @@ -122,7 +123,8 @@ sub end_m { } elsif ($target eq 'tex') { @Apache::londefdef::table = (); $currentstring .= '\documentclass[letterpaper]{article} - \newcommand{\keephidden}[1]{} + \newcommand{\keephidden}[1]{} + \renewcommand{\deg}{$^{\circ}$} \usepackage[dvips]{graphicx} \usepackage{epsfig}\usepackage{calc}'; } @@ -842,8 +844,7 @@ EDITBUTTON if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - my @temp = @$tagstack; - if ($temp[-2] ne 'sub' && $temp[-2] ne 'sup') { + if ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') { $currentstring .= '\vskip 0 mm'; } } elsif ($target eq 'latexsource') { @@ -954,7 +955,7 @@ EDITBUTTON if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{\\underline "; + $currentstring .= '\underline{'; } return $currentstring; } @@ -964,7 +965,7 @@ EDITBUTTON if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= " }"; + $currentstring .= '}'; } return $currentstring; } @@ -975,7 +976,7 @@ EDITBUTTON if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{\\underline "; + $currentstring .= '\underline{'; } return $currentstring; } @@ -985,7 +986,7 @@ EDITBUTTON if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= " }"; + $currentstring .= '}'; } return $currentstring; } @@ -1115,7 +1116,7 @@ EDITBUTTON if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{\\underline "; + $currentstring .= '\underline{'; } return $currentstring; } @@ -1125,7 +1126,7 @@ EDITBUTTON if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= " }"; + $currentstring .= '}'; } return $currentstring; } @@ -1317,7 +1318,7 @@ EDITBUTTON $output .= ' \\\\ '; } my @length = split(/,/,$Apache::londefdef::table[-1]{'length'}); - my $how_many_columns = $#length+1; + my $how_many_columns = $#length; my $parboxlength = '(\textwidth'; for (my $io=0; $io<=$#length;$io++) { if ($length[$io] ne '') { @@ -1355,7 +1356,7 @@ EDITBUTTON } push ( @{ $Apache::londefdef::table[-1]{'rowdata'} }, $Apache::londefdef::table[-1]{'hinc'}); $Apache::londefdef::table[-1]{'counter_columns'} = -1; - $Apache::londefdef::table[-1]{'length'} = ''; #just added + $Apache::londefdef::table[-1]{'length'} = ''; } return $currentstring; @@ -1396,9 +1397,11 @@ EDITBUTTON } elsif ($target eq 'tex') { my $current_row = $Apache::londefdef::table[-1]{'row_number'}; my $data=&Apache::lonxml::endredirection(); - if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) { #just added - $Apache::londefdef::table[-1]{'length'} .= $1.','; #just added - } #just added + if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) { + $Apache::londefdef::table[-1]{'length'} .= $1.','; + } else { + $Apache::londefdef::table[-1]{'length'} .= '0 mm,'; + } @{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$1.'}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'}; } return $currentstring; @@ -1429,9 +1432,11 @@ EDITBUTTON } elsif ($target eq 'tex') { my $current_row = $Apache::londefdef::table[-1]{'row_number'}; my $data=&Apache::lonxml::endredirection(); - if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) { #just added - $Apache::londefdef::table[-1]{'length'} .= $1.','; #just added - } #just added + if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) { + $Apache::londefdef::table[-1]{'length'} .= $1.','; + } else { + $Apache::londefdef::table[-1]{'length'} .= '0 mm,'; + } @{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$1.'}{\textbf{'.$data.'}} '.$Apache::londefdef::table[-1]{'vinc'}; } return $currentstring;