Skip to content

Error generating latex from Markdown with empty table #14271

@JamesRandom

Description

@JamesRandom

Describe the bug

This was found when building a document containing Markdown files, using the Myst parser. It may be a problem with the myst parser, but HTML is generated correctly. The latex builder crashes without a useful error message.

How to Reproduce

index.rst:

# Table Test

| Key |  P  | Summary |
| --- | --- | ------- |

conf.py

project = 'Latex Table'

extensions = ['myst_parser']

html_theme = 'alabaster'

Environment Information

Platform:              darwin; (macOS-15.7.3-arm64-arm-64bit)
Python version:        3.11.14 (main, Oct 28 2025, 12:11:54) [Clang 20.1.4 ])
Python implementation: CPython
Sphinx version:        9.0.4
Docutils version:      0.22.4
Jinja2 version:        3.1.6
Pygments version:      2.19.2

Sphinx extensions

Additional context

Running Sphinx v9.0.4
loading translations [en]... done
myst v5.0.0: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=set(), disable_syntax=[], all_links_external=False, links_external_new_tab=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, fence_as_directive=set(), number_code_blocks=[], title_to_header=False, heading_anchors=0, heading_slug_func=None, html_meta={}, footnote_sort=True, footnote_transition=True, words_per_minute=200, substitutions={}, linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', enable_checkboxes=False, suppress_warnings=[], highlight_code_blocks=True)
building [mo]: targets for 0 po files that are out of date
writing output... 
building [latex]: all documents
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... 
copying TeX support files... Writing evaluated template result to /Users/jamie/Documents/Projects/latex-tables/latex/make.bat
Writing evaluated template result to /Users/jamie/Documents/Projects/latex-tables/latex/Makefile
Writing evaluated template result to /Users/jamie/Documents/Projects/latex-tables/latex/latexmkrc
Writing evaluated template result to /Users/jamie/Documents/Projects/latex-tables/latex/latexmkjarc
done
copying assets: done
processing latextable.tex... 
index

resolving references...
processing latextable.tex: failed


Versions
========

* Platform:         darwin; (macOS-15.7.3-arm64-arm-64bit)
* Python version:   3.11.14 (CPython)
* Sphinx version:   9.0.4
* Docutils version: 0.22.4
* Jinja2 version:   3.1.6
* Pygments version: 2.19.2

Last Messages
=============

    Writing evaluated template result to /Users/jamie/Documents/Projects/latex-tables/latex/Makefile
    Writing evaluated template result to /Users/jamie/Documents/Projects/latex-tables/latex/latexmkrc
    Writing evaluated template result to /Users/jamie/Documents/Projects/latex-tables/latex/latexmkjarc
    done
    copying assets: done
    processing latextable.tex...
    index

    resolving references...
    processing latextable.tex: failed

Loaded Extensions
=================

* sphinx.ext.mathjax (9.0.4)
* alabaster (1.0.0)
* sphinxcontrib.applehelp (2.0.0)
* sphinxcontrib.devhelp (2.0.0)
* sphinxcontrib.htmlhelp (2.1.0)
* sphinxcontrib.serializinghtml (2.0.0)
* sphinxcontrib.qthelp (2.0.0)
* myst_parser (5.0.0)

Traceback
=========

      File "/Users/jamie/.cache/uv/archive-v0/V_aHqdZh4qaKomUKPUD_9/lib/python3.11/site-packages/sphinx/builders/latex/transforms.py", line 443, in depart_table
        tbody = next(node.findall(nodes.tbody))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    StopIteration

Log file
sphinx-err-8uxyk0ll.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions