Have you tried to right click on the code cell and use Copy as -> LaTeX ?https://reference.wolfram.com/language/workflow/GenerateTeXWithTheWolframLanguage.html
Oh, I have tried that yet. Thanks
The LaTeX package listings can format Mathematica code, I think.
listings