{"id":22698072,"url":"https://github.com/quadnucyard/pavemat","last_synced_at":"2026-01-07T09:34:44.359Z","repository":{"id":250441304,"uuid":"832956511","full_name":"QuadnucYard/pavemat","owner":"QuadnucYard","description":"Empower typst matrices with dividing lines and color blocks","archived":false,"fork":false,"pushed_at":"2025-03-11T11:00:30.000Z","size":373,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T12:19:25.473Z","etag":null,"topics":["matrix","typst"],"latest_commit_sha":null,"homepage":"","language":"Typst","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QuadnucYard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-24T04:36:07.000Z","updated_at":"2025-03-11T11:00:34.000Z","dependencies_parsed_at":"2024-11-27T06:36:03.226Z","dependency_job_id":null,"html_url":"https://github.com/QuadnucYard/pavemat","commit_stats":null,"previous_names":["quadnucyard/pavemat"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadnucYard%2Fpavemat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadnucYard%2Fpavemat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadnucYard%2Fpavemat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadnucYard%2Fpavemat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuadnucYard","download_url":"https://codeload.github.com/QuadnucYard/pavemat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246225801,"owners_count":20743622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matrix","typst"],"created_at":"2024-12-10T05:18:05.895Z","updated_at":"2026-01-07T09:34:44.347Z","avatar_url":"https://github.com/QuadnucYard.png","language":"Typst","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pavemat\n\n![version](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2FQuadnucYard%2Fpavemat%2Frefs%2Fheads%2Fmain%2Ftypst.toml\u0026query=%24.package.version\u0026label=version\u0026color=orange)\n[![Universe](https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Ftypst.app%2Funiverse%2Fpackage%2Fpavemat\u0026query=%2Fhtml%2Fbody%2Fdiv%2Fmain%2Fdiv%5B2%5D%2Faside%2Fsection%5B2%5D%2Fdl%2Fdd%5B3%5D\u0026logo=typst\u0026label=Universe\u0026color=%2339cccc)](https://typst.app/universe/package/pavemat)\n[![Repo](https://img.shields.io/badge/GitHub-repo-blue)](https://github.com/QuadnucYard/pavemat)\n[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://quadnucyard.github.io/pavemat/)\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./examples/logo.svg\"/\u003e\n  \u003cp\u003e\u003cstrong\u003e \u003cu\u003epave\u003c/u\u003ement + \u003cu\u003emat\u003c/u\u003erix \u003c/strong\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n## Introduction\n\nPavemat provides a simple function `pavemat` for creating styled matrices with customizable paths, strokes, and fills. It allows users to define how paths should be drawn through the matrix, apply different strokes to these paths, and fill specific cells with various colors. This can be used for visualizing data structures and matrices, and creating custom grid layouts.\n\n## Key Features\n\n- **Custom Paths**: Easily define matrix paths using directional characters.\n- **Stroke Styles**: Customize the appearance of path lines with different dash patterns, thicknesses, and colors.\n- **Cell Fills**: Highlight specific cells (even connected blocks) with chosen colors.\n- **Custom Direction Characters**: Override default directional characters when needed.\n- **Debug Mode**: Visualize hidden lines to assist with troubleshooting.\n- **Style Inheritance**: Contextual styles (e.g., gaps and alignment) are automatically applied to pavemat, though you can explicitly set them if desired.\n\n\u003e [!NOTE]\n\u003e Pavemat uses a slightly different layout model than `math.mat` when handling gaps. Extra row gaps are added as cell insets above the first row and below the last row. On the other hand, this meets the needs of cell filling.\n\n## How it works\n\nSince `math.mat` lacks support for cell fills and strokes, pavemat rebuilds the layout using a grid. Each matrix element becomes an individual cell with its own fill, and delimiters are provided by a `math.vec` wrapper.\n\nTo prevent overlapping just as `math.mat` and make elements in each row align with baselines, pavemat measures the bounds of each row, inserts zero-width boxes to adjust text top edges, and sets row heights based on bounding box dimensions. This approach works reliably in many cases, though it may not be perfect for every display style.\n\n## Examples\n\nThe logo example:\n\n```typst\n#import \"@preview/pavemat:0.2.0\": pavemat\n\n#set math.mat(row-gap: 0.25em, column-gap: 0.1em)\n#set text(size: 2em)\n\n#pavemat(\n  pave: (\n    \"SDS(dash: 'solid')DDD]WW\",\n    (path: \"sdDDD\", stroke: aqua.darken(30%))\n  ),\n  stroke: (dash: \"dashed\", thickness: 1pt, paint: yellow),\n  fills: (\n    \"0-0\": green.transparentize(80%),\n    \"1-1\": blue.transparentize(80%),\n    \"[0-0]\": green.transparentize(60%),\n    \"[1-1]\": blue.transparentize(60%),\n  ),\n  delim: \"[\",\n)[$mat(P, a, v, e; \"\", m, a, t)$]\n```\n\nMore examples can be found in `examples/examples.typ`:\n\n---\n\n![](./examples/example1.svg)\n\n```typst\n#pavemat(\n  a,\n  pave: \"dSDSDSLLAAWASSDD\",\n  fills: (\n    \"1-1\": red.transparentize(80%),\n    \"1-2\": blue.transparentize(80%),\n    \"3-0\": green.transparentize(80%),\n  ),\n)\n```\n\n---\n\n![](./examples/example2.svg)\n\n```typst\n#pavemat(\n  a,\n  pave: (\n    path: \"AA(paint: red, thickness: 2pt)WdD(paint: blue)Ww(thickness: 1pt, dash: 'dotted')AaS]Aw]W]D\",\n    from: \"bottom-right\",\n  ),\n  fills: maroon.transparentize(90%),\n)\n```\n\n---\n\n![](./examples/example4.svg)\n\n```typst\n#pavemat(\n  a,\n  pave: (\n    (path: \"WASD\", from: (2, 2)),\n    (path: \"WDSA\", from: \"bottom-left\", stroke: red + 0.5pt),\n    (path: \"DSAW\", from: (3, 2)),\n  ),\n  stroke: blue + 1pt,\n  fills: (\n    \"\": green.transparentize(80%),\n    \"0-0\": red.transparentize(80%),\n    \"3-2\": blue.transparentize(80%),\n  ),\n  delim: \"[\",\n)\n```\n\n---\n\n![](./examples/example5.svg)\n\n```typst\n#pavemat(\n  math.mat(..range(5).map(i =\u003e range(5).map(j =\u003e i * 5 + j)), align: right),\n  pave: (\n    (path: \"DDDDDRUUUUU\", from: (0, 2)),\n    (path: \"RRRRRDLLLLL\", from: (2, 0)),\n  ),\n  fills: (\n    \"\": green.transparentize(80%),\n    \"top-left\": red.transparentize(80%),\n    \"3-right\": blue.transparentize(80%),\n    \"[bottom-left]\": blue.transparentize(80%),\n  ),\n  dir-chars: (up: \"U\", down: \"D\", left: \"L\", right: \"R\"),\n  block: true,\n  delim: none,\n)\n```\n\n## License\n\nThis project is licensed under the terms of the MIT License. See the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquadnucyard%2Fpavemat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquadnucyard%2Fpavemat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquadnucyard%2Fpavemat/lists"}