Message Boards Message Boards

Export piece of code to a LaTeX document?

Posted 9 years ago

I have an piece of code,

In[1]:     InputForm[N[Pi]]
Out[1]:    3.141592653589793
In[2]:     y = N[Pi]*10^(-10);
In[3]:     InputForm[y]
Out[3]:    3.1415926535897934*^-10
In[4]:     z = 1. + y;
In[5]:     InputForm[z]
Out[5]:    1.0000000003141594
In[6]:     InputForm[z - 1.]
Out[6]:    3.141593651889707*^-10

that I would like to include in a Latex Document.
How can I export Mathematica code to include in Latex ?

2 Replies

It is easy way to include Mathematica code in Latex. Sincerely, I thank you for your help.

If you save it as plain text, you can simply use the listings package in Latex to color the code correctly.

https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract