Significant .lyx EOL White Space Inquiry
Richard Kimberly Heck
rikiheck at lyx.org
Mon Dec 14 19:00:39 UTC 2020
On 12/14/20 1:54 PM, José Abílio Matos wrote:
>
> On Monday, December 14, 2020 5:46:52 PM WET Richard Kimberly Heck wrote:
>
> > I think that the real reason that we use this scheme is due to how we
>
> > represent insets in the file format, we always change line.
>
> >
>
> > That is what IMO forbids the equivalence between spaces and newlines
> in the
>
> > lyx file format.
>
> >
>
> >
>
> > If we find a solution for the previous questions this can be
> implemented in
>
> > lyx2lyx.
>
> >
>
> > The obvious thing to do would be always to break lines at spaces.
> But then
>
> > how do we handle the case of languages that don't use spaces to separate
>
> > words?
>
>
> One simple example to illustrate what I mean, even assuming that the
> space is our word separator. What should be the file format of the
> latex paragraph?
>
>
> The most famous equation of all times is $E=mc^2.$
>
>
>
> How do we represent the space between "is" and the math inset?
>
>
>
> Now we do (pardon me the markdown syntax :-) ):
>
>
> ``` lyx
>
> \begin_layout Standard
>
> The most famous equation of all times is
>
> \begin_inset Formula $E=mc^{2}.$
>
> \end_inset
>
>
>
> \end_layout
>
> ```
>
>
> What would be the alternative? To have a space before the
> \begin_layout? That does not seem right and it would complicate our
> parsing a lot.
>
>
> The option I am thinking, although a bit ugly, would be:
>
>
> ``` lyx
>
> \begin_layout Standard
>
> The most famous equation of all times is
>
> \space
>
> \begin_inset Formula $E=mc^{2}.$
>
> \end_inset
>
>
>
> \end_layout
>
> ```
>
>
> That would mean that we have a special syntax for a line with a single
> space.
>
I hadn't considered this case. It will also occur, of course, with
footnotes and, indeed, every kind of inset. I can't think of any
reasonable alternative to your solution. We could presumably write
\space at the end of the previous line, but I think that would be harder
to implement. The lyx2lyx part would actually be quite simple. The
changes to the parser, and to the write routines, would be more involved.
Riki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201214/68e6a9d9/attachment.html>
More information about the lyx-devel
mailing list