Skip to content

Bug Report: nbconvert 7.x generates invalid LaTeX (none counter missing)Β #2254

@ojk-07

Description

@ojk-07

πŸ› Bug Report: nbconvert 7.x generates invalid LaTeX (none counter missing)

Summary

nbconvert (7.16.6) generates LaTeX files that include references to a counter named none, but the counter is never defined.
This causes LaTeX PDF compilation to fail with:

! LaTeX Error: No counter 'none' defined.

The error occurs systematically when Pandas DataFrames are present in the notebook.


πŸ” Steps to Reproduce

1. Create a new test.ipynb with one cell:

import pandas as pd
pd.DataFrame({"A":[1,2], "B":[3,4]})

### 2. Run:
jupyter nbconvert --to pdf test.ipynb

### 3. Inspect the generated .tex file:
It contains:
\refstepcounter{none}
but no definition for this counter.

❌ Actual Behavior

LaTeX compilation fails with:
! LaTeX Error: No counter 'none' defined.
l.xxx \refstepcounter{none}

βœ… Expected Behavior

nbconvert should either:
avoid emitting \refstepcounter{none},
or
ensure the counter is defined:
\newcounter{none}

πŸ›  Environment

nbconvert 7.16.6
Pandoc 3.8.3
Python 3.13.11
TeX MiKTeX 
OS Windows 11

βœ” Workaround

Editing the resulting .tex file and adding:
\newcounter{none}
fixes the compilation failure.

πŸ“Ž Additional Notes

This did not occur in nbconvert 6.x
Likely related to changes in Pandoc 3.x’s LaTeX writer
Appears when Pandas HTML tables are converted to LaTeX via Pandoc
The counter none seems to be a placeholder generated by Pandoc but not defined by nbconvert

If useful, I can also attach:
- the generated .tex file
- the log output from LaTeX
- a minimal notebook (test.ipynb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions