}
-bool Preamble::writeLyXHeader(ostream & os)
+bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
{
// translate from babel to LyX names
h_language = babel2lyx(h_language);
<< "\\begin_document\n"
<< "\\begin_header\n"
<< "\\textclass " << h_textclass << "\n";
- string const raw = h_preamble.str();
+ string const raw = subdoc ? empty_string() : h_preamble.str();
if (!raw.empty()) {
os << "\\begin_preamble\n";
for (string::size_type i = 0; i < raw.size(); ++i) {
<< authors_
<< "\\end_header\n\n"
<< "\\begin_body\n";
- // clear preamble for subdocuments
- h_preamble.str("");
return true;
}
void parse(Parser & p, std::string const & forceclass,
TeX2LyXDocClass & tc);
/// Writes the LyX file header from internal data
- bool writeLyXHeader(std::ostream & os);
+ bool writeLyXHeader(std::ostream & os, bool subdoc);
private:
///
for (; it != end; it++)
preamble.addModule(*it);
}
- if (!preamble.writeLyXHeader(os)) {
+ if (!preamble.writeLyXHeader(os, !active_environments.empty())) {
cerr << "Could write LyX file header." << endl;
return false;
}