mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
Add automatic color package loading for listings
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.
This commit is contained in:
parent
75e809c023
commit
75ba5d3db5
@ -1037,7 +1037,7 @@ Listings
|
||||
|
||||
Inline:
|
||||
\begin_inset listings
|
||||
lstparams "language={C++}"
|
||||
lstparams "language={C++},keywordstyle={\color{green}}"
|
||||
inline true
|
||||
status collapsed
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user