Output package options before loading any package.

Fixes: #9355
This commit is contained in:
Juergen Spitzmueller 2014-12-21 12:10:06 +01:00
parent 740d9162c0
commit 9b3e47fd87
3 changed files with 21 additions and 10 deletions

View File

@ -1776,6 +1776,9 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
lyxpreamble += "\\synctex=-1\n";
}
// The package options (via \PassOptionsToPackage)
lyxpreamble += from_ascii(features.getPackageOptions());
// due to interferences with babel and hyperref, the color package has to
// be loaded (when it is not already loaded) before babel when hyperref
// is used with the colorlinks option, see

View File

@ -815,6 +815,22 @@ string const LaTeXFeatures::getColorOptions() const
}
string const LaTeXFeatures::getPackageOptions() const
{
ostringstream packageopts;
// Output all the package option stuff we have been asked to do.
map<string, string>::const_iterator it =
params_.documentClass().packageOptions().begin();
map<string, string>::const_iterator en =
params_.documentClass().packageOptions().end();
for (; it != en; ++it)
if (mustProvide(it->first))
packageopts << "\\PassOptionsToPackage{" << it->second << "}"
<< "{" << it->first << "}\n";
return packageopts.str();
}
string const LaTeXFeatures::getPackages() const
{
ostringstream packages;
@ -825,16 +841,6 @@ string const LaTeXFeatures::getPackages() const
// also unknown packages can be requested. They are silently
// swallowed now. We should change this eventually.
// Output all the package option stuff we have been asked to do.
map<string, string>::const_iterator it =
params_.documentClass().packageOptions().begin();
map<string, string>::const_iterator en =
params_.documentClass().packageOptions().end();
for (; it != en; ++it)
if (mustProvide(it->first))
packages << "\\PassOptionsToPackage{" << it->second << "}"
<< "{" << it->first << "}\n";
// These are all the 'simple' includes. i.e
// packages which we just \usepackage{package}
for (int i = 0; i < nb_simplefeatures; ++i) {

View File

@ -55,6 +55,8 @@ public:
OutputParams const &);
/// The color packages
std::string const getColorOptions() const;
/// The requested package options
std::string const getPackageOptions() const;
/// The packages needed by the document
std::string const getPackages() const;
/// The macros definitions needed by the document