;; A small wrapper program that replaces the 'slatex' wrapper script ;; in the SlaTeX distribution. This is the only code that should be ;; changed in this egg without sending patches upstream. (use slatex posix files) (when (< (length (argv)) 2) (print "Usage: " (car (argv)) " [OPTION ...] TEXFILE[.tex] [COMMAND ...]") (print "All options and commands are passed as-is to the (la)tex subcommand") (exit 1)) (define style-path (list (chicken-home) "slatex")) ;; Append our style directory to TEXINPUTS ;; If it's unset, we set it to ':/path/to/slatex-style'. An empty path ;; component is seen as "use the system path here" ;; Not sure if appending or prepending is best. We keep it safe and ;; append, so we don't interfere with existing stuff (prefer system version) (setenv "TEXINPUTS" (string-append (or (get-environment-variable "TEXINPUTS") "") ":" (make-pathname style-path #f))) (set-tex-search-path! (get-environment-variable "TEXINPUTS")) (process-main-tex-file (cadr (argv))) ;; pltexchk.jnk is generated by process-main-tex-file, so check afterwards (define plain-tex? (and (file-exists? "pltexchk.jnk") (begin (delete-file "pltexchk.jnk") #t))) (if plain-tex? (process-execute "tex" (cdr (argv))) (process-execute "latex" (cdr (argv))))