tex2lyx: Add support for horizontal longtabular alignment

This commit is contained in:
Juergen Spitzmueller 2018-09-10 16:21:42 +02:00
parent bc55ae0220
commit b1e5663333
5 changed files with 19 additions and 4 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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();
}

View File

@ -37,6 +37,8 @@ What's new
- Improve import of titling commands other than \maketitle (bug 6461).
- Add support for horizontal longtabular alignment.
* USER INTERFACE