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

LaTeX: user numfig_format is stripped of spaces and may cause build failure #5889

Closed
jfbu opened this issue Jan 4, 2019 · 1 comment
Closed

Comments

@jfbu
Copy link
Contributor

jfbu commented Jan 4, 2019

Procedure to reproduce the problem

index.rst:

====
test
====

Section
=======

.. figure:: foo.png

   is a figure

conf.py:

# -*- coding: utf-8 -*-

master_doc = 'index'
html_theme = 'classic'
numfig = True
numfig_format = {
    'figure': 'F %s F',
    'table':  'T %s T',
    'code-block': 'L %s L',
    'section': 'S %s S',
}

Do make latexpdf.

Error logs / results

! Undefined control sequence.
\fnum@figure ->\figurename \thefigureF 
                                       
l.85 \caption{is a figure}
                          \label{\detokenize{index:id1}}\end{figure}
? 

Expected results

PDF via LaTeX backends works: the stripped space before F causes \thefigureF non-existent macro to be used.

Remark1: by the way the default definition of \fnum@figure is \figurename\nobreakspace\thefigure. This explains why the default Fig. %s setting gives nevertheless a space in output.

Remark2: the HTML backend preserves the spaces.

Environment info

  • OS: Mac OS
  • Python version: 3.6.6
  • Sphinx version: 1.8 branch at 7ff7dfc (1.8.4+)
  • TeXLive 2018

Related: #5516, which migrates code that this issue, once fixed, will modify. Thus merging to master will need some care.

@jfbu jfbu added this to the 1.8.4 milestone Jan 4, 2019
@jfbu
Copy link
Contributor Author

jfbu commented Jan 4, 2019

Actually on closer look #5516 on master branch fixes this issue. But we will need some backport to 1.8 branch.

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

1 participant