A best-effort converter for transforming Draw.io diagrams into Ipe XML format, enabling seamless integration of diagrams into LaTeX documents.
While Draw.io is excellent for creating diagrams, Ipe offers crucial advantages for academic and technical publishing:
Ipe uses a complete LaTeX compiler for all text elements, which means:
- Perfect font matching: Your diagram fonts will exactly match your document's font family, size, and style
- Full preamble support: Load any LaTeX packages (
amsmath,tikz,pgf, custom macros) via the Ipe page preamble - Consistent math rendering: Mathematical formulas use the same LaTeX engine as your document, ensuring identical spacing, symbols, and styling
- Page-level consistency: Define colors, pen styles, and layers at the document level that persist across all figures
- Vector output that integrates natively with PDFLaTeX workflows
- Precise control over label positioning and alignment
- Layers for organizing complex diagrams
- Native support for references and cross-referencing within figures
- Python 3.13+ with
piporuv(earler Python versions likely work as well) - Ipe (optional, for viewing/editing output): https://ipe.otfried.org/
Using uv (recommended):
uv syncOr using standard pip:
pip install .For development purposes, install as editable:
pip install -e .# Using uv
uv run convert.py input.drawio output.ipe
# Using Python directly
python convert.py input.drawio output.ipeuv run convert.py --help
Options:
--scale SCALE Scale factor to convert Draw.io pixels to Ipe points
(default: 0.75). Adjust if diagram appears too large/small.
--margin MARGIN Extra margin in Ipe points added around the page
(default: 0.0)
--creator NAME Creator string stored in Ipe metadata
(default: drawdotipe)
-v, --verbose Enable verbose output showing conversion progress# Standard conversion
uv run convert.py diagram.drawio diagram.ipe
# With verbose output
uv run convert.py -v diagram.drawio diagram.ipe
# Adjust scale for different sizing
uv run convert.py diagram.drawio diagram.ipe --scale 0.6
# Add margin around the page
uv run convert.py diagram.drawio diagram.ipe --margin 20The converter handles the most common Draw.io primitives needed for LaTeX workflows:
- Rectangles and rounded rectangles
- Ellipses and double ellipses
- Text labels with basic HTML formatting
- LaTeX math mode (
$$...$$→$...$) - Lines and polylines with waypoints
- Edges with arrowheads (start, end, or both)
- Dashed and dotted lines
- Group transformations
- Custom colors (hex and named)
- Stroke width and fill colors
- Complex shapes (actors, clouds, etc.) are approximated as rectangles
- Image exports are not supported (vector shapes only)
- Some Draw.io-specific styling may be simplified
- Multi-page diagrams export the first page only
- Create your diagram in Draw.io as usual
- Export as
.drawiofile (File → Export As → Draw.io) - Convert using this tool
- Open in Ipe to fine-tune positioning, add LaTeX preamble, or adjust styles
- Include in LaTeX with
\includegraphics{figure.ipe}(usinggraphicxwith Ipe support) or export to PDF
After conversion, open the .ipe file in Ipe and edit the document properties:
- Go to Document Properties → LaTeX Preamble
- Add your document's preamble:
\usepackage{amsmath, amssymb} \usepackage{mathpazo} % Match document font \pagestyle{empty}
- Save and your diagram now uses the exact same typesetting as your paper
drawioipe/
├── convert.py # Main conversion script
├── pyproject.toml # Project configuration
├── tests/ # Test suite
This project is licensed under the MIT License - see the LICENSE file for details.
Run the test suite with pytest:
uv run pytestContributions are welcome! Feel free to submit issues or pull requests for:
- Support for additional Draw.io shapes
- Better styling preservation
- Multi-page diagram handling
- Performance improvements
- Draw.io (diagrams.net) for the excellent diagramming tool
- Otfried Cheong for creating Ipe
- The LaTeX community for making professional typesetting accessible