Skip to content

Commit

Permalink
Don't shrink uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed May 28, 2024
1 parent 5deded2 commit 0bf9adb
Show file tree
Hide file tree
Showing 3 changed files with 1,038 additions and 1,037 deletions.
3 changes: 2 additions & 1 deletion spectec/src/backend-latex/render.ml
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ let lower = String.lowercase_ascii

let dash_id = Str.(global_replace (regexp "-") "{-}")
let quote_id = Str.(global_replace (regexp "_+") "\\_")
let shrink_id = Str.(global_replace (regexp "[0-9A-Z]+") "{\\\\scriptstyle \\0}")
let shrink_id = Str.(global_replace (regexp "[0-9]+") "{\\\\scriptstyle \\0}")
let rekernl_id = Str.(global_replace (regexp "\\([a-z]\\)[{]") "\\1{\\kern-0.1em")
let rekernr_id = Str.(global_replace (regexp "[}]\\([a-z{]\\)") "\\kern-0.1em}\\1")
let macrofy_id = Str.(global_replace (regexp "[_.]") "")
Expand All @@ -667,6 +667,7 @@ Printf.eprintf "[id w/o macro] %s%s\n%!" (if style = `Func then "$" else "") id;
*)
let id' = quote_id id in
let id'' =
(* TODO: provide a way to selectively shrink uppercase vars, esp after # *)
match style with
| `Var | `Func -> rekernl_id (rekernr_id (shrink_id id'))
| `Atom -> shrink_id (lower id')
Expand Down
Loading

0 comments on commit 0bf9adb

Please sign in to comment.