mex — write LaTeX like Markdown
mex is a minimal CLI tool to make writing LaTeX research documents easier by using a Markdown-like syntax. It generates valid .tex files that can be compiled with any LaTeX engine (Overleaf, pdflatex, etc.).
- Write sections and subsections with
#,##,### - Bold, italic, and
inline codeformatting - Inline and block math support:
$...$and$$...$$ - Theorems, definitions, and other environments with
::: name ... ::: - Simple citations with
@key(converted to\cite{key}) - Generates fully ready-to-compile LaTeX documents
Goals: Reduce LaTeX boilerplate and make writing research notes and papers faster.
Install mex in editable mode (recommended for development):
git clone https://github.com/MithilSaiReddy/Mex
cd mex
pip install -e .This will make the mex command available globally.
mex input.mex -o output.texinput.mex— your Markdown-like source fileoutput.tex— generated LaTeX file (default:out.tex)
Compile the output with pdflatex or Overleaf:
pdflatex output.textitle: My Research Paper
author: Alice
# Introduction
This is **bold**, *italic*, and math $E=mc^2$.
## Theorem Example
::: theorem
Every vector space has a basis.
:::
See @smith2020 for more details.This will generate a LaTeX document with sections, formatted text, math, the theorem environment, and citations.
| Syntax | Example | Output |
|---|---|---|
| Section | # Title |
\section{Title} |
| Subsection | ## Subtitle |
\subsection{Subtitle} |
| Bold | **bold** |
\textbf{bold} |
| Italic | *italic* |
\textit{italic} |
| Inline code | `code` |
\texttt{code} |
| Math block | $$ ... $$ |
\[ ... \] |
| Environment | ::: theorem ... ::: |
\begin{theorem} ... \end{theorem} |
| Citation | @key |
\cite{key} |
mex is not a replacement for LaTeX.
It is a lightweight writing layer designed to:
- Reduce cognitive load
- Remove repetitive boilerplate
- Let researchers focus on ideas, not formatting
- Clone the repository
- Install in editable mode (
pip install -e .) - Modify the source code
- Add tests and examples
- Submit a pull request
Planned features:
- Lists (
-and numbered1.) - Figures:
 - Bibliography support (
.bibintegration) - Enhanced error messages
- Unit tests and CI pipeline
MIT License © 2025