commit 9602ee7603228199297049c546851a39a115f3a4
Author: Richard Kimberly Heck <[email protected]>
Date:   Thu Oct 2 12:05:00 2025 -0400

    Do not output formatted reference definitions if there is
    no associated counter.
---
 src/LaTeXFeatures.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 30bb2db46f..aab9de2edb 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -2043,8 +2043,11 @@ string const LaTeXFeatures::getThmExtraDefinitions() 
const
        ostringstream tmp;
 
        for (auto const & thm : usedTheorems_) {
+               if (thm.counter == "none")
+                       continue;
+
                // Extra definitions for zref-clever
-               if (thm.counter != "none" && params_.xref_package == "zref" && 
isRequired("zref-clever")) {
+        if (params_.xref_package == "zref" && isRequired("zref-clever")) {
                        if (thm.counter.empty() && !thm.zrefname.empty() && 
thm.zrefname != "none")
                                tmp << "\\zcsetup{countertype={" << thm.name << 
"=" << thm.zrefname << "}}\n";
                        else if (!thm.counter.empty()) {
@@ -2062,7 +2065,7 @@ string const LaTeXFeatures::getThmExtraDefinitions() const
                        }
                }
                // cleveref
-               else if (thm.counter != "none" && !thm.counter.empty() && 
params_.xref_package == "cleveref" && isRequired("cleveref")) {
+        else if (!thm.counter.empty() && params_.xref_package == "cleveref" && 
isRequired("cleveref")) {
                        if (isAvailableAtLeastFrom("LaTeX", 2020, 10))
                                // we have hooks
                                tmp << "\\AddToHook{env/" << thm.name << 
"/begin}"
@@ -2075,7 +2078,7 @@ string const LaTeXFeatures::getThmExtraDefinitions() const
                        }
                }
                // and refstyle
-               else if (params_.xref_package == "refstyle" && 
isRequired("refstyle")) {
+        else if (!thm.counter.empty() && params_.xref_package == "refstyle" && 
isRequired("refstyle")) {
                        tmp << "\\newref{" << thm.refprefix << "}{\n"
                            << "        name      = \\RS" << thm.name << 
"txt,\n"
                            << "        names     = \\RS" << thm.name << 
"stxt,\n"
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to