backporting tex2lyx: the support for wrap floats

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40055 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2011-10-28 18:28:28 +00:00
parent 57a0b232fd
commit 25ea525d9b
4 changed files with 37 additions and 4 deletions

View File

@ -26,15 +26,11 @@ Format LaTeX feature LyX feature
269 listings.sty (inline, with args) InsetListings 269 listings.sty (inline, with args) InsetListings
270 \alert, \structure (beamer) layout 270 \alert, \structure (beamer) layout
281 ? modules 281 ? modules
284 wrapfig.sty InsetWrap
287 wrapfig.sty (optarg) InsetWrap
290 wrapped tables InsetWrap
292 japanese japanese-plain 292 japanese japanese-plain
293 ? InsetInfo 293 ? InsetInfo
309 \nocite InsetCitation 309 \nocite InsetCitation
310 \nocite{*} InsetBibtex 310 \nocite{*} InsetBibtex
316 subfig.sty (subfloats) InsetFloat 316 subfig.sty (subfloats) InsetFloat
317 floating placements InsetWrap
322 ? local layout 322 ? local layout
325 japanese one japanese language 325 japanese one japanese language
326 PDFLaTeX for external insets InsetExternal 326 PDFLaTeX for external insets InsetExternal

View File

@ -645,6 +645,9 @@ void handle_package(Parser &p, string const & name, string const & opts,
else if (name == "rotfloat") else if (name == "rotfloat")
; // ignore this ; // ignore this
else if (name == "wrapfig")
; // ignore this
else if (is_known(name, known_languages)) else if (is_known(name, known_languages))
h_language = name; h_language = name;

View File

@ -1089,6 +1089,38 @@ void parse_environment(Parser & p, ostream & os, bool outer,
p.skip_spaces(); 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") { else if (name == "minipage") {
eat_whitespace(p, os, parent_context, false); eat_whitespace(p, os, parent_context, false);
parse_box(p, os, 0, FLAG_END, outer, parent_context, "", "", name); parse_box(p, os, 0, FLAG_END, outer, parent_context, "", "", name);

View File

@ -61,6 +61,8 @@ What's new
* Rotated floats (sidewaysfigure, sidewaystable). * Rotated floats (sidewaysfigure, sidewaystable).
* Wrapped floats (wrapfigure, wraptable) (bug 4378).
* Command \date{} in the preamble to suppress the date output. * Command \date{} in the preamble to suppress the date output.