racket / racket/redex

Reduce space between rendered rules of a judgement form

Open
#264 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
112
Forks
42
PR merge metrics
No merged PRs in 30d

Description

I have quite a large judgment form to be rendered for a paper, and I would like to somewhat compact it by reducing the space between the different rules. A standalone excerpt of the judgment form can be found below. To demonstrate, I set all of the "spacing" parameters that I could find to 0, even when they do not affect the rendering of judgment forms.

As a sidenote, I have noticed that, in some cases, the parameter horizontal-bar-spacing reduces only the space above a horizontal bar, and not below. In the screenshot below the code I highlighted one such instance with a red arrow. Possibly related to the inclusion of a unicode union character in the bottom line?

#lang racket

(require redex
         redex/pict)
(define-language CommonLang
  (k ::= number i)
  (p ::= (k ...)) 
  (p-exp ::= k * [script-op (~ k ...)] [script-op k] [⋃ k ...]))

(define-judgment-form
  CommonLang
  #:mode     (matches-in-env I I I)
  #:contract (matches-in-env ps p env)
  
  [--------------------------------- "empty-selector"
   (matches-in-env () () env)]
  [(matches-in-env (p-exp ...) (k_2 ...) env)
   --------------------------------- "literal-key"
   (matches-in-env (k_1 p-exp ...) (k_1 k_2 ...) env)]
  [(matches-in-env (k_1 p-exp ...) (k_2 ...) env)
   --------------------------------- "union-first"
   (matches-in-env ([⋃ k_1 k_3 ...] p-exp ...) (k_2 ...) env)])

(define (render-matches-in-env . filepath)
  (arrow-space 0)
  (label-space 0)
  (reduction-relation-rule-separation 0) 
  (reduction-relation-rule-extra-separation 0)
  (reduction-relation-rule-line-separation 0)
  (horizontal-bar-spacing 0)
  (metafunction-gap-space 0)
  (metafunction-rule-gap-space 0)
  (metafunction-line-gap-space 0)

  (if (empty? filepath)
      (render-judgment-form matches-in-env)
      (render-judgment-form matches-in-env (car filepath))))

The space that I wish to somewhat reduce highlighted with a red bar, and an instance of horizontal-bar-spacing not respecting being set to 0 is highlighted with a red arrow.

annotated-space

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the standalone example and the render-judgment-form entry point, then trace how the listed spacing parameters affect judgment-form layout. Compare the requested compact spacing with the horizontal-bar-spacing behavior shown in the screenshot; done means the rendered rules can be compacted and the highlighted bar spacing behaves consistently.

Written by the indexing model from the issue text.

Assessment

Domain
design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.