jhvst / penrose

Create beautiful diagrams just by typing notation in plain text.

Home Page:https://penrose.cs.cmu.edu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Penrose npm (scoped) license Build Discord Twitter: @UsePenrose

Penrose is a platform that enables people to create beautiful diagrams just by typing mathematical notation in plain text. The goal is to make it easy for non-experts to create and explore high-quality diagrams and provide deeper insight into challenging technical concepts. We aim to democratize the process of creating visual intuition.

Check out our SIGGRAPH '20 paper and video on Penrose!

Usage

You can try Penrose in your browser without any installation. For a more detailed step-by-step introduction, check out our tutorials. Or, for more reference-style information, take a look at our documentation.

Example

Here's a simple Penrose visualization in the domain of set theory.

It's specified by the following trio of Domain, Substance, and Style programs (with variation PlumvilleCapybara104):

  • setTheory.domain:

    type Set
    
    predicate Not(Prop p1)
    predicate Intersecting(Set s1, Set s2)
    predicate IsSubset(Set s1, Set s2)
    
  • tree.substance:

    Set A, B, C, D, E, F, G
    
    IsSubset(B, A)
    IsSubset(C, A)
    IsSubset(D, B)
    IsSubset(E, B)
    IsSubset(F, C)
    IsSubset(G, C)
    
    Not(Intersecting(E, D))
    Not(Intersecting(F, G))
    Not(Intersecting(B, C))
    
    AutoLabel All
    
  • venn.style:

    canvas {
      width = 800
      height = 700
    }
    
    forall Set x {
      x.icon = Circle {
        strokeWidth : 0
      }
    
      x.text = Equation {
        string : x.label
        fontSize : "32px"
      }
    
      ensure contains(x.icon, x.text)
      encourage sameCenter(x.text, x.icon)
      x.textLayering = x.text above x.icon
    }
    
    forall Set x; Set y
    where IsSubset(x, y) {
      ensure disjoint(y.text, x.icon, 10)
      ensure contains(y.icon, x.icon, 5)
      x.icon above y.icon
    }
    
    forall Set x; Set y
    where Not(Intersecting(x, y)) {
      ensure disjoint(x.icon, y.icon)
    }
    
    forall Set x; Set y
    where Intersecting(x, y) {
      ensure overlapping(x.icon, y.icon)
      ensure disjoint(y.text, x.icon)
      ensure disjoint(x.text, y.icon)
    }
    

Contributing

See CONTRIBUTING.md.

License

This repository is licensed under the MIT License.

About

Create beautiful diagrams just by typing notation in plain text.

https://penrose.cs.cmu.edu

License:MIT License


Languages

Language:TypeScript 77.0%Language:HTML 13.7%Language:Nearley 2.0%Language:Mathematica 1.9%Language:JavaScript 1.7%Language:Rust 1.3%Language:CSS 1.2%Language:Vue 0.7%Language:Emacs Lisp 0.3%Language:Vim Script 0.2%Language:Python 0.1%Language:Shell 0.0%