mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
tex2lyx: also support rotated xltabulars
This commit is contained in:
parent
766eb3f02c
commit
20663fb3b8
@ -85,7 +85,7 @@ Context::Context(bool need_layout_,
|
||||
new_layout_allowed(true), merging_hyphens_allowed(true),
|
||||
textclass(textclass_),
|
||||
layout(layout_), parent_layout(parent_layout_),
|
||||
font(font_), rotlongtable(false)
|
||||
font(font_), tablerotation(0)
|
||||
{
|
||||
if (!layout)
|
||||
layout = &textclass.defaultLayout();
|
||||
|
@ -165,8 +165,8 @@ public:
|
||||
TeXFont font;
|
||||
/// font attributes of normal text
|
||||
static TeXFont normalfont;
|
||||
/// A rotated longtable
|
||||
bool rotlongtable;
|
||||
/// Table rotation angle
|
||||
int tablerotation;
|
||||
|
||||
private:
|
||||
void begin_layout(std::ostream & os, Layout const * const & l);
|
||||
|
@ -1416,13 +1416,10 @@ void handle_tabular(Parser & p, ostream & os, string const & name,
|
||||
|
||||
//cerr << "// output what we have\n";
|
||||
// output what we have
|
||||
string rotate = "0";
|
||||
if (is_long_tabular && context.rotlongtable)
|
||||
rotate = "90";
|
||||
os << "\n<lyxtabular version=\"3\" rows=\"" << rowinfo.size()
|
||||
<< "\" columns=\"" << colinfo.size() << "\">\n";
|
||||
os << "<features"
|
||||
<< write_attribute("rotate", rotate)
|
||||
<< write_attribute("rotate", context.tablerotation)
|
||||
<< write_attribute("booktabs", booktabs)
|
||||
<< write_attribute("islongtable", is_long_tabular);
|
||||
if (is_long_tabular) {
|
||||
|
@ -1968,16 +1968,17 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
p.get_token();
|
||||
p.get_token();
|
||||
string envname = p.getArg('{', '}');
|
||||
if (envname == "longtable") {
|
||||
if (envname == "longtable" || envname == "xltabular") {
|
||||
// Now we check if the longtable is the only content
|
||||
// of the landscape environment
|
||||
string const ltenv = envname;
|
||||
while (!found_end && !end_longtable && p.good()) {
|
||||
envname = p.next_token().cat() == catBegin
|
||||
? p.getArg('{', '}') : string();
|
||||
Token const & t = p.get_token();
|
||||
p.skip_spaces();
|
||||
end_longtable = t.asInput() != "\\end"
|
||||
&& envname == "longtable";
|
||||
&& envname == ltenv;
|
||||
found_end = t.asInput() == "\\end"
|
||||
&& envname == "landscape";
|
||||
}
|
||||
@ -1990,10 +1991,10 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
||||
if (only_longtable) {
|
||||
p.popPosition();
|
||||
p.skip_spaces();
|
||||
bool const save_rotlongtable = parent_context.rotlongtable;
|
||||
parent_context.rotlongtable = true;
|
||||
int const save_tablerotation = parent_context.tablerotation;
|
||||
parent_context.tablerotation = 90;
|
||||
parse_text(p, os, FLAG_END, outer, parent_context);
|
||||
parent_context.rotlongtable = save_rotlongtable;
|
||||
parent_context.tablerotation = save_tablerotation;
|
||||
p.skip_spaces();
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user