* 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 <config.h>
+#include "Preamble.h"
#include "tex2lyx.h"
#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)
{
}
+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()) {
//
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
t.cat() == catAlign ||
t.cat() == catActive ||
t.cat() == catParameter)
- os << t.character();
+ os << t.cs();
else if (t.cat() == catBegin) {
os << '{';
else if (t.cat() == catComment) {
if (!t.cs().empty())
- cerr << "Ignoring comment: " << t.asInput();
+ os << t.asInput();
else
// "%\n" combination
p.skip_spaces();
else if (t.cs() == "\"") {
string const name = p.verbatim_item();
- if (name == "a") os << 'ä';
- else if (name == "o") os << 'ö';
- else if (name == "u") os << 'ü';
- else if (name == "A") os << 'Ä';
- else if (name == "O") os << 'Ö';
- else if (name == "U") os << 'Ü';
+ if (name == "a") os << '\xe4';
+ else if (name == "o") os << '\xf6';
+ else if (name == "u") os << '\xfc';
+ else if (name == "A") os << '\xc4';
+ else if (name == "O") os << '\xd6';
+ else if (name == "U") os << '\xdc';
else os << "\"{" << name << "}";
}
else if (t.cs() == "ss")
- os << "ß";
+ os << "\xdf";
else if (t.cs() == "cr") {
// lyx can't handle \\cr
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();