#include "LyXRC.h"
#include "OutputParams.h"
#include "Spacing.h"
+#include "texstream.h"
#include "TexRow.h"
#include "VSpace.h"
#include "PDFOptions.h"
fonts_math[1] = "auto";
fonts_default_family = "default";
useNonTeXFonts = false;
+ use_microtype = false;
fonts_expert_sc = false;
fonts_old_figures = false;
fonts_sans_scale[0] = 100;
lex >> fonts_typewriter_scale[1];
} else if (token == "\\font_cjk") {
lex >> fonts_cjk;
+ } else if (token == "\\use_microtype") {
+ lex >> use_microtype;
} else if (token == "\\paragraph_separation") {
string parsep;
lex >> parsep;
if (!fonts_cjk.empty()) {
os << "\\font_cjk " << fonts_cjk << '\n';
}
+ os << "\\use_microtype " << convert<string>(use_microtype) << '\n';
os << "\\graphics " << graphics_driver << '\n';
os << "\\default_output_format " << default_output_format << '\n';
os << "\\output_sync " << output_sync << '\n';
if (useNonTeXFonts && fontsMath() != "auto")
features.require("unicode-math");
+
+ if (use_microtype)
+ features.require("microtype");
if (!language->requires().empty())
features.require(language->requires());
os << from_ascii(ams);
if (useNonTeXFonts) {
- os << "\\usepackage{fontspec}\n";
+ if (!features.isProvided("fontspec"))
+ os << "\\usepackage{fontspec}\n";
if (features.mustProvide("unicode-math")
&& features.isAvailable("unicode-math"))
os << "\\usepackage{unicode-math}\n";
// Now insert the LyX specific LaTeX commands...
docstring lyxpreamble;
features.resolveAlternatives();
+ features.expandMultiples();
if (output_sync) {
if (!output_sync_macro.empty())
// koma's own caption commands are used instead of caption. We
// use \PassOptionsToPackage here because the user could have
// already loaded subfig in the preamble.
- if (features.isRequired("subfig")) {
+ if (features.mustProvide("subfig")) {
atlyxpreamble += "\\@ifundefined{showcaptionsetup}{}{%\n"
" \\PassOptionsToPackage{caption=false}{subfig}}\n"
"\\usepackage{subfig}\n";
}
if (features.isRequired("bicaption"))
lyxpreamble += "\\usepackage{bicaption}\n";
- if (!listings_params.empty() || features.isRequired("listings"))
+ if (!listings_params.empty() || features.mustProvide("listings"))
lyxpreamble += "\\usepackage{listings}\n";
if (!listings_params.empty()) {
lyxpreamble += "\\lstset{";
// xunicode needs to be loaded at least after amsmath, amssymb,
// esint and the other packages that provide special glyphs
+ // The package only supports XeTeX currently.
if (features.runparams().flavor == OutputParams::XETEX
&& useNonTeXFonts)
lyxpreamble += "\\usepackage{xunicode}\n";
DocumentClass const & BufferParams::documentClass() const
{
- return *doc_class_.get();
+ return *doc_class_;
}
string BufferParams::bufferFormat() const
{
- string format = documentClass().outputFormat();
- if (format == "latex") {
- if (useNonTeXFonts)
- return "xetex"; // actually "xetex or luatex"
- if (encoding().package() == Encoding::japanese)
- return "platex";
- }
- return format;
+ return documentClass().outputFormat();
}
// FIXME: Don't hardcode format names here, but use a flag
if (buffmt == "latex") {
- if (!useNonTeXFonts) {
- v.push_back("pdflatex");
- v.push_back("latex");
- }
- v.push_back("luatex");
- v.push_back("dviluatex");
- v.push_back("xetex");
- } else if (buffmt == "xetex") {
- v.push_back("xetex");
- // FIXME: need to test all languages (bug 8205)
- if (!language || !language->isPolyglossiaExclusive()) {
+ if (encoding().package() == Encoding::japanese)
+ v.push_back("platex");
+ else {
+ if (!useNonTeXFonts) {
+ v.push_back("pdflatex");
+ v.push_back("latex");
+ }
+ v.push_back("xetex");
v.push_back("luatex");
v.push_back("dviluatex");
}
// XeTeX/LuaTeX: (see also #9740)
// With Unicode fonts we use utf8-plain without encoding package.
// With TeX fonts, we cannot use utf8-plain, but "inputenc" fails.
- // XeTeX must use ASCII encoding, for LuaTeX, we load
- // "luainputenc" (see below).
+ // XeTeX must use ASCII encoding (see Buffer.cpp),
+ // for LuaTeX, we load "luainputenc" (see below).
if (useNonTeXFonts || features.runparams().flavor == OutputParams::XETEX)
return;