def to_latex_code;
raw_code = self.raw_code
if get_setting(:latex_use_listings)
@doc.latex_require_package('listings')
s = "\\lstset{columns=fixed,frame=shadowbox}"
if get_setting(:code_show_spaces)
s+= "\\lstset{showspaces=true,showtabs=true}\n"
else
s+= "\\lstset{showspaces=false,showtabs=false}\n"
end
color = latex_color get_setting(:code_background_color)
s+= "\\lstset{backgroundcolor=#{color}}\n"
s+= "\\lstset{basicstyle=\\ttfamily\\footnotesize}\n"
lang = self.attributes[:lang] || @doc.attributes[:code_lang] || '{}'
if lang
s += "\\lstset{language=#{lang}}\n"
end
"#{s}\n\\begin{lstlisting}\n#{raw_code}\n\\end{lstlisting}"
else
"\\begin{verbatim}#{raw_code}\\end{verbatim}\n"
end
end