Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting the figure format requires setting all format types in numfig_format #4828

Closed
misev opened this issue Apr 10, 2018 · 1 comment
Closed

Comments

@misev
Copy link

misev commented Apr 10, 2018

Problem

Changing the 'figure' format with numfig_format requires listing all other formats as well, otherwise an exception will be thrown.

Procedure to reproduce the problem

In conf.py set numfig_format={'figure': 'Figure %s'}, then try to build a document which has some figures and tables.

Error logs / results

Exception occurred:
  File "/usr/lib/python2.7/dist-packages/sphinx/writers/html.py", line 279, in append_fignumber
    self.body.append(prefix % numsstr + ' ')
TypeError: not all arguments converted during string formatting
The full traceback has been saved in /tmp/sphinx-err-PjF2Qy.log, if you want to report the issue to the developers.

Workaround

Specify all formats:

numfig_format = {'figure': 'Figure %s', 'table': 'Table %s',
                 'code-block': 'Listing %s', 'section': 'Section %s'}

Environment info

  • OS: Ubuntu 16.04
  • Python version: 2.7.12
  • Sphinx version: 1.7.2
tk0miya added a commit to tk0miya/sphinx that referenced this issue Apr 14, 2018
@tk0miya tk0miya added this to the 1.8 milestone Apr 14, 2018
tk0miya added a commit that referenced this issue Apr 21, 2018

Verified

This commit was signed with the committer’s verified signature.
gustavste Gustav
Fix #4828: Allow to override numfig_format partially
@tk0miya
Copy link
Member

tk0miya commented Apr 21, 2018

Fixed by #4842.
Thank you for proposal!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants