I know that this question is not about strictly mathematica issue, but I think that in this site should be many pepople that use latex to distribute mathematica source code/examples. If the moderators think that I should delete this question, please tell me.. and I excsuse me, and I´m doing it as soon as possible.

I have mathematica source code (with any long lines), and I want to attach to a job(using latex), as an appendix.

What do you think is the best way(package) to insert the code (in sourcecode.nb) in the latex document?.

I was reading in any posts o LATEX StackExchange about minted(would be neccesary to configure paths and other details, the package seems to be so pretty) and listings package but this packages seems to be more focused in languages as C, C++, java,... to highlight the reserved words.

I was reading Highlighting Mathematica code in $\LaTeX$ document but I dont´see a suitable solution

I was reading about minted and.. I understand that don´t supports Mathematica. http://pygments.org/languages/ but then I found http://pygments.org/docs/changelog/?highlight=mathematica where seems to mathematica be supported.

Have you any suggestion?

  • 3
    $\begingroup$ what is wrong with listings? Please see tex.stackexchange.com/questions/84748/… fanciest-way-to-include-mathematica-code-in-latex for examples. I've used it with M and it works. But mostly, I just use fancyvrb package, and just include M code as Verbatim in Latex document. ctan.org/tex-archive/macros/latex/contrib/fancyvrb $\endgroup$
    – Nasser
    Jun 21, 2014 at 7:14
  • 1
    $\begingroup$ If you need a 1:1 notebook documentation with graphics etc., you can print your notebook as single enumerated pdf pages and batch-include those as images with a bit of custom TeX code. $\endgroup$
    – Yves Klett
    Jun 21, 2014 at 7:22
  • $\begingroup$ @Nasser , because minted have color and is more pretty visually. But... I was trying and listings is enoguh for me. Now I have a problem that you can see in the edited original post. $\endgroup$
    – Mika Ike
    Jun 21, 2014 at 9:27
  • $\begingroup$ @nasser Finally I didn´t edit the original post. I´m trying to compiled with spanish characters but no success. dropbox.com/s/qgqad6vatetfvew/listings-test.tex I tried tex.stackexchange.com/questions/30512/… with no success $\endgroup$
    – Mika Ike
    Jun 21, 2014 at 9:41
  • 1
    $\begingroup$ It looks like this is now a tex issue? Maybe you should post it as latex question on the tex group with MWE. $\endgroup$
    – Nasser
    Jun 21, 2014 at 10:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.