const char * const known_if_3arg_commands[] = {"@ifundefined", "IfFileExists",
0};
+/// packages that work only in xetex
+const char * const known_xetex_packages[] = {"arabxetex", "fixlatvian",
+"fontbook", "fontwrap", "mathspec", "philokalia", "polyglossia", "unisugar",
+"xeCJK", "xecolor", "xecyr", "xeindex", "xepersian", "xunicode", 0};
+
// codes used to remove packages that are loaded automatically by LyX.
// Syntax: package_beg_sep<name>package_mid_sep<package loading code>package_end_sep
const char package_beg_sep = '\001';
}
+void Preamble::registerAuthor(std::string const & name)
+{
+ Author author(from_utf8(name), empty_docstring());
+ author.setUsed(true);
+ authors_.record(author);
+ h_tracking_changes = "true";
+ h_output_changes = "true";
+}
+
+
+Author const & Preamble::getAuthor(std::string const & name) const
+{
+ Author author(from_utf8(name), empty_docstring());
+ for (AuthorList::Authors::const_iterator it = authors_.begin();
+ it != authors_.end(); it++)
+ if (*it == author)
+ return *it;
+ static Author const dummy;
+ return dummy;
+}
+
+
void Preamble::add_package(string const & name, vector<string> & options)
{
// every package inherits the global options
add_package(name, options);
string scale;
+ if (is_known(name, known_xetex_packages))
+ xetex = true;
+
// roman fonts
if (is_known(name, known_roman_fonts)) {
h_font_roman = name;
// we need to keep it in the preamble to prevent cases like bug #7861.
if (!opts.empty()) {
// check if more than one option was used - used later for inputenc
- // in case inputenc is parsed before babel, set the encoding to auto
if (options.begin() != options.end() - 1)
one_language = false;
// babel takes the last language of the option of its \usepackage
// inputenc option because otherwise h_inputencoding must be
// set to "auto" (the default encoding of the document language)
// Therefore check for the "," character.
- // It is also only set when there is not more then one babel
- // language option but this is handled in the routine for babel.
+ // It is also only set when there is not more than one babel
+ // language option.
if (opts.find(",") == string::npos && one_language == true)
h_inputencoding = opts;
if (!options.empty())
<< "\\html_math_output " << h_html_math_output << "\n"
<< "\\html_css_as_file " << h_html_css_as_file << "\n"
<< "\\html_be_strict " << h_html_be_strict << "\n"
+ << authors_
<< "\\end_header\n\n"
<< "\\begin_body\n";
// clear preamble for subdocuments
}
else if (t.cs() == "color") {
+ string const space =
+ (p.hasOpt() ? p.getOpt() : string());
string argument = p.getArg('{', '}');
// check the case that a standard color is used
- if (is_known(argument, known_basic_colors)) {
+ if (space.empty() && is_known(argument, known_basic_colors)) {
h_fontcolor = rgbcolor2code(argument);
preamble.registerAutomaticallyLoadedPackage("color");
- } else if (argument == "document_fontcolor")
+ } else if (space.empty() && argument == "document_fontcolor")
preamble.registerAutomaticallyLoadedPackage("color");
// check the case that LyX's document_fontcolor is defined
// but not used for \color
else {
- h_preamble << t.asInput() << '{' << argument << '}';
+ h_preamble << t.asInput();
+ if (!space.empty())
+ h_preamble << space;
+ h_preamble << '{' << argument << '}';
// the color might already be set because \definecolor
// is parsed before this
h_fontcolor = "";