--- loncom/xml/londefdef.pm 2003/06/19 20:14:13 1.143 +++ loncom/xml/londefdef.pm 2003/06/27 16:12:39 1.146 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.143 2003/06/19 20:14:13 sakharuk Exp $ +# $Id: londefdef.pm,v 1.146 2003/06/27 16:12:39 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -157,9 +157,9 @@ 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}'. + #'\batchmode'. + '\newcommand{\keephidden}[1]{} \renewcommand{\deg}{$^{\circ}$} \usepackage{textcomp} \usepackage[dvips]{graphicx} @@ -502,9 +502,7 @@ sub start_center { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring = '\begin{center}'; - } elsif ($target eq 'latexsource') { - $currentstring = '\begin{center}'; - } + } return $currentstring; } @@ -515,9 +513,7 @@ sub end_center { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = '\end{center}'; - } elsif ($target eq 'latexsource') { - $currentstring = '\end{center}'; - } + } return $currentstring; } @@ -529,8 +525,6 @@ sub start_b { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring = '\textbf{'; - } elsif ($target eq 'latexsource') { - $currentstring = '\textbf{'; } return $currentstring; } @@ -542,8 +536,6 @@ sub end_b { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = '}'; - } elsif ($target eq 'latexsource') { - $currentstring = '}'; } return $currentstring; } @@ -556,8 +548,6 @@ sub start_strong { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring = '\textbf{'; - } elsif ($target eq 'latexsource') { - $currentstring = '\textbf{'; } return $currentstring; } @@ -570,9 +560,7 @@ sub end_strong { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = '}'; - } elsif ($target eq 'latexsource') { - $currentstring = '}'; - } + } return $currentstring; } @@ -848,9 +836,7 @@ sub start_cite { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "\\textit{"; - } elsif ($target eq 'latexsource') { - $currentstring .= "\\textit{"; - } + } return $currentstring; } @@ -861,9 +847,7 @@ sub end_cite { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; - } elsif ($target eq 'latexsource') { - $currentstring .= "}"; - } + } return $currentstring; } @@ -875,9 +859,7 @@ sub start_i { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\textit{'; - } elsif ($target eq 'latexsource') { - $currentstring .= '\textit{'; - } + } return $currentstring; } @@ -888,8 +870,6 @@ sub end_i { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; - } elsif ($target eq 'latexsource') { - $currentstring .= '}'; } return $currentstring; } @@ -902,9 +882,7 @@ sub start_address { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "\\textit{"; - } elsif ($target eq 'latexsource') { - $currentstring .= "\\textit{"; - } + } return $currentstring; } @@ -915,8 +893,6 @@ sub end_address { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; - } elsif ($target eq 'latexsource') { - $currentstring .= "}"; } return $currentstring; } @@ -929,8 +905,6 @@ sub start_dfn { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "\\textit{"; - } elsif ($target eq 'latexsource') { - $currentstring .= "\\textit{"; } return $currentstring; } @@ -942,9 +916,7 @@ sub end_dfn { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; - } elsif ($target eq 'latexsource') { - $currentstring .= "}"; - } + } return $currentstring; } @@ -956,9 +928,7 @@ sub start_tt { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\texttt{'; - } elsif ($target eq 'latexsource') { - $currentstring .= '\texttt{'; - } + } return $currentstring; } @@ -969,8 +939,6 @@ sub end_tt { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; - } elsif ($target eq 'latexsource') { - $currentstring .= '}'; } return $currentstring; } @@ -983,9 +951,7 @@ sub start_kbd { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "\\texttt"; - } elsif ($target eq 'latexsource') { - $currentstring .= "\\texttt{"; - } + } return $currentstring; } @@ -996,9 +962,7 @@ sub end_kbd { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; - } elsif ($target eq 'latexsource') { - $currentstring .= "}"; - } + } return $currentstring; } @@ -1033,9 +997,7 @@ sub start_em { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '\emph{'; - } elsif ($target eq 'latexsource') { - $currentstring .= '\emph{'; - } + } return $currentstring; } @@ -1046,9 +1008,7 @@ sub end_em { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; - } elsif ($target eq 'latexsource') { - $currentstring .= '}'; - } + } return $currentstring; } @@ -1060,8 +1020,6 @@ sub start_q { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "\\emph{"; - } elsif ($target eq 'latexsource') { - $currentstring .= "\\emph{"; } return $currentstring; } @@ -1073,9 +1031,7 @@ sub end_q { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; - } elsif ($target eq 'latexsource') { - $currentstring .= "}"; - } + } return $currentstring; } @@ -1086,10 +1042,8 @@ sub start_p { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= '{\par '; - } elsif ($target eq 'latexsource') { - $currentstring .= '{\par '; - } + $currentstring .= '\par '; + } return $currentstring; } @@ -1098,10 +1052,6 @@ sub end_p { my $currentstring = ''; if ($target eq 'web') { $currentstring .= $token->[2]; - } elsif ($target eq 'tex') { - $currentstring .= '}'; - } elsif ($target eq 'latexsource') { - $currentstring .= '}'; } return $currentstring; } @@ -1116,9 +1066,7 @@ sub start_br { if ($$tagstack[-2] ne 'sub' && $$tagstack[-2] ne 'sup') { $currentstring .= '\vskip 0.2 mm'; } - } elsif ($target eq 'latexsource') { - $currentstring .= '\\'; - } + } return $currentstring; } @@ -1139,9 +1087,7 @@ sub start_big { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '{\large '; - } elsif ($target eq 'latexsource') { - $currentstring .= '{\Large '; - } + } return $currentstring; } @@ -1152,8 +1098,6 @@ sub end_big { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; - } elsif ($target eq 'latexsource') { - $currentstring .= '}'; } return $currentstring; } @@ -1166,9 +1110,7 @@ sub start_small { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= '{\footnotesize '; - } elsif ($target eq 'latexsource') { - $currentstring .= '{\footnotesize '; - } + } return $currentstring; } @@ -1179,8 +1121,6 @@ sub end_small { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= '}'; - } elsif ($target eq 'latexsource') { - $currentstring .= '}'; } return $currentstring; } @@ -1417,40 +1357,33 @@ sub start_a { } sub end_a { - my ($target,$token,$tagstack,$stackref) = @_; + my ($target,$token,$tagstack,$parstack,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - my $tempor_var = $stackref->[$#$stackref]; - if (index($tempor_var,'name') != -1 ) { - $tempor_var =~ s/name=([^,]*),/$1/g; - } elsif (index($tempor_var,'href') != -1 ) { - $tempor_var =~ s/href=([^,]*),/$1/g; - $currentstring .= " \\ref{$tempor_var}"; - } + my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1); + $currentstring .= '\ref{'.$href.'}'; } return $currentstring; } #--
  • tag sub start_li { - my ($target,$token,$tagstack,$stackref) = @_; + my ($target,$token,$tagstack,$parstack,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - my $tempor_var = $stackref->[$#$stackref]; - if (index($tempor_var,'circle') != -1 ) { - $currentstring .= " \\item[o] "; - } elsif (index($tempor_var,'square') != -1 ) { - $currentstring .= " \\item[$\Box$] "; - } elsif ($tempor_var ne '') { - $_ = $tempor_var; - m/my\s*([^=]*)=/; - $currentstring .= " \\item[$1] "; + my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,1); + if ($type=~/circle/) { + $currentstring .= ' \item[o] '; + } elsif ($type=~/square/) { + $currentstring .= ' \item[$\Box$] '; + } elsif ($type ne '') { + $currentstring .= ' \item['.$type.'] '; } else { - $currentstring .= " \\item "; + $currentstring .= ' \item '; } } return $currentstring; @@ -1891,6 +1824,9 @@ sub end_td { } elsif ($target eq 'tex') { my $current_row = $Apache::londefdef::table[-1]{'row_number'}; my $data=&Apache::lonxml::endredirection(); + + $currentstring.=' SSSS '.$data.' FFFF '; + my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); if (defined $TeXwidth) { my $current_length=&recalc($TeXwidth);