On Fri, May 16, 2014 at 03:49:48PM +0200, Enrico Forestieri wrote:
> commit 936773c4f71a795179ea63f2d5b6f521ef9d97f8
> Author: Enrico Forestieri <[email protected]>
> Date: Fri May 16 15:39:33 2014 +0200
>
> Adapt output to the on-screen representation.
>
> LyX assumes that a standard paragraph following an aligned one or
> a layout with NextNoIndent==false has to be indented on screen.
> This means that in the latex output a blank line has to follow.
> In this case there should be no problem as regards extra vertical
> space and it simpler and more elegant to simply uncheck "Indent
> Paragraph" in the Paragraph settings pane rather than changing
> the current logic and allowing to insert a parbreak separator.
Richard, the attached stripped down version of this patch is suitable for
the stable branch. It makes the example with a local layout attached to
http://www.mail-archive.com/[email protected]/msg98728.html
working.
I tested it by exporting to latex our manuals with and w/o the patch
and the latex exports turn out to be bit-by-bit identical.
--
Enrico
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 31211d1..1fd387c 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -198,8 +198,10 @@ static TeXEnvironmentData prepareEnvironment(Buffer const
& buf,
}
-static void finishEnvironment(otexstream & os, OutputParams const & runparams,
- TeXEnvironmentData const & data)
+static void finishEnvironment(Buffer const & buf, Text const & text,
+ pit_type nextpit, otexstream & os,
+ OutputParams const & runparams,
+ TeXEnvironmentData const & data)
{
if (open_encoding_ == CJK && data.cjk_nested) {
// We need to close the encoding even if it does not change
@@ -227,6 +229,14 @@ static void finishEnvironment(otexstream & os,
OutputParams const & runparams,
os <<
setEncoding(data.prev_encoding->iconvName());
}
}
+
+ // Check whether we should output a blank line after the environment
+ DocumentClass const & tclass = buf.params().documentClass();
+ ParagraphList const & pars = text.paragraphs();
+ bool next_style_is_default = (nextpit >= runparams.par_end) ? false
+ : tclass.isDefaultLayout(pars.constIterator(nextpit)->layout());
+ if (!data.style->nextnoindent && next_style_is_default)
+ os << '\n';
}
@@ -306,7 +316,7 @@ void TeXEnvironment(Buffer const & buf, Text const & text,
prepareEnvironment(buf, text, par, os, runparams);
// Recursive call to TeXEnvironment!
TeXEnvironment(buf, text, runparams, pit, os);
- finishEnvironment(os, runparams, data);
+ finishEnvironment(buf, text, pit + 1, os, runparams, data);
}
if (pit != runparams.par_end)
@@ -1142,7 +1152,7 @@ void latexParagraphs(Buffer const & buf,
prepareEnvironment(buf, text, par, os, runparams);
// pit can be changed in TeXEnvironment.
TeXEnvironment(buf, text, runparams, pit, os);
- finishEnvironment(os, runparams, data);
+ finishEnvironment(buf, text, pit + 1, os, runparams, data);
}
if (pit == runparams.par_end) {