tex2lyx: support for beamer text styles with overlays

E.g. things like \textbf<article>{foo} have to be imported as insets.

Part of #11068

(cherry picked from commit c74e399981)
This commit is contained in:
Juergen Spitzmueller 2018-03-14 14:38:18 +01:00
parent 7c816488b6
commit 42863eac92
3 changed files with 10 additions and 7 deletions

View File

@ -453,7 +453,7 @@ bool Parser::good()
}
bool Parser::hasOpt()
bool Parser::hasOpt(string const l)
{
// An optional argument can occur in any of the following forms:
// - \foo[bar]
@ -479,7 +479,7 @@ bool Parser::hasOpt()
putback();
break;
}
bool const retval = (next_token().asInput() == "[");
bool const retval = (next_token().asInput() == l);
pos_ = oldpos;
return retval;
}

View File

@ -214,7 +214,7 @@ public:
void dump() const;
/// Does an optional argument follow after the current token?
bool hasOpt();
bool hasOpt(std::string const l = "[");
///
typedef std::pair<bool, std::string> Arg;
/*!

View File

@ -3627,14 +3627,16 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
continue;
}
if ((where = is_known(t.cs(), known_text_font_series))) {
// beamer has a \textbf<overlay>{} inset
if (!p.hasOpt("<") && (where = is_known(t.cs(), known_text_font_series))) {
parse_text_attributes(p, os, FLAG_ITEM, outer,
context, "\\series", context.font.series,
known_coded_font_series[where - known_text_font_series]);
continue;
}
if ((where = is_known(t.cs(), known_text_font_shapes))) {
// beamer has a \textit<overlay>{} inset
if (!p.hasOpt("<") && (where = is_known(t.cs(), known_text_font_shapes))) {
parse_text_attributes(p, os, FLAG_ITEM, outer,
context, "\\shape", context.font.shape,
known_coded_font_shapes[where - known_text_font_shapes]);
@ -3713,9 +3715,10 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
continue;
}
if (t.cs() == "uuline" || t.cs() == "uwave"
// beamer has an \emph<overlay>{} inset
if ((t.cs() == "uuline" || t.cs() == "uwave"
|| t.cs() == "emph" || t.cs() == "noun"
|| t.cs() == "xout") {
|| t.cs() == "xout") && !p.hasOpt("<")) {
context.check_layout(os);
os << "\n\\" << t.cs() << " on\n";
parse_text_snippet(p, os, FLAG_ITEM, outer, context);