[LON-CAPA-cvs] cvs: loncom(language_hyphenation) /homework structuretags.pm

foxr foxr at source.lon-capa.org
Mon Dec 26 08:45:11 EST 2011


foxr		Mon Dec 26 13:45:11 2011 EDT

  Modified files:              (Branch: language_hyphenation)
    /loncom/homework	structuretags.pm 
  Log:
  BZ 6490 - Support addition of \selectlanguage{babel-name} in problems for a <translation>.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.497.2.4 loncom/homework/structuretags.pm:1.497.2.5
--- loncom/homework/structuretags.pm:1.497.2.4	Wed Dec 14 11:56:08 2011
+++ loncom/homework/structuretags.pm	Mon Dec 26 13:45:10 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.497.2.4 2011/12/14 11:56:08 foxr Exp $
+# $Id: structuretags.pm,v 1.497.2.5 2011/12/26 13:45:10 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -96,13 +96,13 @@
 sub select_hyphenation {
     my $language  = shift;
 
-    $language = &Apache::loncommon::latex_language($language); # Translate -> latex language.
+    $language = &Apache::loncommon::latexlanguage($language); # Translate -> latex language.
 
     # If there is no latex language there's not much we can do:
 
     if ($language) {
 	&require_language($language);
-	my $babel_hyphenation = "\\select_language{$language}";
+	my $babel_hyphenation = "\\selectlanguage{$language}";
 	
 	return $babel_hyphenation;
     } else {
@@ -122,7 +122,6 @@
 #
 sub require_language {
     my $language = shift;
-
     $languages_required{$language} = 1;
 }
 
@@ -133,9 +132,8 @@
 # @retval \usepackage[lang1,lang2...]{babel}
 # @retval ''   if there are no languages_required.
 sub languages_header {
-
     my $header    ='';
-    my @languages = keys(%languages_required);
+    my @languages = (keys(%languages_required));
 
     # Only generate the header if there are languages:
 
@@ -143,7 +141,6 @@
 	my $language_list = join(',', (@languages));
 	$header  = '\usepackage['.$language_list."]{babel}\n";
     }
-
     return $header;
 }
 
@@ -1345,6 +1342,7 @@
 	}
 	my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');
 	my $begin_doc=' \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent ';
+	&clear_required_languages();
 	my $toc_line='\vskip 1 mm\noindent '.$startminipage.
 	    '\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
 	




More information about the LON-CAPA-cvs mailing list