Author: uwestoehr
Date: Fri Oct 28 20:28:28 2011
New Revision: 40055
URL: http://www.lyx.org/trac/changeset/40055
Log:
backporting tex2lyx: the support for wrap floats
Modified:
lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt
lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp
lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/text.cpp
lyx-devel/branches/BRANCH_2_0_X/status.20x
Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt Fri Oct 28
20:00:56 2011 (r40054)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt Fri Oct 28
20:28:28 2011 (r40055)
@@ -26,15 +26,11 @@
269 listings.sty (inline, with args) InsetListings
270 \alert, \structure (beamer) layout
281 ? modules
-284 wrapfig.sty InsetWrap
-287 wrapfig.sty (optarg) InsetWrap
-290 wrapped tables InsetWrap
292 japanese japanese-plain
293 ? InsetInfo
309 \nocite InsetCitation
310 \nocite{*} InsetBibtex
316 subfig.sty (subfloats) InsetFloat
-317 floating placements InsetWrap
322 ? local layout
325 japanese one japanese language
326 PDFLaTeX for external insets InsetExternal
Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp Fri Oct 28
20:00:56 2011 (r40054)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp Fri Oct 28
20:28:28 2011 (r40055)
@@ -645,6 +645,9 @@
else if (name == "rotfloat")
; // ignore this
+ else if (name == "wrapfig")
+ ; // ignore this
+
else if (is_known(name, known_languages))
h_language = name;
Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/text.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/text.cpp Fri Oct 28
20:00:56 2011 (r40054)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/text.cpp Fri Oct 28
20:28:28 2011 (r40055)
@@ -1089,6 +1089,38 @@
p.skip_spaces();
}
+ else if (name == "wrapfigure" || name == "wraptable") {
+ // syntax is
\begin{wrapfigure}[lines]{placement}[overhang]{width}
+ eat_whitespace(p, os, parent_context, false);
+ parent_context.check_layout(os);
+ // default values
+ string lines = "0";
+ string overhang = "0col%";
+ // parse
+ if (p.hasOpt())
+ lines = p.getArg('[', ']');
+ string const placement = p.getArg('{', '}');
+ if (p.hasOpt())
+ overhang = p.getArg('[', ']');
+ string const width = p.getArg('{', '}');
+ // write
+ if (name == "wrapfigure")
+ begin_inset(os, "Wrap figure\n");
+ else
+ begin_inset(os, "Wrap table\n");
+ os << "lines " << lines
+ << "\nplacement " << placement
+ << "\noverhang " << lyx::translate_len(overhang)
+ << "\nwidth " << lyx::translate_len(width)
+ << "\nstatus open\n\n";
+ parse_text_in_inset(p, os, FLAG_END, outer, parent_context);
+ end_inset(os);
+ // We don't need really a new paragraph, but
+ // we must make sure that the next item gets a \begin_layout.
+ parent_context.new_paragraph(os);
+ p.skip_spaces();
+ }
+
else if (name == "minipage") {
eat_whitespace(p, os, parent_context, false);
parse_box(p, os, 0, FLAG_END, outer, parent_context, "", "",
name);
Modified: lyx-devel/branches/BRANCH_2_0_X/status.20x
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/status.20x Fri Oct 28 20:00:56 2011
(r40054)
+++ lyx-devel/branches/BRANCH_2_0_X/status.20x Fri Oct 28 20:28:28 2011
(r40055)
@@ -61,6 +61,8 @@
* Rotated floats (sidewaysfigure, sidewaystable).
+ * Wrapped floats (wrapfigure, wraptable) (bug 4378).
+
* Command \date{} in the preamble to suppress the date output.