commit 5d8bfddeece35f46f4ed53c2626d9ffbf2cb5f73
Author: Juergen Spitzmueller <[email protected]>
Date:   Thu Jul 17 16:57:21 2025 +0200

    Fix (more: work around) missing pretty counter in subequations module 
(#13199)
---
 src/insets/InsetFlex.cpp  |  1 +
 src/insets/InsetLabel.cpp | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp
index 8f7a0274d6..e4a79370e6 100644
--- a/src/insets/InsetFlex.cpp
+++ b/src/insets/InsetFlex.cpp
@@ -159,6 +159,7 @@ void InsetFlex::updateBuffer(ParIterator const & it, 
UpdateType utype, bool cons
        }
 
        // Special case for `subequations' module.
+       // FIXME: replace with a genuine solution long-term!
        if (il.latextype() == InsetLaTeXType::ENVIRONMENT &&
            il.latexname() == "subequations") {
                docstring equation(from_ascii("equation"));
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index 5380d1f70f..cf89a72004 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -201,7 +201,8 @@ void InsetLabel::updateBuffer(ParIterator const & it, 
UpdateType, bool const /*d
        active_counter_ = cnts.currentCounter();
        Language const * lang = it->getParLanguage(buffer().params());
        if (lang && !active_counter_.empty()) {
-               if (active_counter_ != from_ascii("equation")) {
+               bool const equation = active_counter_ == from_ascii("equation");
+               if (!equation || it.inTexted()) {
                        counter_value_ = cnts.theCounter(active_counter_, 
lang->code());
                        pretty_counter_ = cnts.prettyCounter(active_counter_, 
lang->code());
                        docstring pretty_counter_pl = 
cnts.prettyCounter(active_counter_, lang->code(), false, true);
@@ -221,6 +222,14 @@ void InsetLabel::updateBuffer(ParIterator const & it, 
UpdateType, bool const /*d
                                formatted_counter_lc_ = 
cnts.formattedCounter(active_counter_, prex, lang->code(), true);
                                formatted_counter_lc_pl_ = 
cnts.formattedCounter(active_counter_, prex, lang->code(), true, true);
                        }
+                       if (equation) {
+                               // FIXME: special code just for the 
subequations module (#13199)
+                               //        replace with a genuine solution 
long-term!
+                               formatted_counter_ = "(" + 
trim(formatted_counter_, "?") + ")";
+                               formatted_counter_pl_ = "(" + 
trim(formatted_counter_pl_, "?") + ")";
+                               formatted_counter_lc_ = "(" + 
trim(formatted_counter_lc_, "?") + ")";
+                               formatted_counter_lc_pl_ = "(" + 
trim(formatted_counter_lc_pl_, "?") + ")";
+                       }
                } else {
                        // For equations, the counter value and pretty counter
                        // value will be set by the parent InsetMathHull.
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to