diff options
Diffstat (limited to 'sphinx/writers/latex.py')
| -rw-r--r-- | sphinx/writers/latex.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index e0b4ec03b..43f3910dd 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1708,15 +1708,10 @@ class LaTeXTranslator(SphinxTranslator): opts = self.config.highlight_options.get(lang, {}) hlcode = self.highlighter.highlight_block( - node.astext(), lang, opts=opts, location=node) - # TODO: Use nowrap option once LaTeX formatter supports it - # https://github.com/pygments/pygments/pull/1343 - hlcode = hlcode.replace(r'\begin{Verbatim}[commandchars=\\\{\}]', - r'\sphinxcode{\sphinxupquote{%') - # get consistent trailer - hlcode = hlcode.rstrip()[:-15] # strip \n\end{Verbatim} - self.body.append(hlcode) - self.body.append('%' + CR + '}}') + node.astext(), lang, opts=opts, location=node, nowrap=True) + self.body.append(r'\sphinxcode{\sphinxupquote{%' + CR + + hlcode.rstrip() + '%' + CR # NoQA: W503 + + '}}') # NoQA: W503 raise nodes.SkipNode def depart_literal(self, node: Element) -> None: |
