Skip to content

Crash when using latex #17

@miguel-negrao

Description

@miguel-negrao

sphinx is crashing when building latex.

# Platform:         linux; (Linux-6.1.0-28-amd64-x86_64-with-glibc2.36)
# Sphinx version:   7.1.2
# Python version:   3.11.2 (CPython)
# Docutils version: 0.20.1
# Jinja2 version:   3.1.4
# Pygments version: 2.18.0

# Last messages:
#   part1/3_Ambisonics
#   part1/4_Ambisonics_Unreal_Engine
#   part1/5_Reverb
#   part1/6_vr
#   part1/7_project_guidelines_1
#   part2/index
#   part2/1_introduction_synthesis
#   
#   resolving references...
#   failed

# Loaded extensions:
#   sphinx.ext.mathjax (7.1.2)
#   alabaster (0.7.13)
#   sphinxcontrib.applehelp (1.0.4)
#   sphinxcontrib.devhelp (1.0.2)
#   sphinxcontrib.htmlhelp (2.0.1)
#   sphinxcontrib.serializinghtml (1.1.5)
#   sphinxcontrib.qthelp (1.0.3)
#   myst_parser (3.0.1)
#   sphinx_markdown_builder (unknown version)
#   sphinxcontrib.bibtex (2.6.3)
#   sphinx_subfigure (unknown version)

# Traceback:
Traceback (most recent call last):
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/cmd/build.py", line 290, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/application.py", line 351, in build
    self.builder.build_update()
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 287, in build_update
    self.build(['__all__'], to_build)
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 360, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 294, in write
    doctree = self.assemble_doctree(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 360, in assemble_doctree
    self.env.resolve_references(largetree, indexfile, self)
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 658, in resolve_references
    self.apply_post_transforms(doctree, fromdocname)
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 670, in apply_post_transforms
    transformer.apply_transforms()
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/transforms/__init__.py", line 80, in apply_transforms
    super().apply_transforms()
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/docutils/transforms/__init__.py", line 182, in apply_transforms
    transform.apply(**kwargs)
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx/transforms/post_transforms/__init__.py", line 37, in apply
    self.run(**kwargs)
  File "/home/miguel/.cache/pypoetry/virtualenvs/sphynx-website-2024-25-lCh1Vbw3-py3.11/lib/python3.11/site-packages/sphinx_subfigure/tr_latex.py", line 81, in run
    flattened[-1][2] = False
    ~~~~~~~~~^^^^
IndexError: list index out of range

The code that causes it is:

````{subfigure} B|A

```{image} ../images/synth2_envelope_scale.png
```
```{image} ../images/synth2_envelope_scale_2.png
```

````

and it is fixed by changing "B|A" to "A|B".

There is no error when building html.

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