From acbce8a8fcc2e91509372606cc2425f837809036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Matox?= Date: Wed, 17 Oct 2001 13:03:12 +0000 Subject: [PATCH] Fun with reLyX. Add support for babel extra arguments. Add support for make index. Clean output. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2891 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 6 ++++++ lib/reLyX/MakePreamble.pm | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 706601aec9..065c72105c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2001-10-17 José Matos + + * reLyX/MakePreamble.pm: add support for \makeindex, added support + for optional arguments to babel, remove fontenc package. Don't + print the latex preamble if there isn't none to print. + 2001-10-15 Jean-Marc Lasgouttes * scripts/TeXFiles.sh: rewrite to use kpsewhich --show-path. diff --git a/lib/reLyX/MakePreamble.pm b/lib/reLyX/MakePreamble.pm index a71cb92f66..60c6877964 100644 --- a/lib/reLyX/MakePreamble.pm +++ b/lib/reLyX/MakePreamble.pm @@ -243,6 +243,7 @@ sub translate_preamble { if($Latex_Preamble =~ s/\\usepackage\[(.*)\]\{inputenc\}\s*//) { $LyX_Preamble .= "\\inputencoding $1\n"; } + $Latex_Preamble =~ s/\\usepackage\[.*\]\{fontenc\}\s*//; ## Deal with several \usepackage{} cases my %Usepackage_Table = ( @@ -267,9 +268,17 @@ sub translate_preamble { "a4" => "\\paperpackage a4wide", "graphics" => "\\graphics default", - "rotating" => "" + "rotating" => "", + "makeidx" => "\\makeindex" ); + ## Babel with arguments specifing language + if($Latex_Preamble =~ s/\\usepackage\[(.*)\]\{babel\}\s*//) { + my @languages = split(',',$1); + my $lang = pop @languages; + $LyX_Preamble .= "\\language $lang\n"; + } + my $up; foreach $up (keys %Usepackage_Table) { $Latex_Preamble =~ s/\\usepackage\{$up\}\s*// && do { @@ -342,7 +351,9 @@ sub translate_preamble { if ($write_preamble) { $Latex_Preamble =~ s/^\s*//; print "LaTeX preamble, consists of:\n$Latex_Preamble" if $debug_on; - $Latex_Preamble = "\\begin_preamble\n$Latex_Preamble\\end_preamble\n"; + if($Latex_Preamble) { + $Latex_Preamble = "\\begin_preamble\n$Latex_Preamble\\end_preamble\n"; + } print "End of LaTeX preamble\n" if $debug_on; } else { $Latex_Preamble = ""; #just comments, whitespace. Ignore them