docxlatex
To convert all your equations into linear format, click on any equation, go to the Equation tab, make sure LaTeX is selected, and click on Convert → All - Linear.
Installation
pip install docxlatex
Usage
Usage is straightforward. For standard usage you will probably only need one method on the Document
class.
Import the Document
class from docxlatex
Instantiate an object of the Document
class, giving it either the path to the .docx file or
a file-like object.
# OR
_ = open('/path/to/document')
docx = Document(_)
Call the get_text() method on the Document object to extract all text from the document.
To convert all your equations into linear format, click on any equation, go to the Equation tab, make sure LaTeX is selected, and click on Convert → All - Linear.
API Reference
class Document
A class representing a .docx document. A thin wrapper with methods to extract text from the document.
Document.document
The .docx document from which text is to be extracted. Stored as a file-like object OR a path to a file-like object and is only read when the
Document.get_text()
method is called.
Document.inline_delimiter
The delimiter to wrap inline equations in. Defaults to '$'
. All equations found in a continuous line of text will be
wrapped between this delimiter.
Document.block_delimiter
The delimiter to wrap equation blocks in. Defaults to '$$'
. All equations found on their own line and
preceded and/or succeeded by newlines will be wrapped between this delimiter.
$$ Pr\left(R \geq x\right) \leq \frac{Ex\left(R\right)}{x} $$
Document.get_text(self, get_header_text=False, get_footer_text=False, image_dir=None, extensions=None)