ipython-contrib / jupyter_contrib_nbextensions

A collection of various notebook extensions for Jupyter
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest
Other
5.2k stars 805 forks source link

Doubt Images labels #1588

Open DTKx opened 2 years ago

DTKx commented 2 years ago

Hello

first of all great package. I was searching for more documentation on the specific problem of add automatic figure labels in my jupyter notebook and found your package when convertinf from ipynb to latex following this (post)[http://blog.juliusschulz.de/blog/ultimate-ipython-notebook#converting-notebook-to-latex-pdf].

  1. I have installed the nbextensions
  2. Edited the metadata
  3. Followed the (instructions)[http://blog.juliusschulz.de/blog/ultimate-ipython-notebook#converting-notebook-to-latex-pdf]],
  4. However given this (post)[https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/561] I used the file pre_pymarkdown.py instead of pymdpreprocessor.py
  5. I run the nbextensions command to convert the ipynb to latex.
    jupyter nbconvert --output-dir=modelocopy.ipynb --no-input --to latex

    However this prompts me this error:

[NbConvertApp] Converting notebook notebooks/modelocopy.ipynb to latex
Traceback (most recent call last):
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\Scripts\jupyter-nbconvert-script.py", line 33, in <module>
    sys.exit(load_entry_point('nbconvert==6.4.2', 'console_scripts', 'jupyter-nbconvert')())
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\jupyter_core\application.py", line 264, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\traitlets\config\application.py", line 846, in launch_instance
    app.start()
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\nbconvertapp.py", line 369, in start
    self.convert_notebooks()
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\nbconvertapp.py", line 541, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\nbconvertapp.py", line 506, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\nbconvertapp.py", line 435, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\exporters\exporter.py", line 190, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\exporters\exporter.py", line 208, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\exporters\latex.py", line 72, in from_notebook_node
    return super().from_notebook_node(nb, resources, **kw)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\exporters\templateexporter.py", line 392, in from_notebook_node
    output = self.template.render(nb=nb_copy, resources=resources)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\exporters\templateexporter.py", line 151, in template
    self._template_cached = self._load_template()
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\nbconvert-6.4.2-py3.10.egg\nbconvert\exporters\templateexporter.py", line 362, in _load_template
    return self.environment.get_template(template_file)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\jinja2-3.0.3-py3.10.egg\jinja2\environment.py", line 997, in get_template
    return self._load_template(name, globals)
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\jinja2-3.0.3-py3.10.egg\jinja2\environment.py", line 958, in _load_template
    template = self.loader.load(self, name, self.make_globals(globals))
  File "C:\Users\Debs\anaconda3\envs\nb-extensions-pip\lib\site-packages\jinja2-3.0.3-py3.10.egg\jinja2\loaders.py", line 566, in load
    raise TemplateNotFound(name)
jinja2.exceptions.TemplateNotFound: index.tex.j2

I have the hypothesis that this is given updated versions and incompatibilities.

I wonder if there is an updated tutorial on how to achieve the task of addying images labels to from ipynb to latex, or any other sources that might help me in this task.

That would be really helpfull if you had any thoughts of how to.

Many thanks