-# This file is part of reLyX.
+# This file is part of reLyX.
# Copyright (c) 1998-9 Amir Karger karger@post.harvard.edu
# You are free to use and modify this code under the terms of
# the GNU General Public Licence version 2 or later.
$debug_on = (defined($main::opt_d) && $main::opt_d);
# -c option?
$true_class = defined($main::opt_c) ? $main::opt_c : "";
- my $zzz = $debug_on
- ? " from LaTeX file $InFileName into $PreambleName and $OutFileName"
+ my $zzz = $debug_on
+ ? " from LaTeX file $InFileName into $PreambleName and $OutFileName"
: "";
warn "Splitting Preamble$zzz\n";
#}
# Write first line of the lyx file
- $LyX_Preamble .= "\#LyX 1.2 created this file. For more info see http://www.lyx.org/\n";
+ $LyX_Preamble .= "\# The reLyX bundled with LyX 1.3 created this file.\n" .
+ "# For more info see http://www.lyx.org/\n";
# Print \lyxformat.
$LyX_Preamble .= "\\lyxformat $Format\n";
warn "Uncommented text before \\documentclass command ignored!\n"if $ignore;
print "Ignored text was\n------\n$ignore------\n" if $debug_on && $ignore;
- # concatenate all the extra options until the required argument to
+ # concatenate all the extra options until the required argument to
# \documentclass, which will be in braces
until (eof(PREAMBLE) || /\{/) {
my $instr = <PREAMBLE>;
"graphics" => "\\graphics default",
"rotating" => "",
- "makeidx" => "\\makeindex"
+ "makeidx" => ""
);
## Babel with arguments specifing language
my $up;
foreach $up (keys %Usepackage_Table) {
- $Latex_Preamble =~ s/\\usepackage\{$up\}\s*// && do {
+ $Latex_Preamble =~ s/^\s*\\usepackage\{$up\}\s*// && do {
$LyX_Preamble .= "$Usepackage_Table{$up}";
$LyX_Preamble .= "\n" unless ($Usepackage_Table{$up} eq "");
}
}
+ # Natbib is a little more complex than that.
+ if ($Latex_Preamble =~ s/\\usepackage(.*)\{natbib\}\s*//) {
+ $LyX_Preamble .= "\\use_natbib 1\n\\use_numerical_citations ";
+ $LyX_Preamble .= ($1 =~ /numbers/) ? "1\n" : "0\n";
+ } else {
+ $LyX_Preamble .= "\\use_natbib 0\n\\use_numerical_citations 0\n";
+ }
+
## Handle geometry options
## The custom paper missing from the options list since it involves two parameters
my %Geometry_Options =(
}
## Paragraph skip or indentation
- if ( $Latex_Preamble =~
+ if ( $Latex_Preamble =~
s/\\setlength\\parskip\{\\(.*)amount\}\s*\\setlength\\parindent\{0pt\}//) {
$LyX_Preamble .= "\\paragraph_separation skip\n";
$LyX_Preamble .= "\\defskip $1\n";