Note that there is not point to have an equation in a full math
    mode in a title (etc..). Only the inline formula mode is
    acceptable in a title (etc..).

This is precisely what you have in the document: A displayed equation as part of the title of the section. I agree that it's unclear why one would ever want to do this, but LaTeX does allow it, and so LyX allows it, too. Maybe if you had a really long equation that needed to be part of the title, you'd want to do it that way.

I do see the difference you are talking about now, though. In both cases, it looks like a displayed equation immediately follows the section title. However, in one case, it is actually part of the section title. In the other case, it is not, but is in a separate paragraph.

Here is the LaTeX output:

\section{This $$x=y&=$$}

One two

\section{That}

$$x=y$$ One two.

Note that I've simplified this a bit, to make it easier to see what's happening.

The result, in the PDF output, is that there is additional whitespace above the equation in the second case. This is LaTeX's doing, and has nothing to do with LyX itself. If you wanted to counteract this, then you'd have to put some negative vertical space in there somewhere.

See

https://tex.stackexchange.com/questions/763938/correct-way-to-reduce-space-above-displayed-equation-which-shows-right-below-sec

for the way to do this. It is not trivial.

The difference is not completely obvious in the LyX display. But if you look closely, you'll see that there is additional whitespace above the equation there as well. If you had pilcrows displayed, then it would be clearer. (Preferences> Display> Mark end of paragraphs)


On 8/3/26 2:37 PM, Patrick Dupre wrote:
I disagree, the management of the vertical spacing in lyx have been modified. You are right, latex manages this vertical spacing between the section title and the formula in displayed mode. Actually, if I remember correctly, there is a proper way to manage this spacing. Anyway, lyx has now the tendency to add newlines where it did not used to do it before.

If what you mean is that, *in the LyX display*, LyX shows additional space above a displayed formula, when such a formula begins a paragraph, then that may be correct. I do think this may have changed in the 2.5.x series. There was lots of work on this sort of thing for 2.5.0 (which I have just checked does the same thing as 2.5.1). But it would also correspond to what LaTeX does, so I would regard that as an improvement. Otherwise, there is no visual difference between the two cases mentioned.

All these behaviors are simply due to the fact that a displayed equation can either be part of the paragraph that precedes it or not. If it is, then changing the paragraph the text is in will of course affect the type of paragraph the equation is in. As it should.

In LaTeX, the difference is:

test
$$x=y$$ % part of same paragraph

test

$$x=y$$ % starts a new paragraph

You get more space in the latter case, even without any special paragraph type. Again, I think it may be correct that LyX *shows* more space in the latter case, whereas it did not do so before. And that would be intentional, and correct, as a way of indicating the difference visually.

File a bug report if you wish, and we can see what others think.

Riki

-- 
lyx-users mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to