satex

String diagrams in LaTeX.

https://github.com/smimram/satex

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary

Keywords

latex ocaml string-diagram
Last synced: 6 months ago · JSON representation ·

Repository

String diagrams in LaTeX.

Basic Info
Statistics
  • Stars: 13
  • Watchers: 2
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Topics
latex ocaml string-diagram
Created about 8 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog License Citation

README.md

Satex is a string diagram generator for LaTeX. It takes as input a formula such as (1 * delta) * (mu * 1) (appropriately written in the LaTeX file) and produces a diagram such as

generated using TikZ.

It is inspired from Catex (see also the documentation) for which the sources were unfortunately not available.

In case you have a problem, please file a bug report at the following url: https://github.com/smimram/satex/issues.

Installation

Installing with opam is as simple as

bash opam install satex

General usage

In order to use satex in your LaTeX file, you should first include the style file:

\usepackage{satex}

You should then declare the operators you want to use in the format

\deftwocell[options]{name : m -> n}

which declares an operator named name with m inputs and n outputs. The options in options allow changing the way the operator is displayed and so on. For instance,

\deftwocell[triangle]{mu : 2 -> 1}

will declare the following operator:

One can then generate diagrams by using commands of the form

\twocell{expr}

where expr is a categorical expression involving operators and identities. The identity on n wires is simply written as the corresponding number and compositions are noted *: toplevel compositions are vertical ones and those inside parenthesis are horizontal. For instance

\twocell{(2 * mu) * (1 * mu) * mu}

will typeset

A run of pdflatex on your file, say file.tex, will generate a file named file.satex. You should then run

satex file.satex

which will generate a file file.satix containing the generated TikZ figures, which are automatically included in the next run of pdflatex on your file.

Options for operators

Shapes

Various shapes are available for operators:

  • circle (default one):
  • triangle:
  • rectangle:
  • mergeleft / mergeright: /
  • cup / cap: /
  • crossing / crossingr: /
  • braid / braidl: /
  • crossing' / braid': /
  • blank:

The dimension of the shape can be adjusted with the labelwidth and labelheight parameters.

Labels on operators

Labels are indicated between double quotes. For instance

\deftwocell[triangle,"\mu"]{mu : 2 -> 1}

typesets

Their vertical position can be adjusted with the position parameter (between 0 and 1).

Colors on operators

The color of operators and wires can be changed with color=... options, e.g.

\twocell{((1->1)["\alpha",color=red] * 1) * (1[color=red] * (1->1)["\beta"])}

typesets

Filling colors can also be specified with fill=color option, e.g.

Labels on wires

The special operator label allows adding labels to wires. The option d or u indicates whether the labels should be put down or up, and the above syntax is used for labels. For instance

\twocell{label[d,"x","y"] * mu * label[u,"z"]}

typesets

Inline operators

You can use operators which have not been declared beforehand: the syntax is (m -> n)[options] to use an operator with m inputs, n outputs and given options. For instance,

(1 * (1 -> 2)[rectangle,"f"]) * ((2 -> 1)["g"] * 1)

typesets

Spacing

Horizontal space can be adjusted by using operators of the form space2.8 which adds an horizontal space of 2.8 (formally this is an operator with no inputs and outputs).

Vertical space can be adjusted by changing the height parameter of one of the operators on the line.

Owner

  • Name: Samuel Mimram
  • Login: smimram
  • Kind: user

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: satex
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Samuel
    family-names: Mimram
    orcid: 'https://orcid.org/0000-0002-0767-2569'
repository-code: 'https://github.com/smimram/satex/'
license: GPL-3.0

GitHub Events

Total
  • Watch event: 3
Last Year
  • Watch event: 3

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 2
  • Total pull requests: 1
  • Average time to close issues: about 1 hour
  • Average time to close pull requests: 3 days
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 2.0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Leo-Schelstraete (1)
  • SimonForest (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/build.yml actions
  • actions/checkout v2 composite