--- loncom/xml/londefdef.pm 2003/06/30 14:09:03 1.147 +++ loncom/xml/londefdef.pm 2003/07/09 20:04:19 1.152 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.147 2003/06/30 14:09:03 sakharuk Exp $ +# $Id: londefdef.pm,v 1.152 2003/07/09 20:04:19 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -161,6 +161,7 @@ sub start_html { #'\batchmode'. '\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; } @@ -1064,7 +1069,7 @@ sub start_br { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { if ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') { - $currentstring .= '\vskip 0.2 mm'; + $currentstring .= '\vskip 0.2 mm '; } } return $currentstring; @@ -1292,14 +1297,14 @@ 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)=''; $LaTeXwidth=($LaTeXwidth/100).'\textwidth'; } } else { - $LaTeXwidth ='0.95\textwidth'; + $LaTeXwidth ='0.9\textwidth'; } my ($pre,$post); my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); @@ -1310,7 +1315,7 @@ sub start_hr { } elsif ($align eq 'right') { $pre=' \hfill \llap{'; $post='}'; } - $currentstring .= ' \vskip 0 mm \noindent\makebox[\textwidth]{'.$pre.'\makebox['. + $currentstring .= ' \vskip 0 mm \noindent\makebox['.$LaTeXwidth.']{'.$pre.'\makebox['. $LaTeXwidth.'][b]{\hrulefill}'.$post.'}\vskip 0 mm '; } return $currentstring; @@ -1321,8 +1326,7 @@ sub end_hr { my $currentstring = ''; if ($target eq 'web') { $currentstring .= $token->[2]; - } elsif ($target eq 'tex') { - } + } return $currentstring; } @@ -1347,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; } @@ -1361,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; } @@ -1621,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; @@ -1840,11 +1846,9 @@ sub end_td { $current_length=~/(\d+\.?\d*)/; $Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; $Apache::londefdef::table[-1]{'length'} .= '0,'; - } else { - $data=~/^\s*(\S.*)/; - $data=$1; - $data=~/(.*\S)\s*$/; - $data=$1; + } else { + $data=~s/^\s+(\S.*)/$1/; + $data=~s/(.*\S)\s+$/$1/; my $current_length=2*length($data); $Apache::londefdef::table[-1]{'length'} .= $current_length.','; $Apache::londefdef::table[-1]{'TeXlength'} .= '0,';