π LaTeX to MDX Integration
This space allows the automatic conversion of any latex content to MDX for Astro, with real time monitoring!
π Usage
π LaTeX Structure to follow
Place your LaTeX sources as such :
app/scripts/latex-to-mdx/input/
βββ main.tex # Main doc
βββ main.bib # Bibliography
βββ sections/ # Sections or chapters
β βββ 01_introduction.tex
β βββ 02_methods.tex
β βββ ...
βββ figures/ # Images
βββ ... # Other LaTeX files
Now you can start the development server!
Development mode with LaTeX Watch
npm run dev:with-latex
This commands :
- β Converts LaTeX β MDX
- π Monitors the contents of
scripts/latex-to-mdx/input/for any change - π Launches an Astro server on http://localhost:4321
- π Regerenates
article.mdxautomatically when you do changes to the latex files!
Production Mode
npm run build
Other individual scripts
# Converts LaTeX β MDX once
npm run latex:convert
# Monitors the LaTeX repo only
npm run latex:watch
# Runs Astro without looking on latex (to edit the markdown files directly for example)
npm run dev
βοΈ Features
- π Automated conversion : 2 seconds per conversion
- π Monitoring : Of everything in
input/ - π Hot reload : Astro reloads after each conversion
- π Colored logs : To differenciate LaTeX/Astro
π³ Docker
Everything runs in a Dockerfile, which includes the automatic installation of pandox, the conversion of Latex to MDX before the build, and supports the latex env!
π οΈ Debugging
If the conversion fails:
- Check the LaTeX logs (blue ones)
- Check if Pandoc is installed properly
- Check the manual conversion with
npm run latex:convert