diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 69437bf2f5..c3f56e8986 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -494,7 +494,15 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, docstring & rem) tmp.resize(tmp.size() - 1); // If this is an exact match, we found a (longer) - // matching command in the unicodesymbols file + // matching entry in the unicodesymbols file. + // If the entry doesn't start with '\', we take note + // of the match and continue (this is not a ultimate + // acceptance, as some other entry may match a longer + // portion of the cmd string). However, if the entry + // does start with '\', we accept the match only if + // this is a valid macro, i.e., either it is a single + // (nonletter) char macro, or nothing else follows, + // or what follows is a nonletter char. if ((math == tmp || text == tmp) && (tmp[0] != '\\' || (tmp.size() == 2 && !isAlphaASCII(tmp[1]))