From 58fde18a9f2a3c434918cb54e705181216745c27 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 19 Dec 2010 20:23:55 +0000 Subject: [PATCH] Increase tex2lyx output format to 319. 311: Nothing to do (tex2lyx produced already the new format, because it uses the current layout files. This is also a reason why it should not lag behind too much with the format.) 312: Nothing to do (empty lyx2lyx conversion) 313: Nothing to do (tex2lyx does not know about modules) 314-315: Nothing to do (empty lyx2lyx conversion) 316: Nothing to do (tex2lyx does not know subfigures) 317-318: Nothing to do (empty lyx2lyx conversion) 319: Convert horizontal spaces to new format (and convert some newly supported spaces) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36948 a592a061-630c-0410-9148-cb99ea01b6c8 --- .../test/box-color-size-space-align.tex | 16 ++++++++++++ src/tex2lyx/tex2lyx.h | 2 +- src/tex2lyx/text.cpp | 25 +++++++++---------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/tex2lyx/test/box-color-size-space-align.tex b/src/tex2lyx/test/box-color-size-space-align.tex index 17bdf06e04..c97ccc92f5 100644 --- a/src/tex2lyx/test/box-color-size-space-align.tex +++ b/src/tex2lyx/test/box-color-size-space-align.tex @@ -285,6 +285,12 @@ raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 raggedleft 2 Lines can have an hfill \hfill in the middle. Lines can have a protected hfill \hspace*{\fill} in the middle. +Lines can have a dotted fill \dotfill in the middle. +Lines can have a rule fill \hrulefill in the middle. +Lines can have a left arrow fill \leftarrowfill in the middle. +Lines can have a right arrow fill \rightarrowfill in the middle. +Lines can have a upbrace fill \upbracefill in the middle. +Lines can have a downbrace fill \downbracefill in the middle. Lines can have space \hspace{2cm} in the middle. Lines can have protected space \hspace*{2cm} in the middle. @@ -294,8 +300,18 @@ Interword\ a Thin\,a +Medium\:a + +Thick\;a + NegThin\negthinspace{}a +NegMed\negmedspace{}a + +NegThick\negthickspace{}a + +enspace\enspace{}a + enskip\enskip{}a quad\quad{}a diff --git a/src/tex2lyx/tex2lyx.h b/src/tex2lyx/tex2lyx.h index 7af46e40a9..ec88d582fd 100644 --- a/src/tex2lyx/tex2lyx.h +++ b/src/tex2lyx/tex2lyx.h @@ -114,7 +114,7 @@ extern CommandMap known_math_environments; /// extern bool noweb_mode; /// LyX format that is created by tex2lyx -int const LYX_FORMAT = 310; +int const LYX_FORMAT = 319; /// path of the master .tex file extern std::string getMasterFilePath(); diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 46d4b127fa..637a609197 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -192,12 +192,14 @@ char const * const known_tex_extensions[] = {"tex", 0}; /// spaces known by InsetSpace char const * const known_spaces[] = { " ", "space", ",", "thinspace", "quad", -"qquad", "enspace", "enskip", "negthinspace", 0}; +"qquad", "enspace", "enskip", "negthinspace", "hfill", "dotfill", "hrulefill", +"leftarrowfill", "rightarrowfill", "upbracefill", "downbracefill", 0}; /// the same as known_spaces with .lyx names char const * const known_coded_spaces[] = { "space{}", "space{}", "thinspace{}", "thinspace{}", "quad{}", "qquad{}", "enspace{}", "enskip{}", -"negthinspace{}", 0}; +"negthinspace{}", "hfill{}", "dotfill{}", "hrulefill{}", "leftarrowfill{}", +"rightarrowfill{}", "upbracefill{}", "downbracefill{}", 0}; /// splits "x=z, y=b" into a map and an ordered keyword vector @@ -710,7 +712,8 @@ void parse_box(Parser & p, ostream & os, unsigned flags, bool outer, p.skip_spaces(); // We add a protected space if something real follows if (p.good() && p.next_token().cat() != catComment) { - os << "\\InsetSpace ~\n"; + begin_inset(os, "Space ~\n"); + end_inset(os); } } #endif @@ -1453,8 +1456,10 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, if (t.character() == '~') { if (context.layout->free_spacing) os << ' '; - else - os << "\\InsetSpace ~\n"; + else { + begin_inset(os, "Space ~\n"); + end_inset(os); + } } else os << t.cs(); } @@ -1937,13 +1942,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, context); } - else if (t.cs() == "hfill") { - context.check_layout(os); - os << "\n\\hfill\n"; - skip_braces(p); - p.skip_spaces(); - } - else if (t.cs() == "makeindex" || t.cs() == "maketitle") { // FIXME: Somehow prevent title layouts if // "maketitle" was not found @@ -2677,9 +2675,10 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, else if (is_known(t.cs(), known_spaces)) { char const * const * where = is_known(t.cs(), known_spaces); context.check_layout(os); - os << "\\InsetSpace "; + begin_inset(os, "Space "); os << '\\' << known_coded_spaces[where - known_spaces] << '\n'; + end_inset(os); // LaTeX swallows whitespace after all spaces except // "\\,". We have to do that here, too, because LyX // adds "{}" which would make the spaces significant.