# Is there a side effect if we use listings.sty with chained styles?

Even though I have not detected the side effect, I am still worrying I might do a bad practice here.

Is there a hidden side effect when doing the following?

\documentclass[cmyk]{article}
\usepackage{xcolor}
\usepackage{listings}

\lstdefinestyle{Common}
{
language={[LaTeX]TeX},
linewidth=0.5\linewidth%
}

\lstdefinestyle{A}
{
style=Common,
backgroundcolor=\color{yellow!50}%
}

\lstdefinestyle{B}
{
style=Common,
backgroundcolor=\color{green!50}%
}

\begin{document}

\begin{lstlisting}[style=A]
This is \fbox{style A}.
\end{lstlisting}

\begin{lstlisting}[style=B]
This is \fbox{style B}.
\end{lstlisting}

\end{document}


• Why do you think it is not a good practice? My book explains LaTeX, PSTricks, and C#. They use some common attributes so I put the common attributes into a single style called Common. Each also has a set of unique attributes, so I define a separate style for it. – xport Jan 13 '11 at 10:59