]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathString.cpp
Natbib authoryear uses (Ref1; Ref2) by default.
[lyx.git] / src / mathed / InsetMathString.cpp
index d5b0d78864e9754c721c5b50956e9c147b998860..53aba589899135ca2131cb21841f310af8c56422 100644 (file)
@@ -91,10 +91,10 @@ void InsetMathString::octave(OctaveStream & os) const
 }
 
 
-void InsetMathString::mathmlize(MathStream & /*os*/) const
+void InsetMathString::mathmlize(MathStream &) const
 {
        // useless, no doubt, but we should not be here
-       LASSERT(false, /* */);
+       LATTEST(false);
 }
 
 
@@ -119,7 +119,9 @@ void InsetMathString::write(WriteStream & os) const
                char_type const c = *cit;
                docstring command(1, c);
                try {
-                       if (c < 0x80 || Encodings::latexMathChar(c, mathmode, os.encoding(), command)) {
+                       bool termination = false;
+                       if (isASCII(c) ||
+                           Encodings::latexMathChar(c, mathmode, os.encoding(), command, termination)) {
                                if (os.textMode()) {
                                        if (in_forced_mode) {
                                                // we were inside \lyxmathsym
@@ -127,12 +129,12 @@ void InsetMathString::write(WriteStream & os) const
                                                os.textMode(false);
                                                in_forced_mode = false;
                                        }
-                                       if (c >= 0x80 && os.textMode()) {
+                                       if (!isASCII(c) && os.textMode()) {
                                                os << "\\ensuremath{";
                                                os.textMode(false);
                                                in_forced_mode = true;
                                        }
-                               } else if (c < 0x80 && in_forced_mode) {
+                               } else if (isASCII(c) && in_forced_mode) {
                                        // we were inside \ensuremath
                                        os << '}';
                                        os.textMode(true);
@@ -152,10 +154,9 @@ void InsetMathString::write(WriteStream & os) const
                        os << command;
                        // We may need a space if the command contains a macro
                        // and the last char is ASCII.
-                       if (lyx::support::contains(command, '\\')
-                           && isAlphaASCII(command[command.size() - 1]))
+                       if (termination)
                                os.pendingSpace(true);
-               } catch (EncodingException & e) {
+               } catch (EncodingException const & e) {
                        switch (os.output()) {
                        case WriteStream::wsDryrun: {
                                os << "<" << _("LyX Warning: ")
@@ -166,7 +167,7 @@ void InsetMathString::write(WriteStream & os) const
                        }
                        case WriteStream::wsPreview: {
                                // indicate the encoding error by a boxed '?'
-                               os << "{\\fboxsep=1pt\\fbox{?}}";;
+                               os << "{\\fboxsep=1pt\\fbox{?}}";
                                LYXERR0("Uncodable character" << " '"
                                        << docstring(1, e.failed_char)
                                        << "'");