[OS X TeX] Engine for sketch

Matthew Leingang leingang at math.harvard.edu
Fri Dec 7 11:56:26 EST 2007


Hi everybody,

I just discovered how to make engines work in TeXShop.  Very cool  
feature.

Sketch [1] is a command-line program that takes a 3D scene  
description and generates drawing code in either PSTricks or TikZ.  I  
thought I could add an engine to do the generation and typeset the  
generated file.  Here's my sample sketch file:

-----------
%!TEX TS-program=sketch

% vertices of the tetrahedron
def p1 (0,0,1) def p2 (1,0,0)
def p3 (0,1,0) def p4 (-.3,-.5,-.8)

% faces of the tetrahedron.
polygon(p1)(p2)(p3) % original front polygon
polygon(p1)(p4)(p2) % bottom
polygon(p1)(p3)(p4) % left
polygon(p3)(p2)(p4) % rear
% line to pierce the tetrahedron
line[linecolor=red](-1,-1,-1)(2,2,2)

global {language tikz}
-----------

Here's my engine:

-----------
#!/bin/sh
# sketch.engine

texfile=`basename $1 .sk`.tex
sketch -T $1 > $texfile
pdflatex $texfile

open -a TeXShop `basename $1 .sk`.pdf
-----------

Just running

	$~/Library/TeXShop/Engines/sketch.engine tet.sk

on the command line does what I want.   If I open the tet.sk file in  
TeXShop I can select the sketch engine I created.  But then the  
"Typeset" button is grayed out and command-T doesn't do anything.

I thought it might have something to do with the file name extension  
".sk" not being recognized by TeXShop.  But I didn't see any place I  
could add to the list of acceptable extensions in TeXShop's  
Preferences dialog, nor from "defaults read TeXShop."

Any help?

--Matt

[1] http://www.frontiernet.net/~eugene.ressler/

--
Matthew Leingang
Preceptor in Mathematics
Harvard University

http://www.math.harvard.edu/~leingang/vCard.vcf






More information about the MacOSX-TeX mailing list