From c9f68139cb24fbe938052f2befee8a08770ec4de Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 6 May 2012 16:46:06 +0200 Subject: [PATCH] Do not swallow math comments in tex2lyx. This is not needed, since LyX supports comments in math. Data loss with math comments containing a backslash in LyX has been fixed as well. The test case was found in bug #8104. --- src/mathed/MathParser.cpp | 2 +- src/tex2lyx/math.cpp | 2 +- src/tex2lyx/test/test-insets.tex | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp index df71694320..9752320095 100644 --- a/src/mathed/MathParser.cpp +++ b/src/mathed/MathParser.cpp @@ -1018,7 +1018,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags, Token const & t = getToken(); if (t.cat() == catNewline) break; - s += t.asString(); + s += t.asInput(); } cell->push_back(MathAtom(new InsetMathComment(buf, s))); skipSpaces(); diff --git a/src/tex2lyx/math.cpp b/src/tex2lyx/math.cpp index 1a8158b5a2..83e21013cc 100644 --- a/src/tex2lyx/math.cpp +++ b/src/tex2lyx/math.cpp @@ -121,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(); diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex index b30050dc4a..30ecd0f395 100644 --- a/src/tex2lyx/test/test-insets.tex +++ b/src/tex2lyx/test/test-insets.tex @@ -535,6 +535,15 @@ builtin \textasciicircum % with a comment A sub\textsubscript{sc\emph{ript}} and super\textsuperscript{script with $a^2+b^2=c^2$ math}. +\section{Mathematics\index{Mathematics}} + +Let $f:\left[ a,b\right] \rightarrow% +%TCIMACRO{\U{211d} }% +%BeginExpansion +\mathbb{R} +%EndExpansion +$. + \printindex{} \printnomenclature hello -- 2.39.2