I'd like to include programming codes in LaTeX by using the verbatim package.
For the code I use, the enumeration is continuous.
So if a new code starts, the numbers are ongoing, which should not be the case.
The use of the linenumbers package did not help.
Further I'd like to have a vertical line between the numbers and the code to indicate the left margin.
I have attached the code.
\documentclass{article}
\usepackage{listings}
\usepackage{fancyvrb}
\usepackage{lineno}
\begin{document}
\begin{linenumbers}
\begin{verbatim}
function I = simpsons(f,a,b,n)
% This function computes the integral "I" via Simpson's rule in the
% interval [a,b] with n+1 equally spaced points
%
% Syntax: I = simpsons(f,a,b,n)
%
% Where,
% f= can be either an anonymous function (e.g. f=@(x) sin(x)) or a vector
% containing equally spaced values of the function to be integrated
% a= Initial point of interval
%
\end{verbatim}
\end{linenumbers}
NO NUMBERS SHOULD APPEAR HERE, THE NUMBERS SHOULD START IN THE NEXT LINE\\
\begin{linenumbers}
\begin{verbatim}
function I = simpsons(f,a,b,n)
% This function computes the integral "I" via Simpson's rule in the
% interval [a,b] with n+1 equally spaced points
%
% Syntax: I = simpsons(f,a,b,n)
%
% Where,
% f= can be either an anonymous function (e.g. f=@(x) sin(x)) or a vector
% containing equally spaced values of the function to be integrated
% a= Initial point of interval
\end{verbatim}
\end{linenumbers}
\end{document}
Thanks.



