]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/math.cpp
Fix bug #7668 (cosmetic whitespace issues)
[lyx.git] / src / tex2lyx / math.cpp
index 30af6a6cb2a42764e2af7c0b5dbd3878690e8d2f..d17d1d90174a5e11c01fd49a9318c14c5d7acbdd 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
 
 #include <iostream>
 
+using namespace std;
 
 namespace lyx {
 
-using std::cerr;
-using std::endl;
-
-using std::ostream;
-using std::string;
-
 
 bool is_math_env(string const & name)
 {
@@ -32,6 +27,16 @@ bool is_math_env(string const & name)
 }
 
 
+bool is_display_math_env(string const & name)
+{
+       CommandMap::const_iterator it = known_math_environments.find(name);
+       if (it != known_math_environments.end())
+               if (!it->second.empty())
+                       return it->second.back() == displaymath;
+       return false;
+}
+
+
 void parse_math(Parser & p, ostream & os, unsigned flags, const mode_type mode)
 {
        while (p.good()) {
@@ -63,7 +68,7 @@ void parse_math(Parser & p, ostream & os, unsigned flags, const mode_type mode)
                //
                if (t.cat() == catMath) {
                        if (mode == MATHTEXT_MODE) {
-                               // we are inside some text mode thingy, so opening new math is allowed
+                               // we are inside some text mode thing, so opening new math is allowed
                                Token const & n = p.get_token();
                                if (n.cat() == catMath) {
                                        // TeX's $$...$$ syntax for displayed math
@@ -99,7 +104,7 @@ void parse_math(Parser & p, ostream & os, unsigned flags, const mode_type mode)
                               t.cat() == catAlign ||
                               t.cat() == catActive ||
                               t.cat() == catParameter)
-                       os << t.character();
+                       os << t.cs();
 
                else if (t.cat() == catBegin) {
                        os << '{';