- ParagraphList::const_iterator par = pit;
- do {
- TeXOnePar(buf, text, par, os, texrow, runparams);
- if (par != paragraphs.end())
- par++;
-
- if (par == paragraphs.end()) {
- // Make sure that the last paragraph is
- // correctly terminated (because TeXOnePar does
- // not add a \n in this case)
- os << '\n';
- texrow.newline();
- } else if (par->params().depth() > pit->params().depth()) {
- if (par->layout().isParagraph()) {
- // Thinko!
- // How to handle this? (Lgb)
- //&& !suffixIs(os, "\n\n")
-
- // There should be at least one '\n' already
- // but we need there to be two for Standard
- // paragraphs that are depth-increment'ed to be
- // output correctly. However, tables can
- // also be paragraphs so don't adjust them.
- // ARRae
- // Thinkee:
- // Will it ever harm to have one '\n' too
- // many? i.e. that we sometimes will have
- // three in a row. (Lgb)
- os << '\n';
- texrow.newline();
- }
-
- LYXERR(Debug::LATEX, "TeXDeeper... " << &*par);
- bool const force_plain_layout = text.inset().forcePlainLayout();
- depth_type const max_depth = par->params().depth();
-
- // FIXME: move that to a for loop!
- while (par != paragraphs.end()
- && par->params().depth() == max_depth) {
- // FIXME This test should not be necessary.
- // We should perhaps issue an error if it is.
- Layout const & style = force_plain_layout
- ? buf.params().documentClass().plainLayout() : par->layout();
- if (style.isEnvironment()) {
- // Recursive call to TeXEnvironment!
- par = TeXEnvironment(buf, text, par, os, texrow, runparams);
- } else {
- TeXOnePar(buf, text, par, os, texrow, runparams);
- if (par != text.paragraphs().end())
- par++;
- }
- }
- LYXERR(Debug::LATEX, "TeXDeeper...done ");
- }
-
- } while (par != paragraphs.end()
- && par->layout() == pit->layout()
- && par->params().depth() == pit->params().depth()
- && par->params().leftIndent() == pit->params().leftIndent());