Split slatex from the main repository.

Source for `slatex` is now available from:
  https://github.com/racket/slatex/
This commit is contained in:
Sam Tobin-Hochstadt 2014-11-30 13:00:16 -05:00
parent 73d06ec24c
commit fe934dfe89
15 changed files with 1 additions and 3550 deletions

View File

@ -62,7 +62,6 @@
"serialize-cstruct-lib"
"sgl"
"shell-completion"
"slatex"
"slideshow"
"snip"
"srfi"

View File

@ -11,6 +11,7 @@
("distro-build-server" "git://github.com/racket/distro-build/?path=distro-build-server")
("distro-build-lib" "git://github.com/racket/distro-build/?path=distro-build-lib")
("distro-build" "git://github.com/racket/distro-build/?path=distro-build")
("slatex" "git://github.com/racket/slatex")
"sha"
"http"
"aws"

View File

@ -1142,7 +1142,6 @@ path/s is either such a string or a list of them.
"pkgs/shell-completion" responsible (samth sstrickl stamourv)
"pkgs/shell-completion/racket-completion.bash" drdr:command-line #f
"pkgs/shell-completion/racket-completion.zsh" responsible (eli)
"pkgs/slatex" responsible (sstrickl)
"pkgs/slideshow-pkgs" responsible (mflatt robby)
"pkgs/slideshow-pkgs/slideshow-exe/slideshow/examples/interlocking-components.scm" drdr:command-line #f
"pkgs/snip-pkgs" responsible (mflatt)

View File

@ -1,11 +0,0 @@
slatex
Copyright (c) 2010-2014 PLT Design Inc.
This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary
applications, provided you follow the rules stated in the LGPL. You
can also modify this package; if you distribute a modified version,
you must distribute it under the terms of the LGPL, which in
particular means that you must release the source code for the
modified software. See http://www.gnu.org/copyleft/lesser.html
for more information.

View File

@ -1,22 +0,0 @@
This collection contains Dorai Sitaram's slatex. Unlike prior versions of this
collection, it contains only the 'translated' --- that is, the mzscheme-specific
--- version of slatex. This means that an update to slatex can only be incorporated
into the PLT collects world by manually running scmxlate and placing the resulting
file into this collection.
Instructions for updating to a new version of SLaTeX (for the maintainer of this
collection):
1) Follow Dorai's instructions for generating the file 'slatex.scm' (currently,
this involves downloading the 'scmxlate' and 'slatex' packages and loading
the scmxlate.scm file while (current-directory) points to the slatex
directory.
2) place this file in $PLTHOME/collects/slatex/private.
3) also copy slatex.sty to $PLTHOME/collects/slatex.
4) (hopefully temporary?) Modify slatex.scm so that it doesn't refer to
slatex::slatex-error at evaluation time.
5) check it in.

View File

@ -1,27 +0,0 @@
#lang info
(define collection "slatex")
(define scribblings '(("slatex-wrap.scrbl" () (tool-library))))
;; (define tools (list (list "slatex-lang.rkt")))
;; (define tool-names (list "SLaTeX Language"))
(define mzscheme-launcher-names '("SLaTeX" "PDF SLaTeX"))
(define mzscheme-launcher-libraries '("slatex-launcher.rkt"
"pdf-slatex-launcher.rkt"))
(define deps '("scheme-lib"
"base"
"compatibility-lib"))
(define build-deps '("racket-index"
"eli-tester"
"racket-doc"
"scribble-lib"))
;; Make slatex.sty easier to find (for adding to TEXINPUTS)
;; by copying it to the "share" directory. Same for rubber support:
(define copy-shared-files '("slatex.sty" "slatex.py"))
(define pkg-desc "SLaTeX (Scheme in LaTeX)")
(define pkg-authors '(sstrickl))

View File

@ -1,36 +0,0 @@
(module pdf-slatex-launcher mzscheme
(require "slatex-wrapper.rkt"
scheme/cmdline)
(module test racket/base)
(define argv (current-command-line-arguments))
(define no-latex (make-parameter #f))
(case (system-type)
[(macos)
;; set up drag and drop
(error 'slatex "pdf-slatex not supported under Mac OS Classic")]
[(windows unix macosx)
(when (equal? (vector) argv)
(eprintf "pdf-slatex: expected a file on the command line\n")
(exit 1))
(let* ([filename
(command-line
#:program "slatex"
#:once-each
[("-n" "--no-latex") "Just preprocess, don't run LaTeX"
(no-latex #t)]
#:args (filename)
filename)]
[result
(parameterize ([error-escape-handler exit])
(if (no-latex)
(slatex/no-latex filename)
(pdf-slatex filename)))])
(if result
(exit)
(exit 1)))]))

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
(module slatex-launcher scheme/base
(require "slatex-wrapper.rkt"
scheme/cmdline)
(module test racket/base)
(define argv (current-command-line-arguments))
(define no-latex (make-parameter #f))
(case (system-type)
[(macos)
;; set up drag and drop
(current-load slatex)
(for-each slatex (vector->list argv))]
[(windows unix macosx)
(let* ([filename
(command-line
#:program "slatex"
#:once-each
[("-n" "--no-latex") "Just preprocess, don't run LaTeX"
(no-latex #t)]
#:args (filename)
filename)]
[result
(parameterize ([error-escape-handler exit])
(if (no-latex)
(slatex/no-latex filename)
(slatex filename)))])
(if result
(exit)
(exit 1)))]))

View File

@ -1,63 +0,0 @@
#lang scribble/doc
@(require scribble/manual
(for-label scheme/base
slatex/slatex-wrapper))
@(define latex @exec{latex})
@(define pdflatex @exec{pdf-latex})
@(define slatex @exec{slatex})
@title{SLaTeX Wrapper}
@defmodule[slatex/slatex-wrapper]
To use SLaTeX as a standalone program, either drag your
@filepath{.tex} file onto SLaTeX (on Windows or MacOS X), or type
@exec{slatex file} in a command shell.
@emph{NOTE:} If you compile your @filepath{.tex} file without using
@exec{slatex} (i.e., by using @exec{slatex -n} and then using @exec{latex}
directly), then your @envvar{TEXINPUTS} environment variable must contain
a reference to the directory in which the most recent version of
@filepath{slatex.sty} lives. That file resides by default in the @filepath{slatex}
collection of the main installation.
In addition to the SLaTeX tools, this collection contains a parallel
set of PDF-SLaTeX tools, which are identical except that they
call @pdflatex rather than @|latex|. In particular, there is now a
launcher called (PDF-SLaTeX/pdf-slatex).
@deftogether[(
@defproc[(slatex (filename string?)) boolean?]
@defproc[(pdf-slatex (filename string?)) boolean?])]{
Accepts a string naming a file and runs @slatex and @latex on the
file. It calls @racket[filename->latex-filename] on @racket[filename].
@racket[pdf-slatex] is like @racket[slatex] except that it calls
@pdflatex rather than @latex, and produces PDF output instead of PS
output.}
@defproc[(slatex/no-latex (filename string?)) void?]{
Runs @slatex on the file named by @racket[filename], without calling
@|latex|. That is, it only processes the @filepath{.tex} file to
produce the @filepath{.Z} files. It calls
@racket[filename->latex-filename] on @racket[filename].}
@deftogether[(
@defproc[(latex (filename string?)) boolean?]
@defproc[(pdf-latex (filename string?)) boolean?])]{
Runs @latex on the file named by @racket[filename]. It calls
@racket[filename->latex-filename] on @racket[filename].
@racket[pdf-latex] is like @racket[latex] except that it calls
@pdflatex rather than @latex, and produces PDF output instead of PS
output.}
@defproc[(filename->latex-filename (filename string?)) string?]{
Accepts a filename and, if that file exists, it returns it. If the
filename appended with the suffix @filepath{.tex} exists, that
filename is returned. Otherwise, an exception is raised.}

View File

@ -1,113 +0,0 @@
(module slatex-wrapper scheme/base
(require mzlib/file
scheme/contract
mzlib/process
mzlib/sendevent
scheme/runtime-path
"private/slatex.rkt")
(define-runtime-path here ".")
(provide/contract
[slatex (string? . -> . boolean?)]
[pdf-slatex (string? . -> . boolean?)]
[slatex/no-latex (string? . -> . void?)]
[latex (string? . -> . boolean?)]
[pdf-latex (string? . -> . boolean?)]
[filename->latex-filename (string? . -> . string?)])
(define (add-suffix p s)
(path->string
(bytes->path
(bytes-append
(path->bytes (if (string? p) (string->path p) p)) s))))
(define (filename->latex-filename input-file)
(let* ([norm (normalize-path input-file)])
(cond
[(file-exists? norm) input-file]
[(file-exists? (add-suffix norm #".tex"))
(add-suffix input-file #".tex")]
[else
(error 'filename->latex-filename "~e does not exist" input-file)])))
(define (exec-latex exe file)
(let ([latex-path (find-executable-path exe #f)])
(unless latex-path
(error 'latex "could not find latex binary: ~e" exe))
(system* latex-path file)))
;; latex, pdf-latex : string -> boolean
;; boolean result indicates success
(define-values (latex pdf-latex)
(letrec ([meta-latex
(lambda (pdf?)
(lambda (input-file)
(let ([file (filename->latex-filename input-file)]
[command-name (if pdf?
"pdflatex"
"latex")])
(case (system-type)
[(macos)
(when pdf?
(error 'latex "do not know how to run pdflatex on ~s" (system-type)))
(system "OTEX")
;; boy, wouldn't it be great if the "actv" appleevent worked for OTEX?
;;(send-event "OTEX" "misc" "acvt")
(let* ([build-oztex-locations
(list
(lambda (x)
(build-path x
"Applications"
"OzTeX"
"OzTeX"))
(lambda (x)
(build-path x
"Applications (Mac OS 9)"
"OzTeX"
"OzTeX")))]
[oztex-locations
(apply
append
(map (lambda (f) (map f (filesystem-root-list))) build-oztex-locations))]
[oztex-location (ormap (lambda (x) (if (file-exists? x) x #f)) oztex-locations)])
(when oztex-location
(with-handlers ([void void]) ;; mzscheme cannot handle result
(send-event "MACS" "aevt" "odoc" (vector 'file oztex-location)))))
(send-event "OTEX" "aevt" "odoc" (vector 'file file))
#t]
[(windows) (exec-latex (add-suffix command-name #".exe") file)]
[(unix macosx)
(exec-latex command-name file)]
[else
(error 'latex "do not know how to run ~s on ~s" command-name (system-type))]))))])
(values
(meta-latex #f)
(meta-latex #t))))
(define-values (slatex pdf-slatex)
(letrec ([meta-slatex
(lambda (latex-fun)
(lambda (filename)
(slatex/no-latex filename)
(putenv "TEXINPUTS"
(format "~a:~a"
(path->string here)
(or (getenv "TEXINPUTS") "")))
(latex-fun filename)))])
(values
(meta-slatex latex)
(meta-slatex pdf-latex))))
(define (slatex/no-latex input-file)
(let* ([fixed-file (filename->latex-filename input-file)]
[file (normalize-path fixed-file)])
(let-values ([(base name dir?) (split-path file)])
(parameterize ([current-directory
(if (string? base)
base
(current-directory))])
(slatex::process-main-tex-file (path->string name)))))))

View File

@ -1,152 +0,0 @@
"""
sLaTeX support for Rubber.
"""
from os import unlink
from os.path import exists, getmtime, join
import rubber
from rubber import _, msg, Depend, DependLeaf
def run(doc, env, base):
msg.progress(_("running slatex on %s") % doc.src_base)
if env.execute(["slatex", "-n", base], {}):
msg.error(_("Error executing slatex"))
return 1
doc.must_compile = 1
return 0
def slatex_needed(target, srcs):
if not exists(target):
msg.log(_("File %s does not exist") % target, pkg="slatex")
return 1
for src in srcs:
if getmtime(target) < getmtime(src):
msg.log(_("File %s older than %s") % (target, src), pkg="slatex")
return 1
return 0
class RubberDep (Depend):
# Base is the slatex module
# Target is the autogenerated file (i.e. .Z# + doc.src_base + ".tex")
# Sources is a list of sources on which this file depends
def __init__ (self, mod, target, srcs):
self.mod = mod
self.doc = mod.doc
self.env = mod.doc.env
self.target = target
self.srcs = srcs
sources = {}
for src in srcs:
sources[src] = DependLeaf(self.env, src)
Depend.__init__(self, self.env,
prods=[target],
sources=sources)
self.urvater = join(self.doc.src_path, self.doc.src_base + ".tex")
def run(self):
# We may have been out of date before any dependency was run,
# but by this point we may be up to date since slatex builds
# all the files at once. Otherwise we'll run once per out of
# date generated file.
if slatex_needed(self.target, self.srcs):
run(self.doc, self.env, self.urvater)
class Module (rubber.rules.latex.Module):
def __init__ (self, doc, dict):
self.base = doc.src_base
self.base_file = join(doc.src_path, doc.src_base + ".tex")
self.final = join(doc.env.path[0], doc.env.final.prods[0])
self.count = 0
self.doc = doc
self.env = doc.env
self.file_deps = {}
self.path = doc.src_path
self.preamble = False
def add_scheme_file(dict, others=[]):
filename = ".Z" + str(self.count) + self.base + ".tex"
path = join(self.path, filename)
deps = [dict["pos"]["file"]]
if others:
deps.extend(others)
self.doc.sources[path] = RubberDep(self, path, deps)
msg.log(_("Marking %s as dependent on %s") % (path, deps), pkg = "slatex")
self.count += 1
scheme_macros = ["scheme", "schemeresult"]
scheme_envs = ["schemedisplay",
"schemeresponse",
"schemebox",
"schemeresponsebox"]
preamble_macros = ["setspecialsymbol",
"setkeyword",
"defschememathescape"]
def add_preamble_hook(name):
def h_preamb(dict):
if not self.preamble and slatex_needed(self.final, [self.base_file]):
run(self.doc, self.env, self.base_file)
self.preamble = True
doc.add_hook(name, h_preamb)
def add_macro_hook(name):
def h_macro(dict):
add_scheme_file(dict)
doc.add_hook(name, h_macro)
def add_env_hook(name):
beg_env = "begin{%s}" % name
end_env = "end{%s}" % name
def begin_env_hook(dict):
def end_env_hook(dict, self=doc, hooks=doc.hooks):
self.hooks = hooks
self.update_seq()
doc.hooks = { end_env : end_env_hook }
# \scheme, \schemeresult allowed in these.
for macro in scheme_macros:
add_macro_hook(macro)
doc.update_seq()
add_scheme_file(dict)
doc.add_hook(beg_env, begin_env_hook)
for macro in preamble_macros:
add_preamble_hook(macro)
for macro in scheme_macros:
add_macro_hook(macro)
for environ in scheme_envs:
add_env_hook(environ)
# handled specially so that we get dependence on the
# file being included as well.
def h_schemeinput(dict):
arg_path = join(self.path, dict["arg"])
add_scheme_file(dict, others=[arg_path])
doc.add_hook("schemeinput", h_schemeinput)
# schemeregions should generate one file for the entire
# thing, so we shouldn't allow the separate scheme
# hooks like above.
def h_schemeregion(dict, end = "end{schemeregion}"):
def end_env_hook(dict, self=doc, hooks=doc.hooks):
self.hooks = hooks
self.update_seq()
doc.hooks = doc.hooks.copy()
doc.hooks[end] = end_env_hook
for macro in scheme_macros:
if macro in doc.hooks:
del doc.hooks[macro]
for env in scheme_envs:
if ("begin{%s}" % env) in doc.hooks:
del doc.hooks["begin{%s}" % env]
doc.update_seq()
add_scheme_file(dict)
doc.add_hook("begin{schemeregion}", h_schemeregion)

View File

@ -1,592 +0,0 @@
% slatex.sty
% SLaTeX v. 2.4
% style file to be used in (La)TeX when using SLaTeX
% (c) Dorai Sitaram, Rice U., 1991, 1999
\def\slatexversion{20050609} % last modified
% This file (or a soft link to it) should be in some
% directory in your TEXINPUTS path (i.e., the one
% (La)TeX scours for \input or \documentstyle option
% files).
% Do not attempt to debug this file, since the results
% are not transparent just to (La)TeX. The Scheme part
% of SLaTeX depends on information laid out here -- so
% (La)TeX-minded debugging of this file will almost
% inevitably sabotage SLaTeX.
% It's possible you don't find the default style set
% out here appealing: e.g., you may want to change the
% positioning of displayed code; change the fonts for
% keywords, constants, and variables; add new keywords,
% constants, and variables; use your names instead of
% the provided \scheme, [\begin|\end]{schemedisplay},
% [\begin|\end]{schemebox}, (or \[end]schemedisplay,
% \[end]schemebox for TeX), which might be seem too
% long or unmnemonic, and many other things. The clean
% way to do these things is outlined in the
% accompanying manual, slatxdoc.tex. This way is both
% easier than messing with this .sty file, and safer
% since you will not unwittingly break SLaTeX.
%%%
% to prevent loading slatex.sty more than once
\ifx\slatexignorecurrentfile\UNDEFINED
\else\endinput\fi
% use \slatexignorecurrentfile to disable slatex for
% the current file. (Unstrangely, the very definition
% disables slatex for the rest of _this_ file, slatex.sty.)
\def\slatexignorecurrentfile{}
% checking whether we're using LaTeX or TeX?
\newif\ifusinglatex
\ifx\newenvironment\UNDEFINED\usinglatexfalse\else\usinglatextrue\fi
% make @ a letter for TeX
\ifusinglatex\relax\else
\edef\atcatcodebeforeslatex{\the\catcode`\@ }
\catcode`\@11
\fi
% identification of TeX/LaTeX style for schemedisplay.
% Do \defslatexenvstyle{tex} to get TeX environment
% style in LaTeX
\def\defslatexenvstyle#1{\gdef\slatexenvstyle{#1}}
\ifusinglatex\defslatexenvstyle{latex}\else\defslatexenvstyle{tex}\fi
% TeX doesn't have sans-serif; use roman instead
\ifx\sf\UNDEFINED\let\sf\rm\fi
% tabbing from plain TeX
%
\newif\ifus@ \newif\if@cr
\newbox\tabs \newbox\tabsyet \newbox\tabsdone
%
\def\cleartabs{\global\setbox\tabsyet\null \setbox\tabs\null}
\def\settabs{\setbox\tabs\null \futurelet\next\sett@b}
\let\tabalignaux=\relax % in case this file is being read in twice
\def\sett@b{\ifx\next\tabalignaux\let\next\relax
\def\next{\afterassignment\s@tt@b\let\next}%
\else\let\next\s@tcols\fi\next}
\def\s@tt@b{\let\next\relax\us@false\m@ketabbox}
\def\tabalign{\us@true\m@ketabbox} % non-\outer version of \tabalignaux
\outer\def\tabalignaux{\tabalign}
\def\s@tcols#1\columns{\count@#1 \dimen@\hsize
\loop\ifnum\count@>\z@ \@nother \repeat}
\def\@nother{\dimen@ii\dimen@ \divide\dimen@ii\count@
\setbox\tabs\hbox{\hbox to\dimen@ii{}\unhbox\tabs}%
\advance\dimen@-\dimen@ii \advance\count@\m@ne}
%
\def\m@ketabbox{\begingroup
\global\setbox\tabsyet\copy\tabs
\global\setbox\tabsdone\null
\def\CR{\@crtrue\crcr\egroup\egroup
\ifus@\unvbox\z@\lastbox\fi\endgroup
\setbox\tabs\hbox{\unhbox\tabsyet\unhbox\tabsdone}}%
\setbox\z@\vbox\bgroup\@crfalse
\ialign\bgroup&\t@bbox##\t@bb@x\crcr}
%
\def\t@bbox{\setbox\z@\hbox\bgroup}
\def\t@bb@x{\if@cr\egroup % now \box\z@ holds the column
\else\hss\egroup \global\setbox\tabsyet\hbox{\unhbox\tabsyet
\global\setbox\@ne\lastbox}% now \box\@ne holds its size
\ifvoid\@ne\global\setbox\@ne\hbox to\wd\z@{}%
\else\setbox\z@\hbox to\wd\@ne{\unhbox\z@}\fi
\global\setbox\tabsdone\hbox{\box\@ne\unhbox\tabsdone}\fi
\box\z@}
% finished (re)defining TeX's tabbing macros
% above from plain.tex; was disabled in lplain.tex. Do
% not modify above unless you really know what you're
% up to. Make all changes you want to following code.
% The new env is preferable to LaTeX's tabbing env
% since latter accepts only a small number of tabs
% following retrieves something like LaTeX's tabbing
% env without the above problem (it also creates a box
% for easy manipulation!)
\def\lat@xtabbing{\begingroup
\def\={\cleartabs&} \def\>{&}%
\def\\{\CR\tabalign\lat@xtabbingleftmost}%
\tabalign\lat@xtabbingleftmost}
\def\endlat@xtabbing{\CR\endgroup}
\let\lat@xtabbingleftmost\relax
% stuff for formating Scheme code
\newskip\par@nlen \newskip\brack@tlen \newskip\quot@len
\newskip\h@lflambda
\newbox\garb@ge
\def\s@ttowidth#1#2{\setbox\garb@ge\hbox{#2}#1\wd\garb@ge\relax}
\s@ttowidth\par@nlen{$($} % size of paren
\s@ttowidth\brack@tlen{$[$} % size of bracket
\s@ttowidth\quot@len{'} % size of quote indentation
\s@ttowidth\h@lflambda{ii} % size of half of lambda indentation
\def\PRN{\hskip\par@nlen} % these are used by SLaTeX's codesetter
\def\BKT{\hskip\brack@tlen}
\def\QUO{\hskip\quot@len}
\def\HL{\hskip\h@lflambda}
\newskip\abovecodeskip \newskip\belowcodeskip
\newskip\leftcodeskip \newskip\rightcodeskip
% the following default assignments give a flushleft
% display
\abovecodeskip=\medskipamount \belowcodeskip=\medskipamount
\leftcodeskip=0pt \rightcodeskip=0pt
% adjust above,below,left,right codeskip's to personal
% taste
% for centered displays
%
% \leftcodeskip=0pt plus 1fil
% \rightcodeskip=0pt plus 1fil
%
% if \rightcodeskip != 0pt, pagebreaks within Scheme
% blocks in {schemedisplay} are disabled
\let\checkforfollpar1
\def\noindentifnofollpar{\ifx\checkforfollpar0\let\next\relax
\else\ifusinglatex\let\next\@endparenv
\else\let\next\noindentifnofollparI\fi\fi\next}
\def\noindentifnofollparI{\futurelet\next\noindentifnofollparII}
\def\noindentifnofollparII{\ifx\next\par\else\noindent\ignorespaces\fi}
% the following are the default font assignments for
% words in code. Change them to suit personal taste
\ifusinglatex
\def\keywordfont#1{{\bfseries #1}}
\def\variablefont#1{{\itshape #1\/}}
\def\constantfont#1{{\sffamily #1}}
\else
\def\keywordfont#1{{\bf #1}}
\def\variablefont#1{{\it #1\/}}
\def\constantfont#1{{\sf #1}}
\fi
\def\datafont#1{\constantfont{#1}}
\let\schemecodehook\relax
\let\ZZZZschemecodehook\relax
%program listings that allow page breaks but
%can't be centered
\def\ZZZZschemedisplay{\edef\thez@skip{\the\z@skip}%
\edef\@tempa{\the\rightcodeskip}%
\ifx\@tempa\thez@skip\let\next\ZZZZschemeprogram
\else\let\next\ZZZZschemeprogramII\fi\next}
\def\endZZZZschemedisplay{\edef\thez@skip{\the\z@skip}%
\edef\@tempa{\the\rightcodeskip}%
\ifx\@tempa\thez@skip\let\next\endZZZZschemeprogram
\else\let\next\endZZZZschemeprogramII\fi\next}
\def\ZZZZschemeprogram{\vskip\abovecodeskip
\begingroup
\schemecodehook\ZZZZschemecodehook
\frenchspacing
\let\sy=\keywordfont \let\cn=\constantfont
\let\va=\variablefont \let\dt=\datafont
\def\lat@xtabbingleftmost{\hskip\leftskip\hskip\leftcodeskip\relax}%
\lat@xtabbing}
\def\endZZZZschemeprogram{\endlat@xtabbing
\endgroup
\vskip\belowcodeskip
\noindentifnofollpar}
\def\ZZZZschemeprogramII{\vskip\abovecodeskip
\begingroup
\noindent
%\ZZZZschemecodehook\schemecodehook %\ZZZZschemebox already has it
\hskip\leftcodeskip
\ZZZZschemebox}
\def\endZZZZschemeprogramII{\endZZZZschemebox
\hskip\rightcodeskip
\endgroup
\vskip\belowcodeskip
\noindentifnofollpar}
\def\ZZZZschemeresponse{\ZZZZschemecodehookforresult
\ZZZZschemedisplay}
\let\endZZZZschemeresponse\endZZZZschemedisplay
%
\def\ZZZZschemebox{%
\leavevmode\hbox\bgroup\vbox\bgroup
\schemecodehook\ZZZZschemecodehook
\frenchspacing
\let\sy=\keywordfont \let\cn=\constantfont
\let\va=\variablefont \let\dt=\datafont
\lat@xtabbing}
\def\endZZZZschemebox{\endlat@xtabbing
\egroup\egroup\ignorespaces}
% schemetopbox : added by robby/jbc 2000
\def\ZZZZschemetopbox{%
\leavevmode\hbox\bgroup\vtop\bgroup
\schemecodehook\ZZZZschemecodehook
\frenchspacing
\let\sy=\keywordfont \let\cn=\constantfont
\let\va=\variablefont \let\dt=\datafont
\lat@xtabbing}
\def\endZZZZschemetopbox{\endlat@xtabbing
\egroup\egroup\ignorespaces}
\def\ZZZZschemeresponsebox{\ZZZZschemecodehookforresult
\ZZZZschemebox}
\let\endZZZZschemeresponsebox\endZZZZschemebox
%in-text
\def\ZZZZschemecodeintext{\begingroup
\schemecodehook\ZZZZschemecodehook
\frenchspacing
\let\sy\keywordfont \let\cn\constantfont
\let\va\variablefont \let\dt\datafont}
\def\endZZZZschemecodeintext{\endgroup\ignorespaces}
\def\ZZZZschemeresultintext{\ZZZZschemecodehookforresult
\ZZZZschemecodeintext}
\let\endZZZZschemeresultintext\endZZZZschemecodeintext
%
\def\ZZZZschemecodehookforresult{%
\gdef\ZZZZschemecodehook{\let\keywordfont\constantfont
\let\variablefont\constantfont
\global\let\ZZZZschemecodehook\relax}}
% \comm@nt<some-char>...text...<same-char> comments out
% TeX source analogous to
% \verb<some-char>...text...<same-char>. Sp. case:
% \comm@nt{...text...} == \comm@nt}...text...}
\def\@makeother#1{\catcode`#112\relax}
\def\comm@nt{%
\begingroup
\let\do\@makeother \dospecials
\@comm}
\begingroup\catcode`\<1 \catcode`\>2
\catcode`\{12 \catcode`\}12
\long\gdef\@comm#1<%
\if#1{\long\def\@tempa ##1}<\endgroup>\else
\long\def\@tempa ##1#1<\endgroup>\fi
\@tempa>
\endgroup
% like LaTeX2e's \InputIfFileExists
\ifx\InputIfFileExists\UNDEFINED
\def\InputIfFileExists#1#2#3{%
\immediate\openin0=#1\relax
\ifeof0\relax\immediate\closein0\relax#3%
\else\immediate\closein0\relax#2\input#1\relax\fi}%
\fi
\def\ZZZZinput#1{\input#1 \relax}
% you may replace the above by
%
% \def\ZZZZinput#1{\InputIfFileExists{#1}{}{}}
%
% if you just want to call (La)TeX on your text
% ignoring the portions that need to be SLaTeX'ed
%use \subjobname rather than \jobname to generate
%slatex's temp files --- this allows us to change
%\subjobname for more control, if necessary.
\let\subjobname\jobname
% counter for generating temp file names
\newcount\sch@mefilenamecount
\sch@mefilenamecount=-1
% To produce displayed Scheme code:
% in LaTeX:
% \begin{schemedisplay}
% ... indented program (with sev'l lines) ...
% \end{schemedisplay}
%
% in TeX:
% \schemedisplay
% ... indented program (with sev'l lines) ...
% \endschemedisplay
\begingroup\catcode`\|=0 \catcode`\[=1 \catcode`\]=2
\catcode`\{=12 \catcode`\}=12 \catcode`\\=12
|gdef|defschemedisplaytoken#1[%
|long|expandafter|gdef|csname ZZZZcomment#1|endcsname[%
|begingroup
|let|do|@makeother |dospecials
|csname ZZZZcomment|slatexenvstyle II#1|endcsname]%
|long|expandafter|gdef|csname ZZZZcommentlatexII#1|endcsname##1\end{#1}[%
|endgroup|end[#1]]%
|long|expandafter|gdef|csname ZZZZcommenttexII#1|endcsname##1\end#1[%
|endgroup|csname end#1|endcsname]%
|long|expandafter|gdef|csname #1|endcsname[%
|csname ZZZZcomment#1|endcsname]%
|long|expandafter|gdef|csname end#1|endcsname[%
|global|advance|sch@mefilenamecount by 1
|let|checkforfollpar0%
|ZZZZinput[|filehider Z|number|sch@mefilenamecount|subjobname.tex]%
|let|checkforfollpar1%
|noindentifnofollpar]]%
|endgroup
\def\undefschemedisplaytoken#1{%
\expandafter\gdef\csname#1\endcsname{\UNDEFINED}}
% like {schemedisplay}, but displays output from a
% Scheme evaluation. I.e., keywords and variables
% appear in the data font
\let\defschemeresponsetoken\defschemedisplaytoken
\let\undefschemeresponsetoken\undefschemedisplaytoken
% \scheme|...program fragment...| produces Scheme code
% in-text. Sp. case: \scheme{...} == \scheme}...}
\def\defschemetoken#1{%
\long\expandafter\def\csname#1\endcsname{%
\global\advance\sch@mefilenamecount by 1
\ZZZZinput{\filehider Z\number\sch@mefilenamecount\subjobname.tex}%
\comm@nt}}
\let\undefschemetoken\undefschemedisplaytoken
% \schemeresult|...program fragment...| produces a
% Scheme code result in-text: i.e. keyword or variable
% fonts are replaced by the data font. Sp. case:
% \schemeresult{...} == \schemeresult}...}
\let\defschemeresulttoken\defschemetoken
\let\undefschemeresulttoken\undefschemetoken
% To produce a box of Scheme code:
% in LaTeX:
% \begin{schemebox}
% ... indented program (with sev'l lines) ...
% \end{schemebox}
%
% in TeX:
% \schemebox
% ... indented program (with sev'l lines) ...
% \endschemebox
\begingroup\catcode`\|=0 \catcode`\[=1 \catcode`\]=2
\catcode`\{=12 \catcode`\}=12 \catcode`\\=12
|gdef|defschemeboxtoken#1[%
|long|expandafter|gdef|csname ZZZZcomment#1|endcsname[%
|begingroup
|let|do|@makeother |dospecials
|csname ZZZZcomment|slatexenvstyle II#1|endcsname]%
|long|expandafter|gdef|csname ZZZZcommentlatexII#1|endcsname##1\end{#1}[%
|endgroup|end[#1]]%
|long|expandafter|gdef|csname ZZZZcommenttexII#1|endcsname##1\end#1[%
|endgroup|csname end#1|endcsname]%
|long|expandafter|gdef|csname #1|endcsname[%
|global|advance|sch@mefilenamecount by 1
|ZZZZinput[|filehider Z|number|sch@mefilenamecount|subjobname.tex]%
|csname ZZZZcomment#1|endcsname]%
|long|expandafter|gdef|csname end#1|endcsname[]]%
|endgroup
\let\undefschemeboxtoken\undefschemedisplaytoken
% like {schemeresponse}, but in a box
\let\defschemeresponseboxtoken\defschemeboxtoken
\let\undefschemeresponseboxtoken\undefschemeboxtoken
\let\defschemetopboxtoken\defschemeboxtoken
\let\undefschemetopboxtoken\undefschemeboxtoken
% for wholesale dumping of all-Scheme files into TeX (converting
% .scm files to .tex),
% use
% \schemeinput{<filename>}
% .scm, .ss, .s extensions optional
\def\defschemeinputtoken#1{%
\long\expandafter\gdef\csname#1\endcsname##1{%
\global\advance\sch@mefilenamecount by 1
\ZZZZinput{\filehider Z\number\sch@mefilenamecount\subjobname.tex}}}
\def\undefschemeinputtoken#1{%
\expandafter\gdef\csname#1\endcsname{\UNDEFINED}}
% delineating a region that features typeset code
% not usually needed, except when using \scheme and schemedisplay
% inside macro-args and macro-definition-bodies
% in LaTeX:
% \begin{schemeregion}
% ...
% \end{schemeregion}
%
% in TeX:
% \schemeregion
% ...
% \endschemeregion
\let\defschemeregiontoken\defschemeboxtoken
\let\undefschemeregiontoken\undefschemeboxtoken
% the SLaTeX tokens
\defschemedisplaytoken{schemedisplay}
\defschemetoken{scheme}
\defschemeboxtoken{schemebox}
\defschemetopboxtoken{schemetopbox}
\defschemeresulttoken{schemeresult}
\defschemeresponsetoken{schemeresponse}
\defschemeresponseboxtoken{schemeresponsebox}
\defschemeinputtoken{schemeinput}
\defschemeregiontoken{schemeregion}
% introducing new code-tokens to the keyword, variable and constant
% categories
\def\comm@ntII{%
\begingroup
\let\do\@makeother \dospecials
\@commII}
\begingroup\catcode`\[1 \catcode`\]2
\catcode`\{12 \catcode`\}12
\long\gdef\@commII{[%
\long\def\@tempa ##1}[\endgroup]\@tempa]%
\endgroup
\let\setkeyword\comm@ntII
\let\setvariable\comm@ntII
\let\setconstant\comm@ntII
\let\setdata\comm@ntII
% \defschememathescape makes the succeeding grouped character an
% escape into latex math from within Scheme code;
% this character can't be }
\let\defschememathescape\comm@ntII
\let\undefschememathescape\comm@ntII
% telling SLaTeX that a certain Scheme identifier is to
% be replaced by the specified LaTeX expression.
% Useful for generating ``mathematical''-looking
% typeset code even though the corresponding Scheme
% code is ascii as usual and doesn't violate
% identifier-naming rules
\def\setspecialsymbol{%
\begingroup
\let\do\@makeother \dospecials
\@commIII}
\begingroup\catcode`\[1 \catcode`\]2
\catcode`\{12 \catcode`\}12
\long\gdef\@commIII{[%
\long\def\@tempa ##1}[\endgroup\@gobbleI]\@tempa]%
\endgroup
\def\@gobbleI#1{}
% \unsetspecialsymbol strips Scheme identifier(s) of
% any ``mathematical'' look lent by the above
\let\unsetspecialsymbol\comm@ntII
% enabling/disabling slatex
\def\slatexdisable#1{\expandafter\gdef\csname#1\endcsname{}}
% \schemecasesensitive takes either true or false as
% argument
\def\schemecasesensitive#1{}
%for latex only: use \slatexseparateincludes before the
%occurrence of any Scheme code in your file, if you
%want the various \include'd files to have their own
%pool of temporary slatex files. This lets you juggle
%your \include's in successive runs of LaTeX without
%having to worry that the temp. files may interfere.
%By default, only a single pool of temp files is used.
%Warning: On DOS, if your \include'd files have fairly
%similar names, avoid \slatexseparateincludes since the
%short filenames on DOS will likely confuse the temp
%file pools of different \include files.
\def\slatexseparateincludes{%
\gdef\include##1{{\def\subjobname{##1}%
\sch@mefilenamecount=-1
\@include##1 }}
%
% package subfile lets us structure documents; I want SLaTeX to support it
%\newcommand\subfile[1]{\begingroup\skip@preamble\input{#1}\endgroup}
\gdef\subfile##1{{\def\subjobname{##1}%
\sch@mefilenamecount=-1
\skip@preamble
\input{##1} }}}
% convenient abbreviations for characters
\begingroup
\catcode`\|=0
|catcode`|\=12
|gdef|ttbackslash{{|tt|catcode`|\=12 \}}
|endgroup
\mathchardef\lt="313C
\mathchardef\gt="313E
\begingroup
\catcode`\@12
\global\let\atsign@%
\endgroup
%\chardef\dq=`\"
\ifusinglatex
\def\dq{\ttfamily\char`\"}%
\else
\def\dq{\tt\char`\"}%
\fi
% leading character of slatex filenames: . for unix to
% keep them out of the way
\def\filehider{.}
% since the above doesn't work of dos, slatex on dos
% will use a different character, and make the
% redefinition available through the following
\InputIfFileExists{xZfilhid.tex}{}{}
% @ is no longer a letter for TeX
\ifusinglatex\relax\else
\catcode`\@\atcatcodebeforeslatex
\fi
\message{*** Check: Are you sure you called SLaTeX
\slatexversion\space or later? ***}

View File

@ -1,62 +0,0 @@
#lang racket
(require slatex/slatex-wrapper
tests/eli-tester
scheme/runtime-path)
(define-runtime-path slatex-file-pth '(lib "slatex"))
(define slatex-pth (path-only slatex-file-pth))
(parameterize ([current-directory (find-system-path 'temp-dir)])
(define tmp-file (build-path (current-directory) "test.tex"))
(test
(putenv "TEXINPUTS" (format "~a:" (path->string slatex-pth)))
tmp-file
(with-output-to-file tmp-file #:exists 'truncate/replace
(lambda ()
(display #<<END
\documentclass{article}
\usepackage{slatex}
%
%That was LaTeX2e. If you use
%LaTeX2.09, or LaTeX2e in
%2.09 compatibility mode, use
%
%\documentstyle[slatex]{article}
%
%or
%
%\documentstyle{article}
%\input slatex.sty
\begin{document}
In Scheme, the expression
\scheme|(set! x 42)| returns
an unspecified value, rather
than \scheme'42'. However,
one could get a \scheme{set!}
of the latter style with:
\begin{schemedisplay}
(define-syntax setq
(syntax-rules ()
[(setq x a)
(begin (set! x a)
x)]))
\end{schemedisplay}
\end{document}
END
)))
(slatex (path->string tmp-file))
(with-handlers ([exn:fail:filesystem? void])
(delete-file (path-replace-suffix tmp-file #".aux")))
(with-handlers ([exn:fail:filesystem? void])
(delete-file (path-replace-suffix tmp-file #".log")))
(with-handlers ([exn:fail:filesystem? void])
(delete-file (path-replace-suffix tmp-file #".dvi")))
(delete-file tmp-file)))

View File

@ -1,5 +0,0 @@
#lang racket/base
(require rackunit/docs-complete)
(check-docs (quote slatex/slatex-wrapper))
(check-docs (quote slatex/slatex-launcher))
(check-docs (quote slatex/pdf-slatex-launcher))