forked from bfetscher/random-terms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.rkt
67 lines (50 loc) · 2.06 KB
/
common.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#lang racket
(require scribble/core
scribble/latex-properties
scribble/latex-prefix
(except-in slideshow/pict table)
redex/pict
(only-in racket/draw get-face-list))
(provide (all-defined-out))
(define (doc-style)
(style #f (list (latex-defaults
(string->bytes/utf-8
(string-append "\\documentclass[onecolumn, 9pt]{sigplanconf}\n"
unicode-encoding-packages
;"\\usepackage{fullpage}\n"
"\\usepackage{times}\n"
"\\usepackage{qcourier}\n"
"\\usepackage{multicol}\n"))
"style-old.tex"
(list "sigplanconf.cls")))))
(define two-cols (element (style "begin" '(exact-chars))
'("multicols}{2")))
(define one-col (element (style "end" '(exact-chars))
'("multicols")))
(define (text-scale p)
(with-font-params p))
(define-syntax-rule
(with-font-params e1 e2 ...)
(parameterize ([default-font-size 12]
[metafunction-font-size 12]
[default-font-size 12]
[label-font-size 12])
e1 e2 ...))
(define (extend-style style-p [rule "Triplicate T4p"])
(define v (style-p))
(style-p
(let loop ([v v])
(if (pair? v)
(cons (car v) (loop (cdr v)))
#;(cons v rule)
rule))))
(define (extend-style-c style-p)
(extend-style style-p "Triplicate C4p"))
(define (lower-font-by font [n 2])
(font (- (font) 2)))
(when #;(member "Triplicate T4p" (get-face-list)) #f
(for-each extend-style (list grammar-style #;literal-style
non-terminal-style non-terminal-subscript-style
non-terminal-superscript-style))
(for-each extend-style-c (list metafunction-style label-style))
(for-each lower-font-by (list label-font-size metafunction-font-size)))