-
-
Notifications
You must be signed in to change notification settings - Fork 395
/
inline-latex.patch
40 lines (36 loc) · 1.45 KB
/
inline-latex.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- src/sphinx/writers/latex.py.orig 2014-06-05 23:38:03.808669401 -0500
+++ src/sphinx/writers/latex.py 2014-06-05 23:27:22.752376713 -0500
@@ -264,6 +264,7 @@
self.next_figure_ids = set()
self.next_table_ids = set()
# flags
+ self.verbatim = False
self.in_title = 0
self.in_production_list = 0
self.in_footnote = 0
@@ -1319,6 +1320,7 @@
(self.curfilestack[-1], node.line))
if node.rawsource != node.astext():
# most probably a parsed-literal block -- don't highlight
+ self.verbatim = True
self.body.append('\\begin{alltt}\n')
else:
code = node.astext().rstrip('\n')
@@ -1351,6 +1353,7 @@
raise nodes.SkipNode
def depart_literal_block(self, node):
self.body.append('\n\\end{alltt}\n')
+ self.verbatim = False
visit_doctest_block = visit_literal_block
depart_doctest_block = depart_literal_block
--- src/sphinx/ext/mathbase.py.orig 2014-06-05 23:39:36.773293241 -0500
+++ src/sphinx/ext/mathbase.py 2014-06-05 23:18:53.949020605 -0500
@@ -88,7 +88,10 @@
def latex_visit_math(self, node):
- self.body.append('\\(' + node['latex'] + '\\)')
+ if self.verbatim:
+ self.body.append('\\(' + node['latex'] + '\\)')
+ else:
+ self.body.append('$' + node['latex'] + '$')
raise nodes.SkipNode
def latex_visit_displaymath(self, node):