Fix regression introduced in commit 7cfac95

Commit 7cfac95 got rid of empty lines that were created by removing \usepackage
statements. However, it added an additional newline in case the \usepackage
was not at the end of the line. This is now fixed.
This commit is contained in:
Georg Baum 2012-10-05 22:16:46 +02:00
parent 63612ca99b
commit 28dc8a77ee
2 changed files with 20 additions and 12 deletions

View File

@ -648,10 +648,8 @@ void Preamble::handle_package(Parser &p, string const & name,
} }
// roman fonts // roman fonts
if (is_known(name, known_roman_fonts)) { if (is_known(name, known_roman_fonts))
h_font_roman = name; h_font_roman = name;
p.skip_spaces();
}
if (name == "fourier") { if (name == "fourier") {
h_font_roman = "utopia"; h_font_roman = "utopia";
@ -816,10 +814,16 @@ void Preamble::handle_package(Parser &p, string const & name,
else if (is_known(name, known_lyx_packages) && options.empty()) { else if (is_known(name, known_lyx_packages) && options.empty()) {
if (name == "splitidx") if (name == "splitidx")
h_use_indices = "true"; h_use_indices = "true";
if (!in_lyx_preamble) if (!in_lyx_preamble) {
h_preamble << package_beg_sep << name h_preamble << package_beg_sep << name
<< package_mid_sep << "\\usepackage{" << package_mid_sep << "\\usepackage{"
<< name << "}\n" << package_end_sep; << name << '}';
if (p.next_token().cat() == catNewline ||
(p.next_token().cat() == catSpace &&
p.next_next_token().cat() == catNewline))
h_preamble << '\n';
h_preamble << package_end_sep;
}
} }
else if (name == "geometry") else if (name == "geometry")
@ -859,12 +863,16 @@ void Preamble::handle_package(Parser &p, string const & name,
else if (!in_lyx_preamble) { else if (!in_lyx_preamble) {
if (options.empty()) if (options.empty())
h_preamble << "\\usepackage{" << name << "}\n"; h_preamble << "\\usepackage{" << name << '}';
else { else {
h_preamble << "\\usepackage[" << opts << "]{" h_preamble << "\\usepackage[" << opts << "]{"
<< name << "}\n"; << name << '}';
options.clear(); options.clear();
} }
if (p.next_token().cat() == catNewline ||
(p.next_token().cat() == catSpace &&
p.next_next_token().cat() == catNewline))
h_preamble << '\n';
} }
// We need to do something with the options... // We need to do something with the options...