I have some Matlab code which I would like to include in my LaTeX document.
I use fancyvrb package, based on which I define a new environment called code. An complete and minimum example is:
\documentclass[12pt,letterpaper]{article} \usepackage{fancyvrb} \DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small} \DefineVerbatimEnvironment{example}{Verbatim}{fontsize=\small} \begin{document} \begin{code} addpath('~/plot'); \end{code} \end{document}However, in the created pdf file, if I copy the code and paste it in Matlab command window, Matlab will complaint about the single quote is not the one used in Matlab. I was wondering why and how to solve the problem?
- To generalize, I also hope to know if there may possibly be other characters besides single quote that can cause such error? Not only in Matlab but also other programming languages?
- Also, I was wondering if my way of including code in LaTeX by using fancyvrb is the best? Do you have other nice ways to recommend?
Thanks and regards!