commit 77e25b9f56f154c8363ebe0ecf591a7c6e7d4711
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sat May 17 18:07:30 2025 +0200

    Avoid unnecessary preamble code with refprefix
---
 src/insets/InsetRef.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index 970d5a5c9e..f0a1ba3bb5 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -895,7 +895,8 @@ void InsetRef::validate(LaTeXFeatures & features) const
                                
features.addPreambleSnippet(from_ascii("\\let\\charef=\\chapref"));
                        else if (prefix == "subsec")
                                features.require("refstyle:subsecref");
-                       else if (!prefix.empty()) {
+                       else if (!prefix.empty() && 
!buffer().masterParams().documentClass().hasRefPrefix(prefix)) {
+                               // fallback command for unknown prefixes
                                docstring lcmd = 
"\\AtBeginDocument{\\providecommand" +
                                                fcmd + "[1]{\\ref{" + prefix + 
":#1}}}";
                                features.addPreambleSnippet(lcmd);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to