commit c2c69f39849cfc4ffb78088b2ff7824a9af86f38
Author: Juergen Spitzmueller <[email protected]>
Date:   Tue May 6 08:17:02 2025 +0200

    Decouple theorem definitions from definitions for xref packages
    
    The former is now loaded again after amsthm has been loaded.
    This fixes an issue with Hebrew (see #7205)
---
 src/BufferParams.cpp  |  4 ++--
 src/LaTeXFeatures.cpp | 13 +++++++++++++
 src/LaTeXFeatures.h   |  2 ++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 3a82cb909a..3313be5d1a 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -3054,8 +3054,8 @@ bool BufferParams::writeLaTeX(otexstream & os, 
LaTeXFeatures & features,
                os << "{cleveref}\n";
        }
 
-       // theorem definitions
-       os << features.getThmDefinitions();
+       // package-specific theorem definitions
+       os << features.getThmExtraDefinitions();
 
        // Since menukeys uses catoptions, which does some heavy changes on 
key-value options,
        // it is recommended to load menukeys as the last package (even after 
hyperref)
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 48b010e661..c0084b665b 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -1969,7 +1969,17 @@ string const LaTeXFeatures::getThmDefinitions() const
                                tmp << "[" << thm.parent_counter << "]";
                }
                tmp << "\n";
+       }
+
+       return tmp.str();
+}
+
 
+string const LaTeXFeatures::getThmExtraDefinitions() const
+{
+       ostringstream tmp;
+
+       for (auto const & thm : usedTheorems_) {
                // Extra definitions for zref-clever
                if (thm.counter != "none" && params_.xref_package == "zref" && 
isRequired("zref-clever")) {
                        if (thm.counter.empty() && !thm.zrefname.empty() && 
thm.zrefname != "none")
@@ -2038,6 +2048,9 @@ string const LaTeXFeatures::loadAMSPackages() const
        if (mustProvide("amsthm"))
                tmp << "\\usepackage{amsthm}\n";
 
+       // theorem definitions
+       tmp << getThmDefinitions();
+
        if (mustProvide("amssymb")
            && params_.use_package("amssymb") != BufferParams::package_off)
                tmp << "\\usepackage{amssymb}\n";
diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h
index 55cb1b5ac1..2d6fce25ca 100644
--- a/src/LaTeXFeatures.h
+++ b/src/LaTeXFeatures.h
@@ -83,6 +83,8 @@ public:
        docstring const getBabelPostsettings() const;
        /// get theorem definitions
        std::string const getThmDefinitions() const;
+       /// get theorem extra (package specific) definitions
+       std::string const getThmExtraDefinitions() const;
        /// Load AMS packages when appropriate
        std::string const loadAMSPackages() const;
        /// The definitions needed by the document's textclass
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to