# marekjaskula/bustrofedon architecture

> Architecture diagram of the GitHub repository marekjaskula/bustrofedon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marekjaskula/bustrofedon
- Repository: https://github.com/marekjaskula/bustrofedon

## Overview

`bustrofedon` is a LuaLaTeX package that alternates the visual direction of finished text lines while leaving TeX’s paragraph breaking intact. The workflow is: an author loads the LaTeX interface and marks text; LuaTeX lays out the paragraph and invokes the package’s Lua callback; the callback reflects selected lines, and LuaTeX produces the PDF. Settings such as starting direction and continuous counting belong to the interface. Source excerpts were not provided, so runtime relationships shown here are supported by the README only.

Main entry points: [`bustrofedon.sty`](https://github.com/marekjaskula/bustrofedon/blob/main/bustrofedon.sty) (LaTeX interface and settings), [`bustrofedon.lua`](https://github.com/marekjaskula/bustrofedon/blob/main/bustrofedon.lua) (Line reflection callback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Package interface"]
  node_latex_interface["LaTeX interface and settings<br/>[bustrofedon.sty]"]
end

subgraph group_processing["Line processing"]
  node_lua_callback["Line reflection callback<br/>[bustrofedon.lua]"]
end

subgraph group_runtime["Typesetting runtime"]
  node_luatex["LuaTeX typesetter"]
  node_pdf["Typeset PDF"]
end

node_author(("Document author"))

node_author -->|"loads and configures"| node_latex_interface
node_latex_interface -->|"marks text"| node_luatex
node_luatex -->|"invokes callback"| node_lua_callback
node_lua_callback -->|"reflects selected lines"| node_luatex
node_luatex -->|"produces"| node_pdf

click node_latex_interface "https://github.com/marekjaskula/bustrofedon/blob/main/bustrofedon.sty"
click node_lua_callback "https://github.com/marekjaskula/bustrofedon/blob/main/bustrofedon.lua"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_latex_interface toneBlue
class node_lua_callback toneAmber
class node_luatex,node_pdf toneMint
class node_author toneIndigo
```

## Components

### Package interface

- [LaTeX interface and settings](https://github.com/marekjaskula/bustrofedon/blob/main/bustrofedon.sty): `bustrofedon.sty`

### Line processing

- [Line reflection callback](https://github.com/marekjaskula/bustrofedon/blob/main/bustrofedon.lua): `bustrofedon.lua`

### Typesetting runtime

- **LuaTeX typesetter**
- **Typeset PDF**

### Other components

- **Document author**

## Connections

- Document author → LaTeX interface and settings: loads and configures (evidence: `README.md`)
- LaTeX interface and settings → LuaTeX typesetter: marks text (evidence: `README.md`)
- LuaTeX typesetter → Line reflection callback: invokes callback (evidence: `README.md`)
- Line reflection callback → LuaTeX typesetter: reflects selected lines (evidence: `README.md`)
- LuaTeX typesetter → Typeset PDF: produces (evidence: `README.md`)
