The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 7cfac958f255002eaadb7875b3ddf3bbc73f9f90 Author: Georg Baum <[email protected]> Date: Sun May 6 17:37:09 2012 +0200 Do not swallow newlines after \usepackage. diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index fa93a2a..5dbd9f3 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -172,7 +172,8 @@ const char * const known_xetex_packages[] = {"arabxetex", "fixlatvian", "xeCJK", "xecolor", "xecyr", "xeindex", "xepersian", "xunicode", 0}; /// packages that are automatically skipped if loaded by LyX -const char * const known_lyx_packages[] = {"array", "booktabs", "calc", +const char * const known_lyx_packages[] = {"amsbsy", "amsmath", "amssymb", +"amstext", "amsthm", "array", "booktabs", "calc", "color", "float", "graphicx", "hhline", "ifthen", "longtable", "makeidx", "multirow", "nomencl", "pdfpages", "rotfloat", "splitidx", "setspace", "subscript", "textcomp", "ulem", "url", "varioref", "verbatim", "wrapfig", 0}; @@ -773,10 +774,10 @@ void Preamble::handle_package(Parser &p, string const & name, else if (!in_lyx_preamble) { if (options.empty()) - h_preamble << "\\usepackage{" << name << "}"; + h_preamble << "\\usepackage{" << name << "}\n"; else { h_preamble << "\\usepackage[" << opts << "]{" - << name << "}"; + << name << "}\n"; options.clear(); } } @@ -844,6 +845,12 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc) registerAutomaticallyLoadedPackage("float"); if (h_spacing != "single" && h_spacing != "default") registerAutomaticallyLoadedPackage("setspace"); + if (h_use_packages["amsmath"] == "2") { + // amsbsy and amstext are already provided by amsmath + registerAutomaticallyLoadedPackage("amsbsy"); + registerAutomaticallyLoadedPackage("amstext"); + registerAutomaticallyLoadedPackage("amssymb"); + } // output the LyX file settings os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n" commit c9f68139cb24fbe938052f2befee8a08770ec4de Author: Georg Baum <[email protected]> Date: Sun May 6 16:46:06 2012 +0200 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. diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp index df71694..9752320 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 1a8158b..83e2101 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 b30050d..30ecd0f 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 ----------------------------------------------------------------------- Summary of changes: src/mathed/MathParser.cpp | 2 +- src/tex2lyx/Preamble.cpp | 13 ++++++++++--- src/tex2lyx/math.cpp | 2 +- src/tex2lyx/test/test-insets.tex | 9 +++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) hooks/post-receive -- The LyX Source Repository
