This is already in master. OK?
Jürgen
diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt index c33b4964b9..fa2bd7aca7 100644 --- a/src/tex2lyx/TODO.txt +++ b/src/tex2lyx/TODO.txt @@ -25,7 +25,6 @@ Format LaTeX feature LyX feature % !BIB program = comment understood by some TeX editors 358 custom makeindex command \index_command -363 horizontal longtable alignment InsetTabular 364 branch file name suffix \filename_suffix 371 automatic mhchem loading \use_mhchem 390 forward/reverse search \forward_search, \forward_macro diff --git a/src/tex2lyx/table.cpp b/src/tex2lyx/table.cpp index a3cabfd20c..d3392b0077 100644 --- a/src/tex2lyx/table.cpp +++ b/src/tex2lyx/table.cpp @@ -847,7 +847,8 @@ void handle_hline_below(RowInfo & ri, vector<CellInfo> & ci) void handle_tabular(Parser & p, ostream & os, string const & name, - string const & tabularwidth, Context & context) + string const & tabularwidth, string const & halign, + Context & context) { bool const is_long_tabular(name == "longtable"); bool booktabs = false; @@ -1417,6 +1418,8 @@ void handle_tabular(Parser & p, ostream & os, string const & name, << write_attribute("lastFootTopDL", endlastfoot.topDL) << write_attribute("lastFootBottomDL", endlastfoot.bottomDL) << write_attribute("lastFootEmpty", endlastfoot.empty); + if (!halign.empty()) + os << write_attribute("longtabularalignment", halign); } else os << write_attribute("tabularvalignment", tabularvalignment) << write_attribute("tabularwidth", tabularwidth); diff --git a/src/tex2lyx/tex2lyx.h b/src/tex2lyx/tex2lyx.h index 1791c2f414..968e157270 100644 --- a/src/tex2lyx/tex2lyx.h +++ b/src/tex2lyx/tex2lyx.h @@ -81,7 +81,8 @@ void parse_math(Parser & p, std::ostream & os, unsigned flags, mode_type mode); /// in table.cpp void handle_tabular(Parser & p, std::ostream & os, std::string const & name, - std::string const & width, Context & context); + std::string const & width, std::string const & halign, + Context & context); /// in tex2lyx.cpp diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index b85020d457..85e2462e3e 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -1638,13 +1638,23 @@ void parse_environment(Parser & p, ostream & os, bool outer, else if (unstarred_name == "tabular" || name == "longtable") { eat_whitespace(p, os, parent_context, false); string width = "0pt"; + string halign; + if (name == "longtable" && p.hasOpt()) { + string const opt = p.getArg('[', ']'); + if (opt == "c") + halign = "center"; + else if (opt == "l") + halign = "left"; + else if (opt == "r") + halign = "right"; + } if (name == "tabular*") { width = lyx::translate_len(p.getArg('{', '}')); eat_whitespace(p, os, parent_context, false); } parent_context.check_layout(os); begin_inset(os, "Tabular "); - handle_tabular(p, os, name, width, parent_context); + handle_tabular(p, os, name, width, halign, parent_context); end_inset(os); p.skip_spaces(); }
signature.asc
Description: This is a digitally signed message part