#include "frontends/alert.h"
#include "insets/InsetListingsParams.h"
-#include "support/lyxalgo.h" // for lyx::count
#include "support/convert.h"
#include "support/Translator.h"
#include <boost/array.hpp>
+#include <algorithm>
#include <sstream>
+using std::count;
using std::endl;
using std::string;
using std::istringstream;
} else if (token == "\\listings_params") {
string par;
lex >> par;
- // validate par and produce a valid listings parameter string
- try {
- listings_params = InsetListingsParams(par).params();
- } catch (invalidParam & e) {
- lyxerr << "Invalid parameter string " << par << endl;
- lyxerr << e.what() << endl;
- listings_params = string();
- }
+ listings_params = InsetListingsParams(par).params();
} else if (token == "\\papersides") {
int psides;
lex >> psides;
AuthorList::Authors::const_iterator a_it = pimpl_->authorlist.begin();
AuthorList::Authors::const_iterator a_end = pimpl_->authorlist.end();
for (; a_it != a_end; ++a_it) {
- os << "\\author " << a_it->second << "\n";
+ if (a_it->second.used())
+ os << "\\author " << a_it->second << "\n";
+ else
+ os << "\\author " << Author() << "\n";
}
}
if (fontsDefaultFamily != "default")
os << "\\renewcommand{\\familydefault}{\\"
<< from_ascii(fontsDefaultFamily) << "}\n";
+
+ // set font encoding
// this one is not per buffer
+ // for arabic_arabi and farsi we also need to load the LAE and LFE encoding
if (lyxrc.fontenc != "default") {
- os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
- << "]{fontenc}\n";
- texrow.newline();
+ if (language->lang() == "arabic_arabi" || language->lang() == "farsi") {
+ os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
+ << ",LFE,LAE]{fontenc}\n";
+ texrow.newline();
+ } else {
+ os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
+ << "]{fontenc}\n";
+ texrow.newline();
+ }
}
// handle inputenc etc.
lyxpreamble += from_utf8(features.getBabelOptions());
}
- lyxpreamble += "\\makeatother\n";
+ lyxpreamble += "\\makeatother\n\n";
int const nlines =
- int(lyx::count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
+ int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
for (int j = 0; j != nlines; ++j) {
texrow.newline();
}
texrow.newline();
}
} else if (inputenc != "default") {
- switch (language->encoding()->package()) {
+ switch (encoding().package()) {
case Encoding::none:
break;
case Encoding::inputenc: