diff --git a/src/tex2lyx/test/test-insets.lyx.lyx b/src/tex2lyx/test/test-insets.lyx.lyx index f103f3a596..deed8a7cdb 100644 --- a/src/tex2lyx/test/test-insets.lyx.lyx +++ b/src/tex2lyx/test/test-insets.lyx.lyx @@ -1037,7 +1037,7 @@ Listings Inline: \begin_inset listings -lstparams "language={C++}" +lstparams "language={C++},keywordstyle={\color{green}}" inline true status collapsed diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex index 508d19f827..78fb5f0751 100644 --- a/src/tex2lyx/test/test-insets.tex +++ b/src/tex2lyx/test/test-insets.tex @@ -181,7 +181,7 @@ parser test (escaped):\href{http://www.test.test}{a brace \} and another one \{ \section{Listings} -Inline: \lstinline[language={C++}]!int a=5;!\\ +Inline: \lstinline[language={C++},keywordstyle={\color{green}}]!int a=5;!\\ Float: \begin{lstlisting}[caption={Example Listing float},label={lst:Example-Listing},language=Python] diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 7f7603c198..88e10966e8 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -1154,6 +1154,8 @@ void parse_listings(Parser & p, ostream & os, Context & parent_context, bool in_ if (p.hasOpt()) { string arg = p.verbatimOption(); os << "lstparams " << '"' << arg << '"' << '\n'; + if (arg.find("\\color") != string::npos) + preamble.registerAutomaticallyLoadedPackage("color"); } if (in_line) os << "inline true\n";