commit d844bfbd8cb6cb04e531fa9f81c162b39f1d452e
Author: Juergen Spitzmueller <[email protected]>
Date:   Sun Apr 27 13:22:42 2025 +0200

    Some more ref support in math
    
    This now also uses zref or cleveref. Some features are not
    supported:
    
    * caps
    * plural
    * ranges
    * nolink
    * \cpageref
    
    vref and vpageref always use varioref, not zref-vario
---
 src/mathed/InsetMathRef.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mathed/InsetMathRef.cpp b/src/mathed/InsetMathRef.cpp
index 565f27bd6d..c129209516 100644
--- a/src/mathed/InsetMathRef.cpp
+++ b/src/mathed/InsetMathRef.cpp
@@ -216,8 +216,10 @@ void InsetMathRef::validate(LaTeXFeatures & features) const
        else if (commandname() == "formatted") {
                if (use_refstyle)
                        features.require("refstyle");
-               else if (buffer().masterParams().xref_package == "cleveref")
+               else if (buffer_ && buffer().masterParams().xref_package == 
"cleveref")
                        features.require("cleveref");
+               else if (buffer_ && buffer().masterParams().xref_package == 
"zref")
+                       features.require("zref-clever");
                else
                        features.require("prettyref");
        }
@@ -325,7 +327,7 @@ void InsetMathRef::write(TeXMathStream & os) const
                os << '(' << from_ascii("\\ref{") << cell(0) << 
from_ascii("})");
        }
        else if (cmd == "formatted") {
-               if (!use_refstyle)
+               if (buffer_ && buffer().params().xref_package == "prettyref")
                        os << "\\prettyref{" << cell(0) << "}";
                else {
                        odocstringstream ods;
@@ -336,8 +338,8 @@ void InsetMathRef::write(TeXMathStream & os) const
                        docstring const ref = ods.str();
 
                        /*
-                       At the moment, the 'plural' and 'caps' options will
-                       not work here. The reason is that we handle these as
+                       At the moment, the 'plural', 'nolink' and 'caps' 
options will
+                       not work here. Also ranges. The reason is that we 
handle these as
                        'internal' LyX argumemts, but those are not handled by
                        InsetCommandParams::getCommand, which is what is used
                        in createInsetMath_fromDialogStr to interpret the data
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to