C  Configuring TeX2page

TeX2page is available on GitHub.

git clone https://github.com/ds26gte/tex2page 

produces a directory called tex2page, which contains, among other files: the Scheme file tex2page, the Common Lisp file tex2page.lisp, the plain TeX file tex2page.tex, and the LaTeX package tex2page.sty.

Put copies of (or links to) the files tex2page.tex and tex2page.sty in a directory that is mentioned in your TEXINPUTS environment variable.

TeX2page out of the box (Racket)

If you run Racket [30] on a Unix (including Mac OS X and Cygwin [20]), setup is minimal. Simply put a copy of (or link to) the Scheme file tex2page in a directory in your PATH environment variable.

If you run Racket on Windows, copy the supplied batchfile tex2page.bat to your PATH, and edit its contents so it contains the correct pathnames to your Racket executable and tex2page file.

TeX2page out of the box (Common Lisp)

If you run a Common Lisp on a Unix, you can use the supplied script tex2page.lisp after setting the environment variable LISP to the name of your Lisp implementation. You may rename tex2page.lisp to tex2page.

Set LISP to abcl for ABCL [1], allegro for Allegro [19], clisp for CLISP [15], clozure for Clozure [6], cmucl for CMUCL [7], ecl for ECL [12], and sbcl for SBCL [35].

The top few lines in tex2page.lisp contain the lines that invoke Lisp --- if they don’t already address your particular Lisp implementation, you may need to add a line based on your Lisp’s command line options.

When explicit configuration is needed

In general, you need to configure TeX2page so it runs on your system. Even in cases where the supplied script runs ‘‘out of the box’’ for your setup, it may still be a good idea to do an explicit configuration. In particular, for SBCL, configuration produces a compiled executable that is substantially faster than the script tex2page.lisp.

Using ./configure

This method may not always work but is so easy that it’s worth a try. It should work for most dialects on Unix.

1.  

Type ./configure ‑‑help at your OS command line to get the list of dialects supported. If your dialect D is one of them,

2.  

Type ./configure ‑‑dialect=D

If all goes well, this will create my‑tex2page, a version of tex2page for your system.

TeX2page is known to configure for the Scheme dialects Chicken [5], Gambit [9], Gauche [22], Guile [10], Petite Chez [36] and Racket [30]; and the Common Lisp implementations ABCL, Allegro, CLISP, Clozure, CMUCL, ECL, and SBCL.

Using Scmxlate directly

The ./configure ‑‑dialect=D approach above essentially takes care to call Scmxlate (if needed) as described in this section, but unfortunately it may not work for some dialects or operating systems. In such cases, you can manually call Scmxlate, which isn’t really all that tedious.

First ensure that Scmxlate is installed on your system. Note down the pathname of the file scmxlate.scm in the unpacked scmxlate directory.

Optionally, edit the file scmxlate‑tex2page in the tex2page directory. (Leaving it as is is just fine.) Possible insertions are:

(scmxlate-compile #t)

(define *ghostscript* "pathname-of-your-ghostscript-program")

The first produces a compiled version of tex2page. The second lets you supply the correct pathname for the Ghostscript executable. (TeX2page will guess the Ghostscript pathname, but there is a possibility it guesses wrong on Windows.)

Start your Scheme (or Common Lisp) in the tex2page directory. Load the file scmxlate.scm from the scmxlate distribution, using the correct relative or full pathname of scmxlate.scm. For example,

(load "/home/dorai/share/scmxlate/scmxlate.scm")

(assuming you unpacked Scmxlate in /home/dorai/share). You will be asked a couple of questions about your setup. A choice of answers will be provided, so you don’t need to be too creative. When Scmxlate finishes, you will be left with a version of tex2page called my‑tex2page, tailormade for your system.

Installation in PATH

On Unix, put a copy of (or link to) my‑tex2page in a directory in your PATH. You may wish to rename it to tex2page.

On Windows, a batch file called tex2page.bat is also created. Move it to a directory in your PATH. Edit the contents of tex2page.bat so that the pathnames it refers to are correct.

Can’t create or don’t want a tex2page script?

If the configuration process cannot create an appropriate script file for you to put in your PATH, or if you prefer working within Scheme anyway instead of at the OS command-line, you can still use TeX2page. Simply load your tex2page Scheme file (whether the given script or your configured version) directly into your Scheme, and then call the Scheme procedure tex2page on your source document. E.g.,

(load "tex2page")
(tex2page "tex2page-doc.tex")

Once loaded, the procedure tex2page can be called several times from the same Scheme session, on the same file (to resolve cross-references) or on different files.

If using the Common Lisp of TeX2page, the loading process is the same, but note that the Common Lisp version of TeX2page encloses all TeX2page-related code inside a Lisp package named tex2page. Thus, you should call the function tex2page by its package-qualified name, tex2page:tex2page:

(tex2page:tex2page "tex2page-doc")