[LyX/master] Avoid spurious requirements

Enrico Forestieri forenr at lyx.org
Tue Sep 8 23:11:26 UTC 2020


commit fcd14df2306e0ee33c525da7997446c30c8dacd2
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Wed Sep 9 01:32:51 2020 +0200

    Avoid spurious requirements
    
    The macros defined in the symbols file are only used for on-screen
    representation, so that their definition should not require the use
    on any latex package. Their definition should be taken into account
    only when they are overridden by user macros with same name.
---
 src/mathed/InsetMathMacro.cpp |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index bf363b6..5743dd0 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -967,7 +967,16 @@ void InsetMathMacro::validate(LaTeXFeatures & features) const
 
 	// validate the cells and the definition
 	if (displayMode() == DISPLAY_NORMAL) {
-		d->definition_.validate(features);
+		// Don't update requirements if the macro comes from
+		// the symbols file and has not been redefined.
+		MathWordList const & words = mathedWordList();
+		MathWordList::const_iterator it = words.find(name());
+		MacroNameSet macros;
+		buffer().listMacroNames(macros);
+		if (it == words.end() || it->second.inset != "macro"
+		    || macros.find(name()) != macros.end()) {
+			d->definition_.validate(features);
+		}
 		InsetMathNest::validate(features);
 	}
 }


More information about the lyx-cvs mailing list