pit_type pit = runparams.par_begin;
// lastpit is for the language check after the loop.
pit_type lastpit = pit;
+ // variables used in the loop:
+ bool was_title = false;
+ bool already_title = false;
DocumentClass const & tclass = bparams.documentClass();
for (; pit < runparams.par_end; ++pit) {
tclass.plainLayout() : par->layout();
if (layout.intitle) {
- if (runparams.didTitle) {
+ if (already_title) {
LYXERR0("Error in latexParagraphs: You"
" should not mix title layouts"
" with normal ones.");
- } else if (!runparams.inTitle) {
- runparams.inTitle = true;
+ } else if (!was_title) {
+ was_title = true;
if (tclass.titletype() == TITLE_ENVIRONMENT) {
os << "\\begin{"
<< from_ascii(tclass.titlename())
texrow.newline();
}
}
- } else if (runparams.inTitle && !runparams.didTitle) {
+ } else if (was_title && !already_title) {
if (tclass.titletype() == TITLE_ENVIRONMENT) {
os << "\\end{" << from_ascii(tclass.titlename())
<< "}\n";
<< "\n";
}
texrow.newline();
- runparams.didTitle = true;
- runparams.inTitle = false;
+ already_title = true;
+ was_title = false;
}
}
// It might be that we only have a title in this document
- if (runparams.inTitle && !runparams.didTitle) {
+ if (was_title && !already_title) {
if (tclass.titletype() == TITLE_ENVIRONMENT) {
os << "\\end{" << from_ascii(tclass.titlename())
<< "}\n";