I am wondering how one is supposed to format Objective C code using the listings
package of LaTeX? I know that the language supports C (Objective) , so how do i set this in the \lstset
language
option?
Thanks
I am wondering how one is supposed to format Objective C code using the listings
package of LaTeX? I know that the language supports C (Objective) , so how do i set this in the \lstset
language
option?
Thanks
Like this:
\documentclass{article}
\usepackage{listings}
\begin{document}
\lstset{language=[Objective]C, breakindent=40pt, breaklines}
\begin{lstlisting}
@interface classname : superclassname {
// instance variables
}
+classMethod1;
+(return_type)classMethod2;
+(return_type)classMethod3:(param1_type)param1_varName;
-(return_type)instanceMethod1:(param1_type)param1_varName :(param2_type)param2_varName;
-(return_type)instanceMethod2WithParameter:(param1_type)param1_varName andOtherParameter:(param2_type)param2_varName;
@end
\end{lstlisting}
\end{document}
Detailed introduction: http://mirror.hmc.edu/ctan/macros/latex/contrib/listings/listings.pdf