将hml中的eqaution字符串转换为乳胶字符串。
hml_equation_parser的Python项目详细描述
hml公式分析器
使用量
如果有来自hml文档的equation string,则可以转换 它通过使用eq2latex函数生成乳胶字符串。
>>>importhml_equation_parserashp>>>hp.eq2latex("LEFT ⌊ a+b RIGHT ⌋")'\\left \\lfloor a+b \\right \\rfloor'
示例代码
假设您有test.hml文件用于转换。有 一些示例代码来演示如何解析hml文档。你可以参考 此示例代码位于hmlParser.py(parseHmlSample, convertEquationSample,extract2HtmlStrSample)。
importhml_equation_parserashpdoc=hp.parseHmlSample("test.hml")# parse hml document and make ElementTreedoc=hp.convertEquationSample(doc)# find equations from ElementTree and convert them to latex stringstring=hp.extract2HtmlStrSample(doc)# convert ElementTree to html document with MathJax.importcodecsf=codecs.open("test.html","w","utf8")f.write(string)f.close()
hml方程分析器
_
hml___ string___ eq2latex__ __ ^{TT12}$______。
>>>importhml_equation_parserashp>>>hp.eq2latex("LEFT ⌊ a+b RIGHT ⌋")'\\left \\lfloor a+b \\right \\rfloor'
__
HML_____________ ____。___ test.hml___html__ __。______库^{TT5}$ ___(parseHmlSample,convertEquationSample, extract2HtmlStrSample)。
importhml_equation_parserashpdoc=hp.parseHmlSample("test.hml")# parse hml document and make ElementTreedoc=hp.convertEquationSample(doc)# find equations from ElementTree and convert them to latex stringstring=hp.extract2HtmlStrSample(doc)# convert ElementTree to html document with MathJax.importcodecsf=codecs.open("test.html","w","utf8")f.write(string)f.close()