use_geometry = false;
use_amsmath = package_auto;
use_esint = package_auto;
+ use_mhchem = package_auto;
cite_engine_ = ENGINE_BASIC;
use_bibtopic = false;
use_indices = false;
int useesint;
lex >> useesint;
use_esint = packagetranslator().find(useesint);
+ } else if (token == "\\use_mhchem") {
+ int usemhchem;
+ lex >> usemhchem;
+ use_mhchem = packagetranslator().find(usemhchem);
} else if (token == "\\cite_engine") {
string engine;
lex >> engine;
if (branch_ptr)
branch_ptr->setFilenameSuffix(lex.getInteger());
}
- // not yet operational
if (tok == "\\color") {
lex.eatLine();
string color = lex.getString();
} else if (token == "\\index") {
lex.eatLine();
docstring index = lex.getDocString();
+ docstring shortcut;
indiceslist().add(index);
while (true) {
lex.next();
Index * index_ptr = indiceslist().find(index);
if (tok == "\\shortcut") {
lex.next();
+ shortcut = lex.getDocString();
if (index_ptr)
- index_ptr->setShortcut(lex.getDocString());
+ index_ptr->setShortcut(shortcut);
}
- // not yet operational
if (tok == "\\color") {
lex.eatLine();
string color = lex.getString();
if (color == "none")
color = lcolor.getX11Name(Color_background);
// FIXME UNICODE
- lcolor.setColor(to_utf8(index), color);
+ if (!shortcut.empty())
+ lcolor.setColor(to_utf8(shortcut), color);
}
}
} else if (token == "\\author") {
<< "\n\\use_geometry " << convert<string>(use_geometry)
<< "\n\\use_amsmath " << use_amsmath
<< "\n\\use_esint " << use_esint
+ << "\n\\use_mhchem " << use_mhchem
<< "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
<< "\n\\use_bibtopic " << convert<string>(use_bibtopic)
<< "\n\\use_indices " << convert<string>(use_indices)
features.require("amsmath");
if (use_esint == package_on)
features.require("esint");
+ if (use_mhchem == package_on)
+ features.require("mhchem");
// Document-level line spacing
if (spacing().getSpace() != Spacing::Single && !spacing().isDefault())
// Line spacing
lyxpreamble += from_utf8(spacing().writePreamble(tclass.provides("SetSpace")));
- // date
- if (suppress_date)
- lyxpreamble += "\\date{}\n";
-
// PDF support.
// * Hyperref manual: "Make sure it comes last of your loaded
// packages, to give it a fighting chance of not being over-written,
"Textclass specific LaTeX commands.\n"
+ tmppreamble + '\n';
+ // suppress date if selected
+ // use \@ifundefined because we cannot be sure that every document class
+ // has a \date command
+ if (suppress_date)
+ atlyxpreamble += "\\@ifundefined{date}{}{\\date{}}\n";
+
/* the user-defined preamble */
if (!containsOnly(preamble, " \n\t"))
// FIXME UNICODE