]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetRef.cpp
Whitespace.
[lyx.git] / src / insets / InsetRef.cpp
index ef96101dc564f404c36476f76616fe7d5ec27a3c..49743ceea836ea460a01079c6fa88e6848a65352 100644 (file)
@@ -142,6 +142,9 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
        string const cmd = getCmdName();
        docstring const data = getEscapedLabel(rp);
 
+       if (rp.inulemcmd)
+               os << "\\mbox{";
+
        if (cmd == "eqref" && buffer().params().use_refstyle) {
                // we advertise this as printing "(n)", so we'll do that, at least
                // for refstyle, since refstlye's own \eqref prints, by default,
@@ -163,6 +166,9 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
                p["reference"] = ref;
                os << p.getCommand(rp);
        }
+
+       if (rp.inulemcmd)
+               os << "}";
 }
 
 
@@ -313,12 +319,13 @@ void InsetRef::validate(LaTeXFeatures & features) const
                string const fcmd = to_utf8(getFormattedCmd(data, label, prefix));
                if (buffer().params().use_refstyle) {
                        features.require("refstyle");
-                       if (!prefix.empty()) {
+                       if (prefix == "cha")
+                               features.addPreambleSnippet("\\let\\charef=\\chapref");
+                       else if (!prefix.empty()) {
                                string lcmd = "\\AtBeginDocument{\\providecommand" + 
                                                fcmd + "[1]{\\ref{" + to_utf8(prefix) + ":#1}}}";
                                features.addPreambleSnippet(lcmd);
-                       } else if (prefix == "cha")
-                               features.addPreambleSnippet("\\let\\charef=\\chapref");
+                       }
                } else {
                        features.require("prettyref");
                        // prettyref uses "cha" for chapters, so we provide a kind of