# .cls and .sty files merging to create an appendix

I have a .tex file, actually it is from a certain layout of my university, and it comes with a .cls file of its own. And now I have to create an appendix section contains only some Matlab codes. I have found an example latex code for Matlab code and as I guessed there is a .sty file with it. Unfortunately as they have different document class, I could not merge them together. For example, in the .sty file the coder has defined \lstdefinelanguage{matlabfloz}, and in my main.tex file coud not recognize it.

Here is my question, do I have to define that language in the .cls file? Or there is some easier way without doing that?

(I tried to use \inputpdf command, I do not have any error message afterwards, but it does not appear in compiled pdf which is I did not understand.)

\documentclass{article}
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}
\appendix
\begin{document}
\begin{lstlisting}
for i = 1:3
if i >= 5 && a ~= b % literate programming replacement disp('cool'); % comment with some §\mcommentfont\LaTeX in it: $\mcommentfont\pi x^2$§ end [:,ind] = max(vec);
x_last = x(1,end) - 1;
v(end);
really really long really really long really really long really really long really really long line % blaaaaaaaa ylabel('Voltage (µV)');
end
\end{lstlisting}
\end{document}

• I do not recommend to change in the .cls-file. If I understand right your proiblem is that the command lstdefinelanguage is not defined. Have you included the listingspackage (\usepackage{listings}) beforte you use it? Apr 6, 2019 at 13:57
• Thanks for the answer. Yes I have included listings package. I guess the problem is mcode package. It gives an error such as "Package Listings Error: language matlabfloz undefined." However when I open mcode.sty file, I see a line \lstdefinelanguage{matlabfloz} in it.mcode.sty is normally does not exist in MiKTex installation files, so I added it myself manually. Apr 6, 2019 at 14:40
• Maybe this answer can help tex.stackexchange.com/a/214617/95544 Apr 6, 2019 at 14:49
• This is the code that I found for implementing the MATLAB codes. And it works errorless when I compile it seperately. However I need to add appendix in my own thesis.tex file which is started \documentclass[chaparabic,ceng,ms,12pt,oneandhalf]{metu}. here the {metu} stands for the {metu}.cls (I guess). I think I should change or add somethings in that {metu}.cls file. @David Carlisle Apr 6, 2019 at 15:27
• please don't add example code in comments, as you see it dies not really work, you can edit the question to add an example in a code block. I see no reason why you would need to change a class file. Apr 6, 2019 at 15:32