Skip to content
Permalink
Browse files

add latex packaages + fix link in mathdef

  • Loading branch information...
sdpython committed Jun 21, 2016
1 parent f4797e5 commit f5319d4aaa146b6094b8415cd4306d37b4609f2e
@@ -179,6 +179,13 @@ def set_sphinx_variables(fileconf,
\\usepackage{cmap} % fix search and cut-and-paste in Acrobat
\\usepackage[raccourcis]{fast-diagram}
\\usepackage{titlesec}
\\usepackage{amsmath}
\\usepackage{amssymb}
\\usepackage{amsfonts}
\\usepackage{graphics}
\\usepackage{epic}
\\usepackage{eepic}
%\\usepackage{pict2e}
%%% Redefined titleformat
\\setlength{\\parindent}{0cm}
\\setlength{\\parskip}{1ex plus 0.5ex minus 0.2ex}
@@ -381,6 +388,7 @@ def set_sphinx_variables(fileconf,
# latex
math_number_all = False
imgmath_latex_preamble = """
\\usepackage{epic}
\\newcommand{\\acc}[1]{\\left\\{#1\\right\\}}
\\newcommand{\\cro}[1]{\\left[#1\\right]}
\\newcommand{\\pa}[1]{\\left(#1\\right)}
@@ -17,7 +17,7 @@
from sphinx.util.nodes import set_source_info
from docutils.parsers.rst import Directive
from docutils.parsers.rst.directives.admonitions import BaseAdmonition

from docutils.statemachine import StringList
from ..texthelper.texts_language import TITLES


@@ -91,6 +91,16 @@ def run(self):
if isinstance(mathdef, nodes.system_message):
return [mathdef]

# add a label
lid = self.options.get('lid', None)
if lid:
container = nodes.container()
tnl = [".. _{0}:".format(lid), ""]
content = StringList(tnl)
self.state.nested_parse(content, self.content_offset, container)
else:
container = None

# mid
mathtag = self.options.get('tag', '').strip()
if len(mathtag) == 0:
@@ -108,20 +118,22 @@ def run(self):
raise ValueError("title is empty")

# main node
ttitle = title
title = nodes.title(text=_(title))
mathdef.insert(0, title)
if container is not None:
mathdef.insert(0, title)
mathdef.insert(0, container)
else:
mathdef.insert(0, title)
mathdef['mathtag'] = mathtag
mathdef['mathmid'] = mid
mathdef['mathtitle'] = title
mathdef['mathtitle'] = ttitle
set_source_info(self, mathdef)

if env is not None:
targetid = 'indexmathe-%s%s' % (mathtag,
env.new_serialno('indexmathe%s' % mathtag))
ids = [targetid]
lid = self.options.get('lid', None)
if lid:
ids.append(lid)
targetnode = nodes.target(legend, legend, ids=ids)
return [targetnode, mathdef]
else:

0 comments on commit f5319d4

Please sign in to comment.
You can’t perform that action at this time.