mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Make reset of \SphinxVerbatimTitle to \empty explicit in produced LaTeX files
modified: sphinx/texinputs/sphinx.sty modified: sphinx/writers/latex.py
This commit is contained in:
@@ -190,6 +190,7 @@
|
||||
\def\SphinxVerbatimTitle
|
||||
{\captionof{#1}{\SphinxLiteralBlockLabel #2}\smallskip }%
|
||||
}
|
||||
% \SphinxLiteralBlockLabel will be set dynamically to hold the label for links
|
||||
\newcommand*\SphinxLiteralBlockLabel {}
|
||||
|
||||
% \SphinxCustomFBox is copied from framed.sty's \CustomFBox, but
|
||||
@@ -248,17 +249,17 @@
|
||||
% list starts new par, but we don't want it to be set apart vertically
|
||||
\bgroup\parskip\z@skip
|
||||
\smallskip
|
||||
% use customized framed environment
|
||||
% first, check if has caption
|
||||
% first, let's check if there is a caption
|
||||
\ifx\SphinxVerbatimTitle\empty
|
||||
% no caption. Require space if at bottom of page
|
||||
\needspace{\literalblockwithoutcaptionneedspace}%
|
||||
% if there is a label insert hypertarget.
|
||||
% there was no caption. Check if nevertheless a label was set.
|
||||
\ifx\SphinxLiteralBlockLabel\empty\else
|
||||
% we require some space to be sure hyperlink target from \phantomsection
|
||||
% will not be separated from upcoming verbatim by a page break
|
||||
\needspace{\literalblockwithoutcaptionneedspace}%
|
||||
\phantomsection\SphinxLiteralBlockLabel
|
||||
\fi
|
||||
\fi
|
||||
% non empty \SphinxVerbatimTitle has label inside if there is one.
|
||||
% non-empty \SphinxVerbatimTitle has label inside it (in case there is one)
|
||||
\let\SphinxFrameTitle\SphinxVerbatimTitle
|
||||
\global\Sphinx@myfirstframedpasstrue
|
||||
% The list environement is needed to control perfectly the vertical
|
||||
@@ -280,8 +281,6 @@
|
||||
\endlist
|
||||
% close group to restore \parskip (and \SphinxFrameTitle)
|
||||
\egroup
|
||||
% reset to empty \SphinxVerbatimTitle
|
||||
\global\let\SphinxVerbatimTitle\empty
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2009,6 +2009,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
def depart_container(self, node):
|
||||
if node.get('literal_block'):
|
||||
self.in_container_literal_block -= 1
|
||||
self.body.append('\\let\\SphinxVerbatimTitle\\empty\n')
|
||||
self.body.append('\\let\\SphinxLiteralBlockLabel\\empty\n')
|
||||
|
||||
def visit_decoration(self, node):
|
||||
|
||||
Reference in New Issue
Block a user