Opened 17 years ago

Closed 17 years ago

#4993 closed defect (fixed)

LyX generates a spurious blank line before lists in generated LaTeX

Reported by: egagnon@… Owned by: lasgouttes
Priority: high Milestone: 1.6.0
Component: latex export Version: 1.5.5
Severity: normal Keywords:
Cc: j.spitzmueller@…, treblera@…

Description

LyX shouldn't issue an additional "\n" (in LaTeX) before a list. Actually, LyX
is quite inconsistent: it adds a blank line before a list, but does not add one
after the list. Yet, if you think about it, a list is much more likely to be
part of a preceding paragraph than a following one.

--- Begin Example ---
(LyX)

This is some Text.

  • A bullet item.
  • Another bullet item.

Here is some additional text.

(=> LaTeX)

This is some Text.

\begin{itemize}
\item A bullet item.
\item Another bullet item.
\end{itemize}
Here is some additional text.

--- End Example --

One would expect consistency: either Lyx considers lists as part of enclosing
paragraphs, or not. But, the current choice is the poorest of all: LyX considers
a list as part of the following paragraph.

Now:
1- Adding a blank line to generated LaTeX is easy using embedded LaTeX (ERT).
2- Removing a blank line from generated LaTeX is impossible.

So, the sensible solution seems for LyX to not add any blank line, as if a user
wants one, it is easy to do.

I guess that for most LyX users, such a change would not be noticed. Yet, for
the few of us that care about detailed semantics of our text (and LaTeX's
rendering of these semantics), it would allow us to express all of the
possibilities:
1- stand-alone list
2- part of preceding paragraph
3- part of following paragraph
4- in middle of paragraph

If some developer is willing to help me a little around LyX's code, I might be
willing to work on a patch for this. Without help, I don't have the time to try
understanding all of LyX's code base to locate the appropriate code to fix.

Attachments (2)

4993-2.diff (656 bytes ) - added by Juergen Spitzmueller 17 years ago.
another patch against 1.5.6svn
4993.diff (716 bytes ) - added by Juergen Spitzmueller 17 years ago.
patch against 1.5.6svn

Download all attachments as: .zip

Change History (21)

comment:1 by Juergen Spitzmueller, 17 years ago

Cc: j.spitzmueller@… added
Component: layoutlatex export
Keywords: patch added
op_sys: MacOS XAll

comment:2 by Juergen Spitzmueller, 17 years ago

rep_platform: MacintoshAll

comment:3 by lasgouttes, 17 years ago

I am surprised that the bug is not in bugzilla already. The bug has never been
fixed because we wanted to make up our mind between two breaks and no breaks.

Whatever solution is chosen, I think that it shall not be particular to lists, but
be the same for all environments. This is bound to change some spacings, though.
Whoever did the original blunder should be burnt as an expiatory, victim, and
then we will be free to break peopl's documents for their own good.

I propose to add empty lines after all environments, unless there is a vigorous
claim for handling with/without spaces (which could maybe be done according to
depth).

comment:4 by egagnon@…, 17 years ago

I disagree vigorously!

Empty lines should NOT be added, neither before, nor after all environments, as
there is NO WAY TO FIX IT if one desires otherwise. It is very easy to add a
blank line later using ERT (while, I repeat, it is infeasible to remove an blank
line with ERT).

Unless, of course, some additional GUI capability is added to chose between the
two. Yet, for a quick fix, the easiest is not to issue to blank lines. I guess
that few LyX users have cared, so far, about the underlying LaTeX semantics (or
maybe they hand-edited generated LaTeX code for fine tuning), so, I don't expect
that many will complain about the removal of a blank line before lists (and
other environments).

I repeat: one should be able to express through the GUI (using ERT or not) the
four cases:
1- stand-alone list
2- list part of preceding paragraph
3- list part of following paragraph
4- list in middle of paragraph

comment:5 by lasgouttes, 17 years ago

Now you know why it is not yet been fixed :)

It is very easy to add a blank line later using ERT (while, I repeat, it is
infeasible to remove an blank line with ERT).

I thought it was possible through a % in ERT at the end of a paragraph, I'll
have to check that. Anyway, relying on ERT is not an option.

The possibilities you mention make perfect sense, however the only reasonable
way to obtain them all with an easy GUI is to put the list in an inset. This is
not going to happen for 1.6 IMO.

So as an interim measure we could remove both blank lines (before/after).

comment:6 by Juergen Spitzmueller, 17 years ago

Personally, I would opt against adding a line after the list (since this would
break indendation in all my documents), but removing the line before the list
looks sensible to me (and I didn't come accross a noticable change yet).

(@Etienne: shouting does not make us acting faster)

by Juergen Spitzmueller, 17 years ago

Attachment: 4993.diff added

patch against 1.5.6svn

comment:7 by Juergen Spitzmueller, 17 years ago

attachments.isobsolete: 01

comment:8 by egagnon@…, 17 years ago

Juergen,

Ooops. I should have thanked you in the first place! Thank you for the patches.

I said "vigourously" only as a reference to Jean-Marc's "... unless there is a
vigorous claim ...". But I agree that I should have tried to write the text
differently.

Actually, you guys have reacted faster than I thought. I was looking for help
identifying the right file to modify to, at least, create a local patch on my
computer and try contribute it back.

Thanks again,

Etienne

comment:9 by egagnon@…, 17 years ago

For your information, I had tested the trailing "%" trick before submitting this
bug report, but (at least for me) it didn't make a difference with the following
blank line. It's like if it needed an additional "%" on the blank line itself,
which I couldn't add using ERT.

I am using tetex as underlying engine, "fink install tetex" (unstable) on OS X
10.5 Intel, and the LyX 1.5.5 universal binary image package downloaded off the
lyx.org web site.

comment:10 by Juergen Spitzmueller, 17 years ago

Etienne, could you test the patch in attachment 2654 and report back if it does
what you request?

comment:11 by lasgouttes, 17 years ago

The patch looks OK to me.

comment:12 by Juergen Spitzmueller, 17 years ago

OK, the I propose to commit it to trunk. I'm not sure what to do with branch.
What do you think?

comment:13 by egagnon@…, 17 years ago

Juergen,

I tested the patch compiling LyX as an X application, and it does exactly what I
was looking for. Thanks!

Etienne
PS: I hope to eventually succeed at compiling LyX as a standalone (no X)
application on OSX (no success so far)...

comment:14 by egagnon@…, 17 years ago

Personally, I would vote for adding it to both trunk and branch, as I wouldn't
mind having an official 1.5.x stable version with the fix (and not have to
manually compile every new 1.5.x version). :-)

comment:15 by egagnon@…, 17 years ago

Just wanted to report that Günter Milde suggested on the user mailing list to
add an empty paragraph using the -- Environment Separator -- Layout when one
needs to separate a list from a previous/following paragraph.

In other words, the proposed patch is actually sufficient for expressing all 4
cases (standalone list, embedded list, etc.) without using ERT. So, there
shouldn't be a need for additional GUI support. :-)

comment:16 by Juergen Spitzmueller, 17 years ago

Keywords: fixedintrunk added

comment:17 by Uwe Stöhr, 17 years ago

Keywords: patch removed
Milestone: 1.6.0

comment:18 by Juergen Spitzmueller, 17 years ago

Cc: treblera@… added

comment:19 by Juergen Spitzmueller, 17 years ago

* #5354 has been marked as a duplicate of this bug. *

comment:20 by Juergen Spitzmueller, 17 years ago

Keywords: fixedintrunk removed
Resolution: fixed
Status: newclosed

LyX 1.6.0 is released.

Note: See TracTickets for help on using tickets.