I'm using Doxygen to generate PDF document. So I need also make use of LaTeX. I generated the default LaTeX style file, i.e. the doxygen.sty. I want to use the latex package listings to make the code block (wrapped by Doxygen commands @code
and @endcode
) look better, but when I made changes to this part, LaTeX errosr would appear and no PDF file can be output successfully. Am I wrong somewhere? What's the correct way to add new style in the doxygen.sty
? Thanks in advance!
Below are default content in doxygen.sty
:
% Used by @code ... @endcode
\newenvironment{DoxyCode}{%
\par%
\scriptsize%
\begin{alltt}%
}{%
\end{alltt}%
\normalsize%
}
Below are changes I made for the DoxyCode
environment:
\RequirePackage{listings}
\RequirePackage[table]{xcolor}
...
% Used by @code ... @endcode
\newenvironment{DoxyCode}{%
\par%
\lstset{numbers=left,numberstyle=\tiny}%
\scriptsize%
\begin{lstlisting}[language=C]%
}{%
\end{lstlisting}%
\normalsize%
}