Le 09/05/2018 à 11:23, José Abílio Matos a écrit :
On Monday, 7 May 2018 16.18.08 WEST William Adams wrote:

 > It's answered here --- apparently it's an in-built feature:

 >

> https://stackoverflow.com/questions/32564415/how-to-convert-jupyter-ipython-

 > notebooks-to-latex

 > >You have to do this from the command line rather than the web interface

 > >with the following command: jupyter nbconvert /path/to/mynotebook.ipynb

 > >--to latex

 >

 > William

I am using jupyter as well but the latex converted by nbconvert is challenging. :-)

An excerpt of the latex exported by nbconvert follows:

\begin{Verbatim}{[}commandchars=\\

\{\}{]} {\color{incolor}In {[}{\color{incolor}1}{]}:} \PY{c+c1}{\PYZsh{}

Set the environment loading the appropriate python modules} \PY{o}{\PYZpc{}}\PY{k}{matplotlib}

notebook \PY{k+kn}{import} \PY{n+nn}{matplotlib}\PY{n+nn}{.}\PY{n+nn}{pyplot}

\PY{k}{as} \PY{n+nn}{plt} \PY{k+kn}{import} \PY{n+nn}{pandas}

\PY{k}{as} \PY{n+nn}{pd} \PY{k+kn}{import} \PY{n+nn}{numpy}

\PY{k}{as} \PY{n+nn}{np} \PY{k+kn}{import} \PY{n+nn}{dfa\PYZus{}wrapper}

\PY{k}{as} \PY{n+nn}{dfa} \end{Verbatim}

Basically this is a cell that imports python modules:

import matplotlib.pyplot as plt

import pandas as pd

import numpy as np

We need a conversion format that is more generic. Ideally, we should be able to convert this to some Sweave-like content in LyX. Is there another output format that preserves structure ?

JMarc

JMarc

Reply via email to