Skip to content

Commit

Permalink
latex: add defaults for enumerated list prefix/suffix
Browse files Browse the repository at this point in the history
these may not be defined (e.g. coming from recommonmark)
  • Loading branch information
minrk committed Sep 24, 2018
1 parent ff8df59 commit af63993
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sphinx/writers/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,13 +1469,15 @@ def get_nested_level(node):
enum = "enum%s" % toRoman(get_nested_level(node)).lower()
enumnext = "enum%s" % toRoman(get_nested_level(node) + 1).lower()
style = ENUMERATE_LIST_STYLE.get(get_enumtype(node))
prefix = node.get('prefix', '')
suffix = node.get('suffix', '.')

self.body.append('\\begin{enumerate}\n')
self.body.append('\\def\\the%s{%s{%s}}\n' % (enum, style, enum))
self.body.append('\\def\\label%s{%s\\the%s %s}\n' %
(enum, node['prefix'], enum, node['suffix']))
(enum, prefix, enum, suffix))
self.body.append('\\makeatletter\\def\\p@%s{\\p@%s %s\\the%s %s}\\makeatother\n' %
(enumnext, enum, node['prefix'], enum, node['suffix']))
(enumnext, enum, prefix, enum, suffix))
if 'start' in node:
self.body.append('\\setcounter{%s}{%d}\n' % (enum, node['start'] - 1))
if self.table:
Expand Down

0 comments on commit af63993

Please sign in to comment.