You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
356 B
14 lines
356 B
"""
|
|
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格式公式 |