Import table cells in sideways environment.

This is a part of bug #8081: Translate cells in
\begin{sideways}...\end{sideways} to native syntax. The turn environment
comes in a later commit, since this one os suitable for backporting.
This commit is contained in:
Georg Baum 2012-05-06 18:47:53 +02:00
parent 7cfac958f2
commit c90e02ff0d
3 changed files with 30 additions and 5 deletions

View File

@ -173,9 +173,9 @@ const char * const known_xetex_packages[] = {"arabxetex", "fixlatvian",
/// packages that are automatically skipped if loaded by LyX
const char * const known_lyx_packages[] = {"amsbsy", "amsmath", "amssymb",
"amstext", "amsthm", "array", "booktabs", "calc",
"color", "float", "graphicx", "hhline", "ifthen", "longtable", "makeidx",
"multirow", "nomencl", "pdfpages", "rotfloat", "splitidx", "setspace",
"amstext", "amsthm", "array", "booktabs", "calc", "color", "float",
"graphicx", "hhline", "ifthen", "longtable", "makeidx", "multirow",
"nomencl", "pdfpages", "rotating", "rotfloat", "splitidx", "setspace",
"subscript", "textcomp", "ulem", "url", "varioref", "verbatim", "wrapfig", 0};
// codes used to remove packages that are loaded automatically by LyX.

View File

@ -1194,11 +1194,35 @@ void handle_tabular(Parser & p, ostream & os, string const & name,
for (size_t c = 1; c < colinfo.size(); ++c)
cellinfo[row][c].multi = CELL_PART_OF_MULTICOLUMN;
} else {
bool sideways = false;
if (p.next_token().cs() == "begin") {
p.pushPosition();
p.get_token();
string const env = p.getArg('{', '}');
if (env == "sideways") {
active_environments.push_back(env);
p.verbatimEnvironment(env);
active_environments.pop_back();
p.skip_spaces();
if (!p.good())
sideways = true;
}
p.popPosition();
}
cellinfo[row][col].leftlines = colinfo[col].leftlines;
cellinfo[row][col].rightlines = colinfo[col].rightlines;
cellinfo[row][col].align = colinfo[col].align;
ostringstream os;
parse_text_in_inset(p, os, FLAG_CELL, false, context);
if (sideways) {
cellinfo[row][col].rotate = 90;
p.get_token();
active_environments.push_back(p.getArg('{', '}'));
parse_text_in_inset(p, os, FLAG_END, false, context);
active_environments.pop_back();
preamble.registerAutomaticallyLoadedPackage("rotating");
} else {
parse_text_in_inset(p, os, FLAG_CELL, false, context);
}
cellinfo[row][col].content += os.str();
}
}

View File

@ -27,6 +27,7 @@
\usepackage{longtable}
\usepackage{xargs}
\usepackage{subscript}
\usepackage{rotating}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
@ -375,7 +376,7 @@ A table*:
\begin{tabular*} % some comment
{0.8\columnwidth}[b]{lr}
two\\
lonely&lines
lonely&\begin{sideways}lines\end{sideways}
\end{tabular*}
A booktabs table: