--- loncom/xml/londefdef.pm 2003/06/30 15:05:54 1.148 +++ loncom/xml/londefdef.pm 2003/07/14 14:29:26 1.153 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.148 2003/06/30 15:05:54 sakharuk Exp $ +# $Id: londefdef.pm,v 1.153 2003/07/14 14:29:26 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -157,10 +157,11 @@ sub start_html { &Apache::lonxml::fontsettings(); } elsif ($target eq 'tex') { @Apache::londefdef::table = (); - $currentstring .= '\documentclass[letterpaper]{article}'. - #'\batchmode'. - '\newcommand{\keephidden}[1]{} + $currentstring .= '\documentclass[letterpaper]{article}'; + if ($ENV{'form.latex_type'}=~'batchmode') {$currentstring .='\batchmode';} + $currentstring .= '\newcommand{\keephidden}[1]{} \renewcommand{\deg}{$^{\circ}$} + \usepackage{longtable} \usepackage{textcomp} \usepackage[dvips]{graphicx} \usepackage{epsfig}\usepackage{calc} @@ -370,7 +371,11 @@ sub start_meta { } } } elsif ($target eq 'tex') { - &Apache::lonxml::startredirection(); + my $content=&Apache::lonxml::get_param('content',$parstack,$safeeval); + my $name=&Apache::lonxml::get_param('name',$parstack,$safeeval); + if ((not defined $content) && (not defined $name)) { + &Apache::lonxml::startredirection(); + } } return $currentstring; } @@ -1292,7 +1297,7 @@ sub start_hr { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,0); + my $LaTeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); if (defined $LaTeXwidth) { if ($LaTeXwidth=~/^%/) { substr($LaTeXwidth,0,1)=''; @@ -1346,11 +1351,14 @@ sub end_div { #-- tag sub start_a { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { + my $a=&Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1); + $a=~s/([^\\])%/$1\\\%/g; + $currentstring .= '\ref{'.$a.'}'; } return $currentstring; } @@ -1360,9 +1368,6 @@ sub end_a { my $currentstring = ''; if ($target eq 'web') { $currentstring .= $token->[2]; - } elsif ($target eq 'tex') { - my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1); - $currentstring .= '\ref{'.$href.'}'; } return $currentstring; } @@ -1620,6 +1625,8 @@ sub start_dd { } elsif ($target eq 'tex') { if ($$tagstack[-2] eq 'dl') { $currentstring = ' \item [] '; + } elsif ($$tagstack[-2] eq 'dt') { + $currentstring = ']'; } } return $currentstring;