Skip to content

Commit

Permalink
Merge pull request #5490 from minrk/optional-prefix-suffix
Browse files Browse the repository at this point in the history
latex: add defaults for enumerated list prefix/suffix
  • Loading branch information
tk0miya committed Oct 1, 2018
2 parents 6c83b8b + af63993 commit c206c02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sphinx/writers/latex.py
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 c206c02

Please sign in to comment.