From 5f6332bf46d4a0b65dd352b3e12ec35f58b6dece Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 6 Apr 2018 22:29:04 -0400 Subject: [PATCH] Fix bug 9798. Nameref support for math references. --- src/frontends/qt4/GuiRef.cpp | 2 +- src/mathed/InsetMathRef.cpp | 3 +++ src/mathed/MathParser.cpp | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/GuiRef.cpp b/src/frontends/qt4/GuiRef.cpp index 6ccb8ef6c4..5d46a471c7 100644 --- a/src/frontends/qt4/GuiRef.cpp +++ b/src/frontends/qt4/GuiRef.cpp @@ -328,9 +328,9 @@ void GuiRef::updateContents() typeCO->addItem(qt_(""), "pageref"); typeCO->addItem(qt_("on page "), "vpageref"); typeCO->addItem(qt_(" on 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"); diff --git a/src/mathed/InsetMathRef.cpp b/src/mathed/InsetMathRef.cpp index 42151209e7..97591dc7d2 100644 --- a/src/mathed/InsetMathRef.cpp +++ b/src/mathed/InsetMathRef.cpp @@ -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("") } }; diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp index 9a2275d913..21bdb66dee 100644 --- a/src/mathed/MathParser.cpp +++ b/src/mathed/MathParser.cpp @@ -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(); -- 2.39.2