Re: from 2.5.0 to 2.5.1
Udi Fogiel via lyx-users <[email protected]>
| Newsgroups | gmane.editors.lyx.general |
|---|---|
| Message-ID | <LMOZfb72N6xLJMFW2upRGvm8wTfBdHUlh_37RR5CMcnoxyBicuNjhhqlk9H1qpkg_12lEGMxxxc8rXZITHH6NqgrqaTrJWmh8vrJH3Txw4c=@proton.me> |
On Thursday, August 6th, 2026 at 1:18 AM, Richard Kimberly Heck <[email protected]> wrote: > On 8/5/26 1:46 PM, Udi Fogiel wrote: > > On Wednesday, August 5th, 2026 at 7:35 PM, Richard Kimberly Heck via lyx-users <[email protected]> wrote: > > > >> There is > >> additional space above the displayed equation in the latter case. I take > >> it that this is in the inter-paragraph spacing. Please correct me if the > >> additional space is coming from somewhere else. But I get the same in > >> the latter case as if I'd written: > >> > >> test > >> > >> ~ > >> $$x=y$$ > >> > > [....] > > > > Since you used $ in vertical mode, LuaTeX started an indented paragraph, i.e. a paragraph with a hbox node, so LuaTeX does not discard it, but it is visually empty and might seem like a vertical space. > > > > You can see the difference with \noindent $$x=y$$. In this case there is no indent box in the paragraph, so LuaTeX will discard it. > > Indeed! And PDFLaTeX does the same thing. > > So that means that the OP's original problem can be solved by using "Do > not indent paragraph" under Edit> Paragraph Settings. Strangely enough, > this works even immediately following a section heading, when the > paragraph wouldn't be indented anyway. > > The attached demonstrates this. Note the extra space in the first case: > there's the empty line there. In the second (\noindent'ed) case, the > displayed equation appears at the same position as the text in the third. > The LyX document is a bit different from what you described earlier. In standard LaTeX, \[ is defined as \DeclareRobustCommand\[{% \relax\ifmmode \@badmath \else \ifvmode \nointerlineskip \makebox[.6\linewidth]{}% \fi $$% \fi } and since \makebox enters horizontal mode, $ is never encountered in vertical mode. Also section headings (which use \@tartsection) sometimes set \@afterindentfalse, and execute \@afterheading: \def\@afterheading{% \@nobreaktrue \everypar{% \if@nobreak \@nobreakfalse \clubpenalty \@M \if@afterindent \else {\setbox\z@\lastbox}% \fi \else \clubpenalty \@clubpenalty \everypar{}% \fi}} The main thing we care about is \setbox\z@\lastbox. If this is used in \everypar, the last box is the indent box (if present), so this code removes the indent even if \indent is used, or $ is encountered in vertical mode. So, in the first case in the LyX file, \[ is used in vertical mode, so \makebox enters horizontal mode, \@afterheading removes the indent, but the \makebox is adding an empty hbox node the the paragraph, thus the paragraph is not empty, and is not discarded when entering the displayed eqation. In the second case we have \noindent\[. \noindent enters horizontal mode without adding an indent (new_graph(false)), \@afterheading is still used, but there is no indent to remove anyway, and \[ is encountered in horizontal mode which means the \ifvmode branch is not used, so no empty hbox is added to the paragraph. When entering the displayed equation the paragraph above is empty, so it is discarded. Udi -- lyx-users mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-users