summaryrefslogtreecommitdiff
path: root/sphinx/writers/latex.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/writers/latex.py')
-rw-r--r--sphinx/writers/latex.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index 318639ac8..5cbebf486 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -2257,9 +2257,12 @@ class LaTeXTranslator(SphinxTranslator):
else:
hlcode += '\\end{sphinxVerbatim}'
- hllines = '\\fvset{hllines={, %s,}}%%' %\
- str(highlight_args.get('hl_lines', []))[1:-1]
- self.body.append('\n' + hllines + '\n' + hlcode + '\n')
+ hllines = str(highlight_args.get('hl_lines', []))[1:-1]
+ if hllines:
+ self.body.append('\n\\fvset{hllines={, %s,}}%%' % hllines)
+ self.body.append('\n' + hlcode + '\n')
+ if hllines:
+ self.body.append('\\sphinxresetverbatimhllines\n')
raise nodes.SkipNode
def depart_literal_block(self, node):