CiteEngineTranslator const init_citeenginetranslator()
{
CiteEngineTranslator translator("basic", ENGINE_BASIC);
- translator.addPair("natbib_numerical", ENGINE_NATBIB_NUMERICAL);
- translator.addPair("natbib_authoryear", ENGINE_NATBIB_AUTHORYEAR);
+ translator.addPair("natbib", ENGINE_NATBIB);
translator.addPair("jurabib", ENGINE_JURABIB);
return translator;
}
}
+typedef Translator<string, CiteEngineType> CiteEngineTypeTranslator;
+
+
+CiteEngineTypeTranslator const init_citeenginetypetranslator()
+{
+ CiteEngineTypeTranslator translator("authoryear", ENGINE_TYPE_AUTHORYEAR);
+ translator.addPair("numerical", ENGINE_TYPE_NUMERICAL);
+ return translator;
+}
+
+
+CiteEngineTypeTranslator const & citeenginetypetranslator()
+{
+ static CiteEngineTypeTranslator translator = init_citeenginetypetranslator();
+ return translator;
+}
+
+
// Spacing
typedef Translator<string, Spacing::Space> SpaceTranslator;
orientation = ORIENTATION_PORTRAIT;
use_geometry = false;
cite_engine_ = ENGINE_BASIC;
+ cite_engine_type_ = ENGINE_TYPE_NUMERICAL;
biblio_style = "plain";
use_bibtopic = false;
use_indices = false;
packages.push_back("amsmath");
packages.push_back("esint");
packages.push_back("mathdots");
+ packages.push_back("mathtools");
packages.push_back("mhchem");
packages.push_back("undertilde");
}
papersize = papersizetranslator().find(ppsize);
} else if (token == "\\use_geometry") {
lex >> use_geometry;
- } else if (token == "\\use_amsmath") {
- int use_ams;
- lex >> use_ams;
- use_package("amsmath", packagetranslator().find(use_ams));
- } else if (token == "\\use_esint") {
- int useesint;
- lex >> useesint;
- use_package("esint", packagetranslator().find(useesint));
- } else if (token == "\\use_mhchem") {
- int usemhchem;
- lex >> usemhchem;
- use_package("mhchem", packagetranslator().find(usemhchem));
- } else if (token == "\\use_mathdots") {
- int usemathdots;
- lex >> usemathdots;
- use_package("mathdots", packagetranslator().find(usemathdots));
- } else if (token == "\\use_undertilde") {
- int useundertilde;
- lex >> useundertilde;
- use_package("undertilde", packagetranslator().find(useundertilde));
+ } else if (token == "\\use_package") {
+ string package;
+ int use;
+ lex >> package;
+ lex >> use;
+ use_package(package, packagetranslator().find(use));
} else if (token == "\\cite_engine") {
string engine;
lex >> engine;
cite_engine_ = citeenginetranslator().find(engine);
+ } else if (token == "\\cite_engine_type") {
+ string engine_type;
+ lex >> engine_type;
+ cite_engine_type_ = citeenginetypetranslator().find(engine_type);
} else if (token == "\\biblio_style") {
lex.eatLine();
biblio_style = lex.getString();
pdfoptions().writeFile(os);
os << "\\papersize " << string_papersize[papersize]
- << "\n\\use_geometry " << convert<string>(use_geometry)
- << "\n\\use_amsmath " << use_package("amsmath")
- << "\n\\use_esint " << use_package("esint")
- << "\n\\use_mhchem " << use_package("mhchem")
- << "\n\\use_mathdots " << use_package("mathdots")
- << "\n\\use_undertilde " << use_package("undertilde")
- << "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
+ << "\n\\use_geometry " << convert<string>(use_geometry);
+ vector<string> const & packages = auto_packages();
+ for (size_t i = 0; i < packages.size(); ++i)
+ os << "\n\\use_package " << packages[i] << ' '
+ << use_package(packages[i]);
+ os << "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
+ << "\n\\cite_engine_type " << citeenginetypetranslator().find(cite_engine_type_)
<< "\n\\biblio_style " << biblio_style
<< "\n\\use_bibtopic " << convert<string>(use_bibtopic)
<< "\n\\use_indices " << convert<string>(use_indices)
{
string result;
+ // If the class loads the geometry package, we do not know which
+ // paper size is used, since we do not set it (bug 7013).
+ // Therefore we must not specify any argument here.
+ // dvips gets the correct paper size via DVI specials in this case
+ // (if the class uses the geometry package correctly).
+ if (documentClass().provides("geometry"))
+ return result;
+
if (use_geometry
&& papersize == PAPER_CUSTOM
&& !lyxrc.print_paper_dimension_flag.empty()
{
// FIXME the class should provide the numerical/
// authoryear choice
- if (documentClass().provides("natbib")
- && cite_engine_ != ENGINE_NATBIB_NUMERICAL)
- return ENGINE_NATBIB_AUTHORYEAR;
+ if (documentClass().provides("natbib"))
+ return ENGINE_NATBIB;
return cite_engine_;
}