mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Move some more packages from unconditionally swallowing to the package
registration mechanism, so that they are only swallowed if LyX will load them. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40315 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4c72c6a32d
commit
5a525d932f
@ -448,6 +448,7 @@ Preamble::Preamble() : one_language(true)
|
||||
h_tocdepth = "3";
|
||||
h_tracking_changes = "false";
|
||||
h_use_bibtopic = "false";
|
||||
h_use_indices = "false";
|
||||
h_use_geometry = "false";
|
||||
h_use_amsmath = "1";
|
||||
h_use_default_options = "false";
|
||||
@ -705,27 +706,21 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
else if (is_known(name, known_old_language_packages)) {
|
||||
// known language packages from the times before babel
|
||||
// if they are found and not also babel, they will be used as
|
||||
// cutom language package
|
||||
// custom language package
|
||||
h_language_package = "\\usepackage{" + name + "}";
|
||||
}
|
||||
|
||||
else if (name == "makeidx")
|
||||
; // ignore this
|
||||
|
||||
else if (name == "prettyref")
|
||||
; // ignore this
|
||||
; // ignore this FIXME: Use the package separator mechanism instead
|
||||
|
||||
else if (name == "varioref")
|
||||
; // ignore this
|
||||
; // ignore this FIXME: Use the package separator mechanism instead
|
||||
|
||||
else if (name == "verbatim")
|
||||
; // ignore this
|
||||
|
||||
else if (name == "nomencl")
|
||||
; // ignore this
|
||||
; // ignore this FIXME: Use the package separator mechanism instead
|
||||
|
||||
else if (name == "textcomp")
|
||||
; // ignore this
|
||||
; // ignore this FIXME: Use the package separator mechanism instead
|
||||
|
||||
else if (name == "lyxskak") {
|
||||
// ignore this and its options
|
||||
@ -733,13 +728,11 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
options.clear();
|
||||
}
|
||||
|
||||
else if (name == "url")
|
||||
; // ignore this
|
||||
|
||||
else if (name == "array" || name == "booktabs" ||
|
||||
name == "color" || name == "hhline" ||
|
||||
name == "longtable" || name == "subscript" ||
|
||||
name == "ulem") {
|
||||
else if (name == "array" || name == "booktabs" || name == "float" ||
|
||||
name == "color" || name == "hhline" || name == "longtable" ||
|
||||
name == "makeidx" || name == "nomencl" || name == "splitidx" ||
|
||||
name == "setspace" || name == "subscript" || name == "ulem" ||
|
||||
name == "url") {
|
||||
if (!in_lyx_preamble)
|
||||
h_preamble << package_beg_sep << name
|
||||
<< package_mid_sep << "\\usepackage{"
|
||||
@ -747,22 +740,19 @@ void Preamble::handle_package(Parser &p, string const & name,
|
||||
}
|
||||
|
||||
else if (name == "graphicx")
|
||||
; // ignore this
|
||||
|
||||
else if (name == "setspace")
|
||||
; // ignore this
|
||||
; // ignore this FIXME: Use the package separator mechanism instead
|
||||
|
||||
else if (name == "geometry")
|
||||
handle_geometry(options);
|
||||
|
||||
else if (name == "rotfloat")
|
||||
; // ignore this
|
||||
; // ignore this FIXME: Use the package separator mechanism instead
|
||||
|
||||
else if (name == "wrapfig")
|
||||
; // ignore this
|
||||
; // ignore this FIXME: Use the package separator mechanism instead
|
||||
|
||||
else if (name == "subfig")
|
||||
; // ignore this
|
||||
; // ignore this FIXME: Use the package separator mechanism instead
|
||||
|
||||
else if (is_known(name, known_languages))
|
||||
h_language = name;
|
||||
@ -857,6 +847,11 @@ bool Preamble::writeLyXHeader(ostream & os)
|
||||
else if (is_known(h_language, known_english_quotes_languages))
|
||||
h_quotes_language = "english";
|
||||
|
||||
if (contains(h_float_placement, "H"))
|
||||
registerAutomaticallyLoadedPackage("float");
|
||||
if (h_spacing != "single" && h_spacing != "default")
|
||||
registerAutomaticallyLoadedPackage("setspace");
|
||||
|
||||
// output the LyX file settings
|
||||
os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
|
||||
<< "\\lyxformat " << LYX_FORMAT << '\n'
|
||||
@ -948,6 +943,7 @@ bool Preamble::writeLyXHeader(ostream & os)
|
||||
<< "\\use_undertilde " << h_use_undertilde << "\n"
|
||||
<< "\\cite_engine " << h_cite_engine << "\n"
|
||||
<< "\\use_bibtopic " << h_use_bibtopic << "\n"
|
||||
<< "\\use_indices " << h_use_indices << "\n"
|
||||
<< "\\paperorientation " << h_paperorientation << '\n'
|
||||
<< "\\suppress_date " << h_suppress_date << '\n'
|
||||
<< "\\use_refstyle " << h_use_refstyle << '\n';
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
///
|
||||
std::string notefontcolor() const { return h_notefontcolor; }
|
||||
///
|
||||
std::string use_indices() const { return h_use_indices; }
|
||||
///
|
||||
bool indentParagraphs() const;
|
||||
///
|
||||
bool isPackageUsed(std::string const & package) const;
|
||||
@ -136,6 +138,7 @@ private:
|
||||
std::string h_tocdepth;
|
||||
std::string h_tracking_changes;
|
||||
std::string h_use_bibtopic;
|
||||
std::string h_use_indices;
|
||||
std::string h_use_geometry;
|
||||
std::string h_use_amsmath;
|
||||
std::string h_use_default_options;
|
||||
|
@ -1223,6 +1223,15 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
float_type = "";
|
||||
if (!opt.empty())
|
||||
os << "placement " << opt << '\n';
|
||||
if (contains(opt, "H"))
|
||||
preamble.registerAutomaticallyLoadedPackage("float");
|
||||
else {
|
||||
Floating const & fl = parent_context.textclass.floats()
|
||||
.getType(unstarred_name);
|
||||
if (!fl.floattype().empty() && fl.usesFloatPkg())
|
||||
preamble.registerAutomaticallyLoadedPackage("float");
|
||||
}
|
||||
|
||||
os << "wide " << convert<string>(is_starred)
|
||||
<< "\nsideways false"
|
||||
<< "\nstatus open\n\n";
|
||||
@ -1386,12 +1395,16 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
parent_context.add_extra_stuff("\\align center\n");
|
||||
else if (name == "singlespace")
|
||||
parent_context.add_extra_stuff("\\paragraph_spacing single\n");
|
||||
else if (name == "onehalfspace")
|
||||
else if (name == "onehalfspace") {
|
||||
parent_context.add_extra_stuff("\\paragraph_spacing onehalf\n");
|
||||
else if (name == "doublespace")
|
||||
preamble.registerAutomaticallyLoadedPackage("setspace");
|
||||
} else if (name == "doublespace") {
|
||||
parent_context.add_extra_stuff("\\paragraph_spacing double\n");
|
||||
else if (name == "spacing")
|
||||
preamble.registerAutomaticallyLoadedPackage("setspace");
|
||||
} else if (name == "spacing") {
|
||||
parent_context.add_extra_stuff("\\paragraph_spacing other " + p.verbatim_item() + "\n");
|
||||
preamble.registerAutomaticallyLoadedPackage("setspace");
|
||||
}
|
||||
parse_text(p, os, FLAG_END, outer, parent_context);
|
||||
// Just in case the environment is empty
|
||||
parent_context.extra_stuff.erase();
|
||||
@ -1503,6 +1516,9 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
p.skip_spaces();
|
||||
if (!title_layout_found)
|
||||
title_layout_found = newlayout->intitle;
|
||||
set<string> const & req = newlayout->requires();
|
||||
for (set<string>::const_iterator it = req.begin(); it != req.end(); it++)
|
||||
preamble.registerAutomaticallyLoadedPackage(*it);
|
||||
}
|
||||
|
||||
// The single '=' is meant here.
|
||||
@ -2392,6 +2408,10 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
p.skip_spaces();
|
||||
if (!title_layout_found)
|
||||
title_layout_found = newlayout->intitle;
|
||||
set<string> const & req = newlayout->requires();
|
||||
for (set<string>::const_iterator it = req.begin();
|
||||
it != req.end(); it++)
|
||||
preamble.registerAutomaticallyLoadedPackage(*it);
|
||||
} else
|
||||
handle_ert(os, "\\date{" + date + '}',
|
||||
context);
|
||||
@ -2409,6 +2429,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
p.skip_spaces();
|
||||
if (!title_layout_found)
|
||||
title_layout_found = newlayout->intitle;
|
||||
set<string> const & req = newlayout->requires();
|
||||
for (set<string>::const_iterator it = req.begin(); it != req.end(); it++)
|
||||
preamble.registerAutomaticallyLoadedPackage(*it);
|
||||
}
|
||||
|
||||
// Section headings and the like
|
||||
@ -2419,6 +2442,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
p.skip_spaces();
|
||||
if (!title_layout_found)
|
||||
title_layout_found = newlayout->intitle;
|
||||
set<string> const & req = newlayout->requires();
|
||||
for (set<string>::const_iterator it = req.begin(); it != req.end(); it++)
|
||||
preamble.registerAutomaticallyLoadedPackage(*it);
|
||||
}
|
||||
|
||||
else if (t.cs() == "caption") {
|
||||
@ -3125,6 +3151,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
<< convert_command_inset_arg(p.verbatim_item())
|
||||
<< "\"\n";
|
||||
end_inset(os);
|
||||
preamble.registerAutomaticallyLoadedPackage("nomencl");
|
||||
}
|
||||
|
||||
else if (t.cs() == "label") {
|
||||
@ -3142,6 +3169,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
os << "type \"idx\"\n";
|
||||
end_inset(os);
|
||||
skip_spaces_braces(p);
|
||||
preamble.registerAutomaticallyLoadedPackage("makeidx");
|
||||
if (preamble.use_indices() == "true")
|
||||
preamble.registerAutomaticallyLoadedPackage("splitidx");
|
||||
}
|
||||
|
||||
else if (t.cs() == "printnomenclature") {
|
||||
@ -3168,6 +3198,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
os << "width \"" << width << '\"';
|
||||
end_inset(os);
|
||||
skip_spaces_braces(p);
|
||||
preamble.registerAutomaticallyLoadedPackage("nomencl");
|
||||
}
|
||||
|
||||
else if ((t.cs() == "textsuperscript" || t.cs() == "textsubscript")) {
|
||||
|
Loading…
Reference in New Issue
Block a user