[LyX/master] Amend 2d2d22682
Juergen Spitzmueller <[email protected]> Sat, 25 Apr 2026 11:05:26 +0000
| Newsgroups | gmane.editors.lyx.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 3c01ce65c4daec7e5faad2e97c304a2c1257c518 Author: Juergen Spitzmueller <[email protected]> Date: Sat Apr 25 13:04:56 2026 +0200 Amend 2d2d22682 map is sorted, which we do not want here --- src/LaTeXFeatures.cpp | 23 ++++++++++++++++++----- src/LaTeXFeatures.h | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index cc61cc5f59..69341eaf9c 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -698,8 +698,21 @@ void LaTeXFeatures::useLayout(docstring const & layoutname, int level) thm.style = layout.thmStyle(); thm.zrefname = layout.thmZRefName(); thm.refprefix = to_ascii(layout.refprefix); - usedTheorems_[thm.name] = thm; - require("amsthm"); + // check if this theorem has already + // been defined. If so, overwrite the + // existing definition + bool thm_exists = false; + for (auto & av_thm : usedTheorems_) { + if (av_thm.name == thm.name) { + av_thm = thm; + thm_exists = true; + break; + } + } + if (!thm_exists) { + usedTheorems_.push_back(thm); + require("amsthm"); + } } usedLayouts_.push_back(layoutname); } else { @@ -2041,8 +2054,8 @@ string const LaTeXFeatures::getThmDefinitions() const ostringstream tmp; string laststyle; - for (auto const & [name, thm] : usedTheorems_) { - if (isProvided("newtheorem:" + name)) + for (auto const & thm : usedTheorems_) { + if (isProvided("newtheorem:" + thm.name)) continue; if (thm.style != laststyle) { tmp << "\\theoremstyle{" << thm.style << "}\n"; @@ -2073,7 +2086,7 @@ string const LaTeXFeatures::getThmExtraDefinitions() const { ostringstream tmp; - for (auto const & [name, thm] : usedTheorems_) { + for (auto const & thm : usedTheorems_) { if (thm.counter == "none" || !refPrefixUsed(from_ascii(thm.refprefix))) continue; diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index 2e5b61db79..acbfaba62c 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -263,7 +263,7 @@ private: /// UsedFloats usedFloats_; /// - std::map<std::string, ThmInfo> usedTheorems_; + std::list<ThmInfo> usedTheorems_; /// std::set<docstring> usedRefPrefixes_; /// -- lyx-cvs mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-cvs