spatialaudio / nbsphinx

:ledger: Sphinx source parser for Jupyter notebooks
https://nbsphinx.readthedocs.io/
MIT License
454 stars 129 forks source link

Figure caption is lost when upgrading from 0.3.5 to 0.4.2 #297

Open astonzhang opened 5 years ago

astonzhang commented 5 years ago

With nbsphinx version: 0.4.2, figure caption in ipynb is lost when ipynb is parsed into latex file with sphinx.

For example, in xx.ipynb, we have

![Figure caption](figure_name.pdf)

Then in the generated latex file (by sphinx), we only have the following without the figure caption

\sphinxincludegraphics{{figure_name}.pdf}

However, with nbsphinx version: 0.3.5, the generated latex file will include figure caption:

\begin{figure}[H]
\centering
\capstart

\noindent\sphinxincludegraphics{{figure_name}.pdf}                                                               
\caption{Figure caption}\label{\detokenize{xxxxx}}\end{figure}

So, can we fix the figure caption issue in 0.4.2? Thanks!

astonzhang commented 5 years ago

Is this feature (show figure caption in latex and html) removed in 0.4.2? https://github.com/spatialaudio/nbsphinx/issues/157

mgeier commented 5 years ago

Yes, this was an accidental "feature" which was removed in #215 (which was released in version 0.4.0).

astonzhang commented 5 years ago

Thanks. However, showing figure captions is quite essential. For instance, our website and pdf need figure captions with figure numberings:

source code in markdown: https://github.com/d2l-ai/d2l-en html: http://www.d2l.ai/ pdf: http://www.d2l.ai/d2l-en.pdf

Do you have any plan to add figure caption & numbering back? Is there any way to show figure caption & numbering with nbsphinx==0.4.2? Thanks.

mgeier commented 5 years ago

showing figure captions is quite essential.

Would you mind showing a few selected examples for this?

Do you have any plan to add figure caption & numbering back?

No. Since this isn't a feature in the Classic Notebook nor in JupyterLab nor in nbviewer, I don't think it's a good idea to try to introduce this feature in nbsphinx. I don't think it should be done in nbconvert, either (see also https://github.com/jupyter/nbconvert/pull/990).

This was really just an accident based on the default behavior of pandoc.

Is there any way to show figure caption & numbering with nbsphinx==0.4.2?

No. Not without hacking the nbsphinx source code.