--- loncom/xml/londefdef.pm 2004/04/15 20:17:32 1.211 +++ loncom/xml/londefdef.pm 2004/05/11 18:41:24 1.213 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.211 2004/04/15 20:17:32 albertel Exp $ +# $Id: londefdef.pm,v 1.213 2004/05/11 18:41:24 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -633,7 +633,7 @@ sub start_h1 { } elsif ($target eq 'tex') { my $pre; my $align=lc(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1)); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $pre='\begin{center}'; } elsif ($align eq 'left') { $pre='\rlap{'; @@ -656,9 +656,9 @@ sub end_h1 { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - my $post; + my $post='\vskip 0 mm '; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $post='\end{center}'; } elsif ($align eq 'left') { $post='} \hfill'.'\vskip 0 mm '; @@ -682,7 +682,7 @@ sub start_h2 { } elsif ($target eq 'tex') { my $pre; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $pre='\begin{center}'; } elsif ($align eq 'left') { $pre='\rlap{'; @@ -702,9 +702,9 @@ sub end_h2 { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - my $post; + my $post='\vskip 0 mm '; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $post='\end{center}'; } elsif ($align eq 'left') { $post='} \hfill'.'\vskip 0 mm '; @@ -725,7 +725,7 @@ sub start_h3 { } elsif ($target eq 'tex') { my $pre; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $pre='\begin{center}'; } elsif ($align eq 'left') { $pre='\rlap{'; @@ -745,9 +745,9 @@ sub end_h3 { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - my $post; + my $post='\vskip 0 mm '; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $post='\end{center}'; } elsif ($align eq 'left') { $post='} \hfill'.'\vskip 0 mm '; @@ -768,7 +768,7 @@ sub start_h4 { } elsif ($target eq 'tex') { my $pre; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $pre='\begin{center}'; } elsif ($align eq 'left') { $pre='\rlap{'; @@ -788,9 +788,9 @@ sub end_h4 { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - my $post; + my $post='\vskip 0 mm '; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $post='\end{center}'; } elsif ($align eq 'left') { $post='} \hfill'.'\vskip 0 mm '; @@ -811,7 +811,7 @@ sub start_h5 { } elsif ($target eq 'tex') { my $pre; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $pre='\begin{center}'; } elsif ($align eq 'left') { $pre='\rlap{'; @@ -831,9 +831,9 @@ sub end_h5 { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - my $post; + my $post='\vskip 0 mm '; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $post='\end{center}'; } elsif ($align eq 'left') { $post='} \hfill'.'\vskip 0 mm '; @@ -854,7 +854,7 @@ sub start_h6 { } elsif ($target eq 'tex') { my $pre; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $pre='\begin{center}'; } elsif ($align eq 'left') { $pre='\rlap{'; @@ -874,9 +874,9 @@ sub end_h6 { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - my $post; + my $post='\vskip 0 mm '; my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1); - if (($align eq 'center') || (not defined $align)) { + if ($align eq 'center') { $post='\end{center}'; } elsif ($align eq 'left') { $post='} \hfill'.'\vskip 0 mm '; @@ -1904,7 +1904,6 @@ sub end_table { $space_neeeded=$space_neeeded+$max_len[$jn]; } if ($space_neeeded<=$available_space) { -## &Apache::lonnet::logthis("I am in position 1: $space_neeeded <= $available_space"); for (my $jn=0;$jn<=$#max_len;$jn++) { if ($fwidth[$jn]==0) { $fwidth[$jn]=$max_len[$jn]; @@ -1917,7 +1916,6 @@ sub end_table { $space_neeeded+=$min_len[$jn]; } if ($space_neeeded>$available_space) { -## &Apache::lonnet::logthis("I am in position 2"); $WARNING=' \textbf{NOT ENOUGH SPACE FOR TABLE} '; for (my $jn=0;$jn<=$#max_len;$jn++) { if ($fwidth[$jn]==0) { @@ -1926,7 +1924,6 @@ sub end_table { } } else { #step 3. adjustment over minimal + corrections -## &Apache::lonnet::logthis("I am in position 3"); my $enlarge_coef=$available_space/$space_neeeded; my $acsessive=0; for (my $jn=0;$jn<=$#min_len;$jn++) { @@ -2271,6 +2268,11 @@ sub start_img { } } elsif ($target eq 'tex') { $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); + #if uploaded restore the path + if ($src=~/^\/uploaded\//) { + $src=~s/\/(\w)(\w)(\w)([^\/]*)\/simplepage\//\/$1\/$2\/$3\/$1$2$3$4\/userfiles\/simplepage\//; + $src=~s/uploaded/home\/httpd\/lonUsers/; + } #if original gif/jpg/png file exist do following: if (-e $src) { #what is the image size? @@ -3540,6 +3542,10 @@ sub eps_generation { $newsrc=~s/\/home\/([^\/]*)\/public_html\//\/$1\//; $newsrc=~s/\/\.\//\//; $newsrc=~s/\/([^\/]+)\.(ps|eps)/\//; + if ($newsrc=~/\/home\/httpd\/lonUsers\//) { + $newsrc=~s/\/home\/httpd\/lonUsers//; + $newsrc=~s/\/([^\/]+)\/(\w)\/(\w)\/(\w)\//\/$1\//; + } return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; }