The listings inset does automatically load the color package if any parameter
contains \color. As mentioned in bug #8066 tex2lyx needs to be aware of this,
so the \usepckage{color} is automatically skipped in these cases.
Inline:
\begin_inset listings
-lstparams "language={C++}"
+lstparams "language={C++},keywordstyle={\color{green}}"
inline true
status collapsed
\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]
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";