How to insert Mathematica Code in LaTeX?

I am writing a paper on the SIR epidemiological model and in addition to the images and graphs I have created in Mathematica, I would like to insert the code before each graph. Is there any way to do this? I write my LaTeX code in the Overleaf

The LaTeX package listings can format Mathematica code, I think.

Have you tried to right click on the code cell and use Copy as → LaTeX ?

Oh, I have tried that yet. Thanks