[LyX/master] Treat floats like environments for language tracking

Juergen Spitzmueller <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 4cafd220683c2bc2135928c910862bbcc972e9e9
Author: Juergen Spitzmueller <[email protected]>
Date:   Thu Mar 19 12:13:02 2026 +0100

    Treat floats like environments for language tracking
---
 src/output_latex.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index dd0ba5db88..4e49ccecad 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -1719,6 +1719,10 @@ void latexParagraphs(Buffer const & buf,
 	pit_type lastpit = pit;
 	DocumentClass const & tclass = bparams.documentClass();
 
+	// Floats nest languages like (other) environments
+	if (runparams.inFloat != OutputParams::NONFLOAT)
+		state->nest_level_ += 1;
+
 	// Did we already warn about inTitle layout mixing? (we only warn once)
 	bool gave_layout_warning = false;
 	for (; pit < runparams.par_end; ++pit) {
@@ -1905,6 +1909,10 @@ void latexParagraphs(Buffer const & buf,
 		os << "\\end{btUnit}\n";
 		runparams.openbtUnit = false;
 	}
+
+	// Decrease nesting level at the end of floats
+	if (runparams.inFloat != OutputParams::NONFLOAT)
+		state->nest_level_ -= 1;
 }
 
 // Switch the input encoding for some part(s) of the document.
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.