Skip to content

Commit

Permalink
LaTeX: support for admonition titles
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Apr 27, 2023
1 parent 1cc1db0 commit 4ee3c79
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/nbsphinx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1909,9 +1909,17 @@ def depart_admonition_html(self, node):


def visit_admonition_latex(self, node):
# See http://tex.stackexchange.com/q/305898/:
self.body.append(
'\n\\begin{sphinxadmonition}{' + node['classes'][1] + '}{}\\unskip')
kind = node['classes'][1]
if len(node.children) >= 2 and isinstance(
node.children[0], docutils.nodes.paragraph):
title = node.children[0].astext()
del node.children[0]
self.body.append(
'\n\\begin{sphinxadmonition}{' + kind + '}{' + title + '}\\par')
else:
# See http://tex.stackexchange.com/q/305898/:
self.body.append(
'\n\\begin{sphinxadmonition}{' + kind + '}{}\\unskip')


def depart_admonition_latex(self, node):
Expand Down

0 comments on commit 4ee3c79

Please sign in to comment.