// Cite engine
-typedef Translator<string, biblio::CiteEngine> CiteEngineTranslator;
+typedef Translator<string, CiteEngine> CiteEngineTranslator;
CiteEngineTranslator const init_citeenginetranslator()
{
- CiteEngineTranslator translator("basic", biblio::ENGINE_BASIC);
- translator.addPair("natbib_numerical", biblio::ENGINE_NATBIB_NUMERICAL);
- translator.addPair("natbib_authoryear", biblio::ENGINE_NATBIB_AUTHORYEAR);
- translator.addPair("jurabib", biblio::ENGINE_JURABIB);
+ CiteEngineTranslator translator("basic", ENGINE_BASIC);
+ translator.addPair("natbib_numerical", ENGINE_NATBIB_NUMERICAL);
+ translator.addPair("natbib_authoryear", ENGINE_NATBIB_AUTHORYEAR);
+ translator.addPair("jurabib", ENGINE_JURABIB);
return translator;
}
AuthorList authorlist;
BranchList branchlist;
- vector<string> extraEmbeddedFiles;
Bullet temp_bullets[4];
Bullet user_defined_bullets[4];
Spacing spacing;
BufferParams::Impl *
BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr)
{
- BOOST_ASSERT(ptr);
+ LASSERT(ptr, /**/);
return new BufferParams::Impl(*ptr);
}
use_geometry = false;
use_amsmath = package_auto;
use_esint = package_auto;
- cite_engine_ = biblio::ENGINE_BASIC;
+ cite_engine_ = ENGINE_BASIC;
use_bibtopic = false;
trackChanges = false;
outputChanges = false;
listings_params = string();
pagestyle = "default";
compressed = false;
- embedded = lyxrc.use_bundled_format;
for (int iter = 0; iter < 4; ++iter) {
user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
temp_bullet(iter) = ITEMIZE_DEFAULTS[iter];
docstring BufferParams::B_(string const & l10n) const
{
- BOOST_ASSERT(language);
+ LASSERT(language, /**/);
return getMessages(language->code()).get(l10n);
}
}
-vector<string> & BufferParams::extraEmbeddedFiles()
-{
- return pimpl_->extraEmbeddedFiles;
-}
-
-
-vector<string> const & BufferParams::extraEmbeddedFiles() const
-{
- return pimpl_->extraEmbeddedFiles;
-}
-
-
BranchList & BufferParams::branchlist()
{
return pimpl_->branchlist;
Bullet & BufferParams::temp_bullet(lyx::size_type const index)
{
- BOOST_ASSERT(index < 4);
+ LASSERT(index < 4, /**/);
return pimpl_->temp_bullets[index];
}
Bullet const & BufferParams::temp_bullet(lyx::size_type const index) const
{
- BOOST_ASSERT(index < 4);
+ LASSERT(index < 4, /**/);
return pimpl_->temp_bullets[index];
}
Bullet & BufferParams::user_defined_bullet(lyx::size_type const index)
{
- BOOST_ASSERT(index < 4);
+ LASSERT(index < 4, /**/);
return pimpl_->user_defined_bullets[index];
}
Bullet const & BufferParams::user_defined_bullet(lyx::size_type const index) const
{
- BOOST_ASSERT(index < 4);
+ LASSERT(index < 4, /**/);
return pimpl_->user_defined_bullets[index];
}
string BufferParams::readToken(Lexer & lex, string const & token,
- FileName const & filepath, FileName const & temppath)
+ FileName const & filepath)
{
if (token == "\\textclass") {
lex.next();
// NOTE: in this case, the textclass (.cls file) is assumed to be available.
string tcp;
LayoutFileList & bcl = LayoutFileList::get();
- if (!temppath.empty())
- tcp = bcl.addLayoutFile(classname, temppath.absFilename(), LayoutFileList::Embedded);
if (tcp.empty() && !filepath.empty())
tcp = bcl.addLayoutFile(classname, filepath.absFilename(), LayoutFileList::Local);
if (!tcp.empty())
toktmp << endl;
return toktmp;
}
- } else if (token == "\\extra_embedded_files") {
- extraEmbeddedFiles().clear();
- string par;
- lex >> par;
- string tmp;
- par = split(par, tmp, ',');
- while (!tmp.empty()) {
- extraEmbeddedFiles().push_back(tmp);
- par = split(par, tmp, ',');
- }
} else {
lyxerr << "BufferParams::readToken(): Unknown token: " <<
token << endl;
else
os << "\\author " << Author() << "\n";
}
-
- vector<string>::const_iterator e_it = extraEmbeddedFiles().begin();
- vector<string>::const_iterator e_end = extraEmbeddedFiles().end();
- os << "\\extra_embedded_files \"";
- bool first = true;
- for (; e_it != e_end; ++e_it) {
- if (!first)
- os << ",";
- else
- first = false;
- os << *e_it;
- }
- os << "\"\n";
}
// http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129417.html
size_t viet = language_options.str().find("vietnam");
// viet = string::npos when not found
+ // when Japanese is used, babel must directly be loaded with the
+ // language options, not in the class options, see
+ // http://bugzilla.lyx.org/show_bug.cgi?id=4597#c4
+ size_t japan = language_options.str().find("japanese");
+ // japan = string::npos when not found
if (lyxrc.language_global_options && !language_options.str().empty()
- && viet == string::npos)
+ && viet == string::npos && japan == string::npos)
clsoptions << language_options.str() << ',';
}
lyxpreamble += from_utf8(features.getBabelOptions());
}
- // When the language "japanese-plain" is used, the package "japanese" must
- // be loaded behind babel (it provides babel support for Japanese) but before
- // hyperref, see
- // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html
- if (language->lang() == "japanese-plain" &&
- !documentClass().provides("japanese")) {
- //load babel in case it was not loaded due to an empty language list
- if (language_options.str().empty())
- lyxpreamble += "\\usepackage{babel}\n";
- lyxpreamble += "\\usepackage{japanese}\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,
lyxpreamble += oss.str();
}
- // this might be useful...
- lyxpreamble += "\n\\makeatletter\n";
+ // only add \makeatletter and \makeatother when actually needed
+ bool makeatletter = false;
// Some macros LyX will need
docstring tmppreamble(from_ascii(features.getMacros()));
if (!tmppreamble.empty()) {
+ if (!makeatletter) {
+ lyxpreamble += "\n\\makeatletter\n";
+ makeatletter = true;
+ }
lyxpreamble += "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
"LyX specific LaTeX commands.\n"
+ tmppreamble + '\n';
// the text class specific preamble
tmppreamble = features.getTClassPreamble();
if (!tmppreamble.empty()) {
+ if (!makeatletter) {
+ lyxpreamble += "\n\\makeatletter\n";
+ makeatletter = true;
+ }
lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
"Textclass specific LaTeX commands.\n"
+ tmppreamble + '\n';
/* the user-defined preamble */
if (!preamble.empty()) {
+ if (!makeatletter) {
+ lyxpreamble += "\n\\makeatletter\n";
+ makeatletter = true;
+ }
// FIXME UNICODE
lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
"User specified LaTeX commands.\n"
}
}
- if (!bullets_def.empty())
+ if (!bullets_def.empty()) {
+ if (!makeatletter) {
+ lyxpreamble += "\n\\makeatletter\n";
+ makeatletter = true;
+ }
lyxpreamble += bullets_def + "}\n\n";
+ }
- lyxpreamble += "\\makeatother\n\n";
+ if (makeatletter)
+ lyxpreamble += "\\makeatother\n\n";
int const nlines =
int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
"probably need to reconfigure LyX.\n"), from_utf8(modName));
frontend::Alert::warning(_("Module not available"),
msg + _("Some layouts may not be available."));
- lyxerr << "BufferParams::makeDocumentClass(): Module " <<
- modName << " requested but not found in module list." <<
- endl;
+ LYXERR0("BufferParams::makeDocumentClass(): Module " <<
+ modName << " requested but not found in module list.");
continue;
}
if (!lm->isAvailable()) {
{
LayoutModuleList::const_iterator it = layoutModules_.begin();
LayoutModuleList::const_iterator end = layoutModules_.end();
- for (; it != end; it++) {
+ for (; it != end; it++)
if (*it == modName)
- break;
- }
- if (it != layoutModules_.end())
- return false;
+ return false;
layoutModules_.push_back(modName);
return true;
}
if (test == tmptok) {
graphicsDriver = tmptok;
break;
- } else if (test == "") {
+ }
+ if (test.empty()) {
lex.printError(
"Warning: graphics driver `$$Token' not recognized!\n"
" Setting graphics driver to `default'.\n");
// http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129417.html
size_t viet = lang_opts.find("vietnam");
// viet = string::npos when not found
- if (!lyxrc.language_global_options || viet != string::npos)
+ // when Japanese is used, babel must directly be loaded with the
+ // language options, see
+ // http://bugzilla.lyx.org/show_bug.cgi?id=4597#c4
+ size_t japan = lang_opts.find("japanese");
+ // japan = string::npos when not found
+ if (!lyxrc.language_global_options || viet != string::npos || japan != string::npos)
return "\\usepackage[" + lang_opts + "]{babel}";
return lang_pack;
}
}
-biblio::CiteEngine BufferParams::citeEngine() const
+CiteEngine BufferParams::citeEngine() const
{
// FIXME the class should provide the numerical/
// authoryear choice
if (documentClass().provides("natbib")
- && cite_engine_ != biblio::ENGINE_NATBIB_NUMERICAL)
- return biblio::ENGINE_NATBIB_AUTHORYEAR;
+ && cite_engine_ != ENGINE_NATBIB_NUMERICAL)
+ return ENGINE_NATBIB_AUTHORYEAR;
return cite_engine_;
}
-void BufferParams::setCiteEngine(biblio::CiteEngine cite_engine)
+void BufferParams::setCiteEngine(CiteEngine cite_engine)
{
cite_engine_ = cite_engine;
}