mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Support containers in LaTeX output.
Support containers in the LaTeX writer by outputting the start and end of a LaTeX group, wrapping the beginning and end of a LaTeX environment. The class name(s) are passed as an argument to the environment.
This commit is contained in:
parent
f31af4b815
commit
31f7eae822
@ -270,6 +270,11 @@
|
||||
\input{sphinxlatexshadowbox.sty}
|
||||
|
||||
|
||||
%% CONTAINERS
|
||||
%
|
||||
\input{sphinxlatexcontainers.sty}
|
||||
|
||||
|
||||
%% PYGMENTS
|
||||
% stylesheet for highlighting with pygments
|
||||
\RequirePackage{sphinxhighlight}
|
||||
|
12
sphinx/texinputs/sphinxlatexcontainers.sty
Normal file
12
sphinx/texinputs/sphinxlatexcontainers.sty
Normal file
@ -0,0 +1,12 @@
|
||||
%% CONTAINER DIRECTIVES
|
||||
%
|
||||
% change this info string if making any custom modification
|
||||
\ProvidesFile{sphinxlatexcontainers.sty}[2021/05/03 containers]
|
||||
|
||||
% The purpose of this file is to provide a dummy environment sphinxcontainer
|
||||
% which will be inserted for every container directive the container class
|
||||
% name will be passed as the argument to the environment. User-defined
|
||||
% formatting of directives can be achieved by renewing the definition of
|
||||
% this environment, and branching on the value of the argument.
|
||||
|
||||
\newenvironment{sphinxcontainer}[1]{}{}
|
@ -1975,10 +1975,12 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
pass
|
||||
|
||||
def visit_container(self, node: Element) -> None:
|
||||
pass
|
||||
classes = node.get('classes', [])
|
||||
self.body.append(
|
||||
'\n\\bgroup\\begin{sphinxcontainer}{%s}' % ' '.join(classes))
|
||||
|
||||
def depart_container(self, node: Element) -> None:
|
||||
pass
|
||||
self.body.append('\n\\end{sphinxcontainer}\\egroup')
|
||||
|
||||
def visit_decoration(self, node: Element) -> None:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user