--- loncom/xml/londefdef.pm	2004/08/25 20:16:44	1.231.2.2
+++ loncom/xml/londefdef.pm	2004/08/20 18:43:36	1.235
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.231.2.2 2004/08/25 20:16:44 albertel Exp $
+# $Id: londefdef.pm,v 1.235 2004/08/20 18:43:36 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -66,7 +66,6 @@ sub initialize_londefdef {
     @Apache::londefdef::description=();
     $Apache::londefdef::DD_redirection=0;
     $Apache::londefdef::DT_redirection=0;
-    $Apache::londefdef::list_index=0;
 }
 
 #======================= TAG SUBROUTINES =====================
@@ -155,7 +154,7 @@ sub start_html {
 	    &Apache::lonxml::fontsettings();     
     } elsif ($target eq 'tex') {
 	@Apache::londefdef::table = ();
-	$currentstring .= '\documentclass[letterpaper]{article}';
+	$currentstring .= '\documentclass[letterpaper]{book}';
 	if ($ENV{'form.latex_type'}=~'batchmode') {$currentstring .='\batchmode';} 
 	$currentstring .= '\newcommand{\keephidden}[1]{}'.
                           '\renewcommand{\deg}{$^{\circ}$}'.
@@ -177,10 +176,10 @@ sub start_html {
 }
 
 sub end_html {
-    my ($target,$token) = @_;
+    my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';
     if ($target eq 'web') {
-	$currentstring = &Apache::lonxml::xmlend();
+	$currentstring = &Apache::lonxml::xmlend($target,$parser);
     }
     return $currentstring;
 }
@@ -1486,28 +1485,17 @@ sub start_li {
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
-	my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);
-	my $value=&Apache::lonxml::get_param('value',$parstack,$safeeval,undef,0);
-	#FIXME need to support types i and I 
-	if ($type=~/disc/) {
-	    $currentstring .= ' \item[$\bullet$] ';
-	} elsif ($type=~/circle/) {
-	    $currentstring .= ' \item[$\circ$] ';
+	my  $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,1);
+	if ($type=~/circle/) {
+	    $currentstring .= ' \item[o] ';
 	} elsif ($type=~/square/) {
-	    $currentstring .= ' \item[$\diamond$] ';
-	} elsif ($type eq '1') {
-	    $currentstring .= ' \item['.($Apache::londefdef::list_index+1).'.]';
-	} elsif ($type eq 'A') {
-	    $currentstring .= ' \item['.('A'..'Z')[$Apache::londefdef::list_index].'.]';
-	} elsif ($type eq 'a') {
-	    $currentstring .= ' \item['.('a'..'z')[$Apache::londefdef::list_index].'.]';
-	} elsif ($value ne '') {
-	    $currentstring .= ' \item['.$value.'] ';
+	    $currentstring .= ' \item[$\Box$] ';
+	} elsif ($type ne '') { 
+	    $currentstring .= ' \item['.$type.'] ';
 	} else {
 	    $currentstring .= ' \item ';
 	}  
-	$Apache::londefdef::list_index++;
-    }
+    } 
     return $currentstring;
 }
 
@@ -1554,7 +1542,6 @@ sub start_ul {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
 	my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);
-	$Apache::londefdef::list_index=0;
 	if ($TeXtype eq 'disc') {
 	    $currentstring .= '\renewcommand{\labelitemi}{$\bullet$}'.
                               '\renewcommand{\labelitemii}{$\bullet$}'. 
@@ -1643,7 +1630,6 @@ sub start_ol {
     if ($target eq 'web') {
 	$currentstring = $token->[4];     
     } elsif ($target eq 'tex') {
-	$Apache::londefdef::list_index=0;
 	my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);
 	if ($type eq '1') {
 	    $currentstring .= '\renewcommand{\labelenumi}{\arabic{enumi}.}'.
@@ -2436,8 +2422,13 @@ sub start_img {
     } elsif ($target eq 'tex') {
 	$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
         #if uploaded restore the path
+	my $old_src=$src;
 	if ($src=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/simplepage\/([^\/]+)$/) {
 	    $src=&Apache::loncommon::propath($1,$2).'/userfiles/simplepage/'.$3;
+	    if (not -e $src) {
+		$old_src=~/^\/uploaded\/(.*)$/;
+		$src=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1;
+	    }
 	} elsif ($src=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/aboutme\/([^\/]+)$/) {
 	    $src=&Apache::loncommon::propath($1,$2).'/userfiles/aboutme/'.$3;
 	}
@@ -2493,6 +2484,8 @@ sub start_img {
 	$currentstring .=&Apache::edit::text_arg('height (pixel):','height',$token,5).'<br />';
 	$currentstring .=&Apache::edit::text_arg('TeXwidth (mm):','TeXwidth',$token,5);
 	$currentstring .=&Apache::edit::text_arg('TeXheight (mm):','TeXheight',$token,5);
+	$currentstring .=&Apache::edit::select_arg('Alignment:','align',
+						   ['','bottom','middle','top','left','right'],$token,5);
 	$currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
 	my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval);
 	my $alt=&Apache::lonxml::get_param('alt',$parstack,$safeeval);
@@ -2506,7 +2499,7 @@ sub start_img {
 	my ($osrc,$owidth,$oheight)=
 	    ($token->[2]{'src'},$token->[2]{'width'},$token->[2]{'height'});
 	my $ctag=&Apache::edit::get_new_args($token,$parstack,
-					     $safeeval,'src','alt',
+					     $safeeval,'src','alt','align',
 					     'TeXwidth','TeXheight',
 					     'width','height');
 	my ($nsrc,$nwidth,$nheight)=