Skip to content

Commit

Permalink
Fix LaTeX writer handling of user custom numfig_format
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbu committed Jan 4, 2019
1 parent 7ff7dfc commit 18bf908
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sphinx/writers/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ def generate_numfig_format(self, builder):
ret.append(self.babel_renewcommand('\\figurename', definition))
if figure[1]:
ret.append('\\makeatletter\n')
ret.append('\\def\\fnum@figure{\\figurename\\thefigure%s}\n' %
ret.append('\\def\\fnum@figure{\\figurename\\thefigure{}%s}\n' %
text_type(figure[1]).strip().translate(tex_escape_map))
ret.append('\\makeatother\n')

Expand All @@ -809,7 +809,7 @@ def generate_numfig_format(self, builder):
ret.append(self.babel_renewcommand('\\tablename', definition))
if table[1]:
ret.append('\\makeatletter\n')
ret.append('\\def\\fnum@table{\\tablename\\thetable%s}\n' %
ret.append('\\def\\fnum@table{\\tablename\\thetable{}%s}\n' %
text_type(table[1]).strip().translate(tex_escape_map))
ret.append('\\makeatother\n')

Expand Down
4 changes: 2 additions & 2 deletions tests/test_build_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ def test_numref_with_prefix2(app, status, warning):
print(status.getvalue())
print(warning.getvalue())
assert '\\addto\\captionsenglish{\\renewcommand{\\figurename}{Figure:}}' in result
assert '\\def\\fnum@figure{\\figurename\\thefigure.}' in result
assert '\\def\\fnum@figure{\\figurename\\thefigure{}.}' in result
assert '\\addto\\captionsenglish{\\renewcommand{\\tablename}{Tab\\_}}' in result
assert '\\def\\fnum@table{\\tablename\\thetable:}' in result
assert '\\def\\fnum@table{\\tablename\\thetable{}:}' in result
assert '\\addto\\captionsenglish{\\renewcommand{\\literalblockname}{Code-}}' in result
assert ('\\hyperref[\\detokenize{index:fig1}]'
'{Figure:\\ref{\\detokenize{index:fig1}}.\\@}') in result
Expand Down

0 comments on commit 18bf908

Please sign in to comment.