void parse_environment(Parser & p, ostream & os, bool outer,
- Context & parent_context)
+ string & last_env, Context & parent_context)
{
Layout const * newlayout;
string const name = p.getArg('{', '}');
context.need_end_deeper = true;
}
parent_context.check_end_layout(os);
+ if (last_env == name) {
+ // we need to output a separator since LyX would export
+ // the two environments as one otherwise (bug 5716)
+ docstring const sep = from_ascii("--Separator--");
+ TeX2LyXDocClass const & textclass(parent_context.textclass);
+ if (LYX_FORMAT >= 273 && textclass.hasLayout(sep)) {
+ Context newcontext(parent_context);
+ newcontext.layout = &(textclass[sep]);
+ newcontext.check_layout(os);
+ newcontext.check_end_layout(os);
+ } else {
+ parent_context.check_layout(os);
+ begin_inset(os, "Note Note\n");
+ os << "status closed\n";
+ Context newcontext(true, textclass,
+ &(textclass.defaultLayout()));
+ newcontext.check_layout(os);
+ newcontext.check_end_layout(os);
+ end_inset(os);
+ parent_context.check_end_layout(os);
+ }
+ }
switch (context.layout->latextype) {
case LATEX_LIST_ENVIRONMENT:
context.add_par_extra_stuff("\\labelwidthstring "
parse_unknown_environment(p, name, os, FLAG_END, outer,
parent_context);
+ last_env = name;
active_environments.pop_back();
}
string bibliographystyle;
bool const use_natbib = used_packages.find("natbib") != used_packages.end();
bool const use_jurabib = used_packages.find("jurabib") != used_packages.end();
+ string last_env;
while (p.good()) {
Token const & t = p.get_token();
if (t.character() == '}' && (flags & FLAG_BRACE_LAST))
return;
+ // If there is anything between \end{env} and \begin{env} we
+ // don't need to output a separator.
+ if (t.cat() != catSpace && t.cat() != catNewline &&
+ t.asInput() != "\\begin")
+ last_env = "";
+
//
// cat codes
//
}
else if (t.cs() == "begin")
- parse_environment(p, os, outer, context);
+ parse_environment(p, os, outer, last_env, context);
else if (t.cs() == "end") {
if (flags & FLAG_END) {