[racket] Latex Symbols

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Aug 24 22:02:05 EDT 2014

At Sun, 24 Aug 2014 17:03:56 -0600, Maria Jenkins wrote:
> I am writing a paper and the implementation was done in redex.
> My question is when I render the semantics and state space is there a way to 
> get a wide hat symbol to print out over some of the characters like in latex?

Someone else may have a better answer, but the enclosed example shows
one approach. It implements a rewriter for `in-hat`, which causes the

 (in-hat apple)

to render as "apple" with a hat.

The "hat.scrbl" file just uses the pict in a demo document.

The rewriter for `in-hat` works by first rendering the argument to a
pict. Then, it uses the `dc` pict constructor to generate a hat, where
the function passed to `dc` uses the `racket/draw` library. The hat is
placed on the argument with `pin-over`, which is also from the `pict`
library. Finally, the `refit` helper function makes the generated
representation have the same line and column span as the original so
that it will work right in a larger context.

(None of that is easy; if this is on the right track, then clearly it
belongs in a library.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hat.rkt
Type: application/octet-stream
Size: 2476 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20140824/fb7183e4/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hat.scrbl
Type: application/octet-stream
Size: 58 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20140824/fb7183e4/attachment-0001.obj>

Posted on the users mailing list.