# Lua Hyperbolic Geometry


> [!Note]
> Luahyperbolic is still in an early development phase.
> Changes and bug fixes are happening frequently, check the changelog in the documentation.

**luahyperbolic** is a LaTeX package and a Lua library for performing operations and drawing pictures in hyperbolic geometry, intended for use with LuaLaTeX. The package provides complex number manipulation and hyperbolic geometric functions.

![triangle_tiling_5_4](examples/triangle-tiling-2-4-5.png)

## Example Usage

A minimal working example is (see `minimal_example.tex`in `examples/`) :

```latex
\documentclass[margin=.2cm,multi,tikz]{standalone}
\usepackage{luahyperbolic} %loads luacode package
\begin{document}
\begin{luacode*}
hyper.tikzBegin("scale=2.5")
local P = complex(0.5,-0.2)
local A = complex.exp_i(math.pi/10)
for k=1,5 do hyper.drawLine(P, A^k, "teal") end
hyper.labelPoint(P, "$P$", "left=.2cm")
hyper.drawLine(complex.J,-complex.I,"very thick, dashed, red")
hyper.tikzEnd("myfile.tikz")
\end{luacode*}
\end{document}
```

Compiling that file with `lualatex` produces the following output:

![minimal example](minimal-example.png)

It also saves the TikZ picture to `myfile.tikz`, for later use. (Optional)

See the [package documentation (pdf)](documentation-luahyperbolic.pdf) for numerous examples.

More examples in [examples/](examples/)

## License

This package is released under the **Public Domain (CC0 1.0 Universal License)**. You may use, modify, and distribute it freely, without restriction.

For more information on the license, see the `LICENSE` file or visit [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/).

## Installation

### Quick use (no installation)

The simplest way to use the package is to place the file: `luahyperbolic.sty` in the same directory as your `.tex` document.

Then include it with:

```latex
\usepackage{luahyperbolic}
```

---

### User installation (recommended)

To make the package available to all your documents, install it in your personal TEXMF tree.

1. Find your TEXMFHOME directory:

   ```bash
   kpsewhich -var-value=TEXMFHOME
   ```

2. Copy the file to:

   ```
   <TEXMFHOME>/tex/latex/luahyperbolic/
   ```

If the directory does not exist, create it.

3. No further action is usually required; LaTeX will automatically find the package.

---

### System-wide installation (advanced)

To install the package for all users, place it in the local TeX tree (requires administrative privileges):

```
/usr/local/texlive/texmf-local/tex/latex/luahyperbolic/
```

Then refresh the file database:

```bash
sudo mktexlsr
```

---

### Notes

- Do **not** place files in `texmf-dist`, as this directory is managed by your TeX distribution and may be overwritten during updates.


## Contact

Do you really need to contact me ? ...
