Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Doc2Typst Converter πŸš€

A lightweight, robust bash script designed to convert Office documents (like .odt and .docx) into Typst or LaTeX formats. It automatically extracts embedded images and handles relative file paths, ensuring your generated code compiles perfectly right out of the box.

πŸ€– AI Disclosure: This project, including the conversion scripts and this documentation, was fully generated by AI.

πŸ“¦ Dependencies

To use this script, you need to have the following tools installed on your system:

  • Pandoc: The core document converter (Version 3.0 or higher is required for Typst support).
  • Bash: Standard Unix shell (Linux/macOS).
  • Typst CLI (Optional): If you want to compile the .typ files into PDFs locally.
  • LaTeX distribution (Optional): e.g., TeX Live, if you are converting to .tex and want to compile locally.

Installing Dependencies (Fedora/RHEL)

sudo dnf install pandoc
cargo install typst-cli # If you have Rust installed

πŸ› οΈ Installation

Clone this repository or download the script directly. Make the script executable:

chmod +x convert_simple.sh

πŸš€ Usage

The script requires exactly three arguments:

Source File: The absolute path to your .odt or .docx file.

Output Directory: The absolute path to the folder where you want the project saved.

Format: typ (for Typst) or tex (for LaTeX).

Command Syntax:

./convert_simple.sh <SOURCE_FILE> <TARGET_DIRECTORY> <FORMAT>

Example:

./convert_simple.sh "/home/user/Documents/Thesis.odt" "/home/user/Projects/Typst_Code" typ

What the script does automatically:

Creates a dedicated project folder named after your document in the target directory.

Moves into that directory to enforce relative paths for all media.

Runs Pandoc to convert the text and extracts all embedded images into a local media/ subfolder.

Leaves you with a clean, instantly compilable .typ or .tex file.

⚠️ Known Limitations

PDF Inputs: Pandoc cannot convert from PDFs. If you have a PDF, you must first convert it to a .docx file (e.g., using Word, Adobe, or Mathpix for complex formulas) before running this script.

Complex ODT Objects: Native LibreOffice drawing objects or embedded charts in .odt files may not extract perfectly. Saving the file as .docx before running the script usually resolves this.

About

A lightweight, robust bash script designed to convert Office documents (like `.odt` and `.docx`) into [Typst](https://typst.app/) or LaTeX formats. πŸ€– AI Disclosure: This project, including the conversion scripts and this documentation, was fully generated by AI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages