Fix LaTeX writer handling of user custom numfig_format

This commit is contained in:
jfbu 2019-01-04 15:16:32 +01:00
parent 7ff7dfc427
commit 18bf90822c
2 changed files with 4 additions and 4 deletions

View File

@ -796,7 +796,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
ret.append(self.babel_renewcommand('\\figurename', definition)) ret.append(self.babel_renewcommand('\\figurename', definition))
if figure[1]: if figure[1]:
ret.append('\\makeatletter\n') 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)) text_type(figure[1]).strip().translate(tex_escape_map))
ret.append('\\makeatother\n') ret.append('\\makeatother\n')
@ -809,7 +809,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
ret.append(self.babel_renewcommand('\\tablename', definition)) ret.append(self.babel_renewcommand('\\tablename', definition))
if table[1]: if table[1]:
ret.append('\\makeatletter\n') 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)) text_type(table[1]).strip().translate(tex_escape_map))
ret.append('\\makeatother\n') ret.append('\\makeatother\n')

View File

@ -289,9 +289,9 @@ def test_numref_with_prefix2(app, status, warning):
print(status.getvalue()) print(status.getvalue())
print(warning.getvalue()) print(warning.getvalue())
assert '\\addto\\captionsenglish{\\renewcommand{\\figurename}{Figure:}}' in result 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 '\\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 '\\addto\\captionsenglish{\\renewcommand{\\literalblockname}{Code-}}' in result
assert ('\\hyperref[\\detokenize{index:fig1}]' assert ('\\hyperref[\\detokenize{index:fig1}]'
'{Figure:\\ref{\\detokenize{index:fig1}}.\\@}') in result '{Figure:\\ref{\\detokenize{index:fig1}}.\\@}') in result