]> git.lyx.org Git - features.git/commitdiff
Fix bug 9798.
authorRichard Heck <rgheck@lyx.org>
Sat, 7 Apr 2018 02:29:04 +0000 (22:29 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 4 Oct 2018 18:04:48 +0000 (14:04 -0400)
Nameref support for math references.

src/frontends/qt4/GuiRef.cpp
src/mathed/InsetMathRef.cpp
src/mathed/MathParser.cpp

index 6ccb8ef6c46ec49710113598110af68e8a242b27..5d46a471c710bb980c0c062085c8f3a480d405b5 100644 (file)
@@ -328,9 +328,9 @@ void GuiRef::updateContents()
        typeCO->addItem(qt_("<page>"), "pageref");
        typeCO->addItem(qt_("on page <page>"), "vpageref");
        typeCO->addItem(qt_("<reference> on page <page>"), "vref");
+       typeCO->addItem(qt_("Textual reference"), "nameref");
        if (bufferview()->cursor().inTexted()) {
                typeCO->addItem(qt_("Formatted reference"), "formatted");
-               typeCO->addItem(qt_("Textual reference"), "nameref");
                typeCO->addItem(qt_("Label only"), "labelonly");
        } else
                typeCO->addItem(qt_("Formatted reference"), "prettyref");
index 42151209e733d43ca222b926c2a58d078f8ad37f..97591dc7d2943f03d209e2d119b840dee9d44756 100644 (file)
@@ -168,6 +168,8 @@ void InsetMathRef::validate(LaTeXFeatures & features) const
                features.require("prettyref");
        else if (commandname() == "eqref")
                features.require("amsmath");
+       else if (commandname() == "nameref")
+               features.require("nameref");
 }
 
 
@@ -243,6 +245,7 @@ InsetMathRef::ref_type_info InsetMathRef::types[] = {
        { from_ascii("vpageref"),  from_ascii(N_("Textual Page Number")),   from_ascii(N_("TextPage: "))},
        { from_ascii("vref"),      from_ascii(N_("Standard+Textual Page")), from_ascii(N_("Ref+Text: "))},
        { from_ascii("prettyref"), from_ascii(N_("PrettyRef")),             from_ascii(N_("FormatRef: "))},
+       { from_ascii("nameref"),   from_ascii(N_("Reference to Name")),     from_ascii(N_("NameRef: "))},
        { from_ascii(""), from_ascii(""), from_ascii("") }
 };
 
index 9a2275d91348b48e684f44ec3f5c4f400f1dd331..21bdb66dee838b6ea96457209666d9f0bb3c5eaf 100644 (file)
@@ -1552,7 +1552,8 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                }
 
                else if (t.cs() == "ref" || t.cs() == "eqref" || t.cs() == "prettyref"
-                         || t.cs() == "pageref" || t.cs() == "vpageref" || t.cs() == "vref") {
+                         || t.cs() == "nameref" || t.cs() == "pageref"
+                         || t.cs() == "vpageref" || t.cs() == "vref") {
                        cell->push_back(MathAtom(new InsetMathRef(buf, t.cs())));
                        docstring const opt = parse_verbatim_option();
                        docstring const ref = parse_verbatim_item();