parent
08fe4e5c63
commit
f96e5f8724
@ -0,0 +1,14 @@
|
|||||||
|
"""
|
||||||
|
conda activate rag
|
||||||
|
pip install pypandoc
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pypandoc
|
||||||
|
|
||||||
|
def docx_to_latex(docx_path):
|
||||||
|
latex_content = pypandoc.convert_file(docx_path, 'latex')
|
||||||
|
import re
|
||||||
|
return re.sub(r'\\\[(.*?)\\\]', r'$$\1$$', latex_content)
|
||||||
|
|
||||||
|
latex_content = docx_to_latex('带公式的WORD文档.docx')
|
||||||
|
print(latex_content) # 包含LaTeX格式公式
|
Binary file not shown.
Loading…
Reference in new issue