ob-ipython
ob-ipython copied to clipboard
Exporting code to latex
When exporting to LaTeX ipython code blocks, only the results get exported, even though ~:exports both~ is explicitly included.
The following sample org file fails to output the ipython code, but outputs only the results: '''
+LATEX_CLASS: article
- tema 1
some text and ipython code
initialize ipython kernel
#+BEGIN_SRC ipython :session :exports both acf_time = 10.45678 #+END_SRC
+RESULTS:
-
tema 2 more ipython text and code
+name: ipython_acf
+BEGIN_SRC ipython :session :exports both
'{:.3f}'.format(acf_time)
+END_SRC
-
tema 3 and now python code
+name: python_acf
+BEGIN_SRC python :session :exports both
'{:.3f}'.format(acf_time)
+END_SRC
+RESULTS: python_acf
: 10.457
The acf time in ipython export is call_ipython_acf()
the acf time in python export is call_python_acf() ''' The produced pdf is included below. exportacion.pdf
Thanks for reporting. I'll take a look.
Export of ipython code to latex did not work for me initially. I am using minted package and I had to add:
(add-to-list 'org-latex-minted-langs '(ipython "python"))
My full config of latex export (syntax highlighting and result blocks work as expected):
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted)
(add-to-list 'org-latex-minted-langs '(ipython "python"))
(setq org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
@pablo-CM Have a look at the README.org as of 2117091516fbede8e72bda804ab911d97ccf7901 regarding usage of minted as already suggested by @kozikow. Using that setting I am not able to reproduce this issue with MELPA ob-ipython 20170628.558 and org 9.0.6.
If that does not work for you, could you provide the contents of the *Org PDF LaTeX Output* for further investigation?