A  Also in Scheme

The TeX2page distribution comes with two scripts, tex2page.lisp and tex2page.rkt. Each works without any further configuration, the first in Common Lisp, the second in Scheme, specifically Racket. You should be able to run either script on any document, and for the most part you will get identical results. We will now mention the few situations where the Scheme script differs from the Common Lisp version.

See Appendix C (p. 14) for details on how to obtain a script that works on Schemes other than Racket.

When you get the script of your choice configured, you may copy or link it to tex2page and put it in your PATH.

Calling TeX2page from Scheme

As with the CL version, you can load the Scheme script into your Scheme and call the tex2page procedure. The difference is that there is no package qualification to refer to the procedure name, e.g.,

(load "tex2page") ;use appropriate pathname

(tex2page filename)

eval

\eval works for Scheme versions of TeX2page too. The difference of course is that the \eval-enclosed code must be in Scheme rather than Common Lisp. (You can also use the Scheme names (procedures and other, global values) added by the script, and for the most part these names are identical across Scheme and Common Lisp.)

E.g., the all‑blanks‑p procedure defined in Chapter 10 would look like this in the Scheme situation:

(define all-blanks?
  (lambda (s)
    (let loop ((L (string->list s)))
      (if (null? L) #t
          (let ((c (car L)))
            (if (char-whitespace? c) (loop (cdr L))
                #f))))))

It is of course possible to keep your TeX document language-proof by using a conditional on the flag \TZPcommonlisp. This is set to 1 in Common Lisp and 0 in Scheme: Use \ifx to create two branches, e.g.,

\ifx\TZPcommonlisp 1
\eval{
  ...  Common Lisp code ...
}\else
\eval{
  ...  Scheme version of the same code ...
}\fi

That is what this manual did to keep it processable in both versions of TeX2page.