From 17877e84fd9eb72a2a5070a878ba3f772ca8d97b Mon Sep 17 00:00:00 2001 From: Hrushikesh Vaidya Date: Sun, 30 May 2021 16:35:08 +0530 Subject: [PATCH] Add some docs in the README --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index b861cd0..36d29ac 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,42 @@ This project aims to expand the above libraries' functionality by allowing you t primarily for use with MathJax. docxlatex DOES NOT convert the entire .docx file to a LaTeX source file. + +# Installation +Currently not available on PyPI. You can clone this repository for now. + +# Usage +Usage is simple. +Navigate into the project's directory +`cd docxlatex` +`cd src` + +Start a python shell and import the `Document` class from `docxlatex` +```python +from docxlatex import Document +``` + +Create a `Document` object, giving it the path to the .docx file, and call the `get_text()` method +```python +doc = Document("path\\to\\document") +text = doc.get_text() +``` + +You can also set some settings on the `Document` object to customize behaviour, like setting the delimiters that will go before and after an equation, +and flags to extract header and footer text. + +```python +doc.get_header_text = True # False by default +doc.get_footer_text = True # False by default +doc.inline_delimiter = "%" # "$" by default +doc.block_delimiter = "%%" # "$$" by default +``` + +# Limitation +docxlatex currently requires all the mathematical equations in the .docx document to be converted into linear format to extract successfully. I am adding support for +equations in the professional format right now. Soon you will be able to use it without having to use this workaround, but for now, open the .docx file in Word, click on any equation, click on the right context menu > All - linear. + +# TODOs +- [ ] Extract all images present in the file and return them as file-like objects +- [ ] Add support for equations in professional formatting +- [ ] Clean up equations in linear format that do not directly convert to valid LaTeX