[racket] Using scribble as a shim for latex

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Mon May 14 11:38:59 EDT 2012

I've been writing my papers in scribble and having a mostly good experience. I use samth's trick of using an "exact" function that maps whatever it gets (almost) directly to latex:

(define exact-style (make-style "identity" '(exact-chars)))
(define (exact . items)
  (make-element exact-style (map content->latex-content items)))

Where "identity" is defined in an extra *.tex file I include with ++style:


I have a big map around content objects to translate out Unicode to The Right Thing. I snatched the big case expression in latex-render.rkt and added many more cases.

Anyway, I now find myself wanting use the listings package to write some pseudocode with mathescape (thus, verbatim is not good enough). I cannot use the identity trick for the lstlisting environment for whatever reason. It causes pdflatex to explode.

That is, (bad):


Why this is, I don't know. However, I don't know a way to generate the good case here. Is this possible? I really hope it is, since I'll have to use latex directly if not.


Posted on the users mailing list.