[Tex/LaTex] newcommand for verbatim


I'm trying to write a \newcommand for verbatim:


and use it as

\codeline{int foo;}

but it gives an error "File ended while scanning use of \@xverbatim". How to fix it?

Best Answer

If you want a simple implementation, go with


If you want more detailed control, you should go with fancyvrb or minted packages.

Related Question