Exemplo n.º 1
0
def _latex_fn(mathobj,f):
	xml_str = DOCXML_ROOT.format(mathobj.group(0))
	for omath in omml.load_string(xml_str):
		_replaceLtGt=f.format(omath.latex);
		print f.format(escape(_replaceLtGt))
		print _replaceLtGt
		return TEXT.replace('{0}',_replaceLtGt.replace(r"<","&lt;"))
	return None
Exemplo n.º 2
0
def _latex_block_fn(mathobj, f):
    xml_str = DOCXML_ROOT.format(mathobj.group(0))
    srarch = omath_re.search(xml_str)
    xml_str = DOCXML_ROOT.format(srarch.group(0))
    for omath in omml.load_string(xml_str):
        _replaceLtGt = f.format(omath.latex)
        re.sub(r">", "\\gt", _replaceLtGt)
        re.sub(r"<", "\\lt", _replaceLtGt)
        return TEXT_BLOCK.replace("{0}", _replaceLtGt)
    return None
Exemplo n.º 3
0
def _latex_fn(mathobj, f):
    xml_str = DOCXML_ROOT.format(mathobj.group(0))
    for omath in omml.load_string(xml_str):
        _replaceLtGt = f.format(omath.latex)
        print _replaceLtGt
        _replaceLtGt = _replaceLtGt.replace(">", "\\gt")
        _replaceLtGt = _replaceLtGt.replace("<", "\\lt")
        print _replaceLtGt
        return TEXT.replace("{0}", _replaceLtGt)
    return None
Exemplo n.º 4
0
def _latex_block_fn(mathobj,f):
	xml_str = DOCXML_ROOT.format(mathobj.group(0))
	srarch=omath_re.search(xml_str);
	xml_str = DOCXML_ROOT.format(srarch.group(0))
	for omath in omml.load_string(xml_str):
		_replaceLtGt=f.format(omath.latex);
		print f.format(escape(_replaceLtGt))
		print _replaceLtGt
		return TEXT_BLOCK.replace('{0}',_replaceLtGt.replace(r"<","&lt;"))
	return None
Exemplo n.º 5
0
def _latex_block_fn(mathobj, f):
    xml_str = DOCXML_ROOT.format(mathobj.group(0))
    srarch = omath_re.search(xml_str)
    xml_str = DOCXML_ROOT.format(srarch.group(0))
    for omath in omml.load_string(xml_str):
        _replaceLtGt = f.format(omath.latex)
        re.sub(r'>', '\\gt', _replaceLtGt)
        re.sub(r'<', '\\lt', _replaceLtGt)
        return TEXT_BLOCK.replace('{0}', _replaceLtGt)
    return None
Exemplo n.º 6
0
def _latex_fn(mathobj, f):
    xml_str = DOCXML_ROOT.format(mathobj.group(0))
    for omath in omml.load_string(xml_str):
        _replaceLtGt = f.format(omath.latex)
        print _replaceLtGt
        _replaceLtGt = _replaceLtGt.replace('>', '\\gt')
        _replaceLtGt = _replaceLtGt.replace('<', '\\lt')
        print _replaceLtGt
        return TEXT.replace('{0}', _replaceLtGt)
    return None
Exemplo n.º 7
0
    def __init__(self, element, tag):
        mathml = etree.tostring(element).decode()
        if tag == 'oMath':
            mathml = """<m:oMathPara
                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
                xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
                xmlns:w="http://schemas.openxmlformats.org/wordparseingml/2006/main">
                %s
            </m:oMathPara>""" % mathml

        latexs = [i.latex for i in omml.load_string(mathml)]
        if latexs:
            self.latex = '${0}$'.format(latexs[0])
        else:
            self.latex = ''
Exemplo n.º 8
0
def _latex_fn(mathobj,f):
	xml_str = DOCXML_ROOT.format(mathobj.group(0))
	for omath in omml.load_string(xml_str):
		return TEXT.replace('{0}',f.format(omath.latex))
	return None
Exemplo n.º 9
0
def _latex_fn(mathobj,f):
	xml_str = DOCXML_ROOT.format(mathobj.group(0))
	for omath in omml.load_string(xml_str):
		return TEXT.replace('{0}',f.format(escape(omath.latex)))
	return None