[racket] Using scribble as a shim for latex
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:
\newcommand{\identity}[1]{#1}
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):
\identity{\begin{lstlisting}
Test
\end{lstlisting}}
(good):
\begin{lstlisting}
Test
\end{lstlisting}
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.
-Ian