X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftex2lyx%2Fmath.cpp;h=9fddeea16c7536cd32f0fecf49098c446686d087;hb=237193f8a888777192981136469a5d4febb8e9d8;hp=e5ba486957a34f680e1674611c44195b26b3c204;hpb=9383f4c3c6f9cfab2d658701ba66e2b54cd68bea;p=lyx.git diff --git a/src/tex2lyx/math.cpp b/src/tex2lyx/math.cpp index e5ba486957..9fddeea16c 100644 --- a/src/tex2lyx/math.cpp +++ b/src/tex2lyx/math.cpp @@ -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. */ @@ -12,6 +12,7 @@ #include +#include "Preamble.h" #include "tex2lyx.h" #include @@ -27,6 +28,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()) { @@ -58,7 +69,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 @@ -94,7 +105,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 << '{'; @@ -110,7 +121,7 @@ void parse_math(Parser & p, ostream & os, unsigned flags, const mode_type mode) else if (t.cat() == catComment) { if (!t.cs().empty()) - cerr << "Ignoring comment: " << t.asInput(); + os << t.asInput(); else // "%\n" combination p.skip_spaces(); @@ -221,6 +232,16 @@ void parse_math(Parser & p, ostream & os, unsigned flags, const mode_type mode) os << "\\\\"; } + else if (t.cs() == "vref" || t.cs() == "vpageref") { + os << t.asInput(); + preamble.registerAutomaticallyLoadedPackage("varioref"); + } + + else if (t.cs() == "textipa") { + os << t.asInput(); + preamble.registerAutomaticallyLoadedPackage("tipa"); + } + else os << t.asInput();