I'm writing the documentation to a large piece of Matlab code. I would like include tags in my Matlab code and then read the lines of code between the tags into Latex and output them as verbatim (or use some other form of code representation such as the lstlisting package).
I noticed that the catchfile package can help me with reading code as verbatim (as described here) and that the catchfilebetweentags package does essentially the other part of the job (as described in the answers to this question, yet I'm still struggling to do both simultaneously. Any ideas? Thank you.
Best Answer
I don't know how to use
catchfilebetweentags
. I would write a script to extract each code section into its own file, then use themcode
package to include the file in the doc.You might find
mcode
useful anyway, since it does the matlab syntax highlighting for you.