home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / text / tex / 15362 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  9.2 KB

  1. Path: sparky!uunet!walter!att-out!pacbell.com!ames!sun-barr!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!mintaka.lcs.mit.edu!ai-lab!wheat-chex!bkph
  2. From: bkph@wheat-chex.ai.mit.edu (Berthold K.P. Horn)
  3. Newsgroups: comp.text.tex
  4. Subject: Re: What is tpic?
  5. Date: 23 Jan 1993 20:16:42 GMT
  6. Organization: MIT Artificial Intelligence Lab
  7. Lines: 222
  8. Message-ID: <1js93aINN8df@life.ai.mit.edu>
  9. References: <1993Jan21.221430.26824@chiton.ucsd.edu>
  10. NNTP-Posting-Host: wheat-chex.ai.mit.edu
  11. In-reply-to: amr@chiton.ucsd.edu's message of Thu, 21 Jan 1993 22:14:30 GMT
  12.  
  13.  
  14. In article <1993Jan21.221430.26824@chiton.ucsd.edu> amr@chiton.ucsd.edu (Tony Richardson) writes:
  15.  
  16.    This is probably a FAQ, but I couldn't find it in the tex-faq.
  17.  
  18.    What are the tpic specials and where are they documented?  Are they supported
  19.    by most dvi translators/previewers (dvips and xdvi in particular)?  What are
  20.    the advantages/disadvantages to using macro packages like eepic (and/or
  21.    PiCTeX with the tpic extensions) versus direct inclusion of PostScript via
  22.    dvips (assuming that I have a drawing program/graphics package that can generate
  23.    either eepic macros or PostScript)?
  24.  
  25.    Thanks in advance,
  26.    Tony Richardson
  27.  
  28. TPIC \specials are supported by DVITPS, DVIPS, DVIPSONE, and DVIWindo
  29. amongst others.  Not sure what all the TeX macro packages are that create
  30. TPIC specials, maybe somebody else can elucidate.  Here are asome brief
  31. notes on TPIC specials, derived mostly by inductions from observed use.
  32. Would very much appreciate corrections of these deductions...
  33.  
  34.  
  35. Some Notes on TPIC \specials:
  36. ============================
  37.  
  38. TPIC \specials are used by various TeX macro packages to draw simple shapes
  39. in a device independent way.  Several DVI processors support TPIC \specials.
  40.  
  41. One use of TPIC specials depends on accumulating a polygonal path,
  42. and then `stroking' this path using solid, dashed or dotted lines
  43. or even quadratic splines; and/or `filling' the shape obtained by 
  44. closing the polygonal path.
  45.  
  46. It is also possible to draw circles, ciruclar disks, ellipses aligned
  47. with the coordinate axes and elliptical arcs.
  48.  
  49. TPIC commands are two-letter words followed in some cases by numeric
  50. arguments. The command words are meant to be mnemonic (but are mostly
  51. mnemonic only in a somewhat misleading way).
  52.  
  53. Here follow some notes on TPIC \specials:
  54. -----------------------------------------
  55.  
  56. (*)    The origin of the coordinate system is at TeX's current point ---
  57.     x increasing to the right and y increasing downward.
  58.  
  59. (*)    TeX's current point is NOT disturbed by TPIC \specials
  60.     (so this is NOT a way to displace text typeset in TeX).
  61.  
  62. (*)    Lengths, widths and coordinates are in milli-inches (0.001")
  63.     Only integers are permitted.  An exception is the specification
  64.     of dash length and dot interval, which is in inches.
  65.  
  66. (*)    Angles are in radians, clockwise from the horizontal.
  67.     (Angles are allowed to be reals, of course).
  68.  
  69. (*)    Grey-levels lie between 0.0 and 1.0 --- 0 being white, 1 black.
  70.     (Note that this is reversed from common usage).
  71.  
  72. (*)    `stroke' here means draw a solid, dashed, or dotted line, or a 
  73.     spline with a pen of specified width. Strokes are always black.
  74.  
  75. (*)    `fill' here means to fill a closed shape with a specified grey level.
  76.     If no grey-level is explicitely specified, then black is assumed.
  77.     The shape will be implicitly closed if it is not closed already.
  78.  
  79. (*)    Stroking and/or filling a polygonal path resets it.
  80.     The next path-accumulating command starts a new path.
  81.  
  82. (*)    Explicitly setting the grey level implies that the next shape is to
  83.     be filled. The request to fill a shape is reset after it is filled.
  84.     To fill the next shape, the grey-level must be specified again.
  85.  
  86. (*)    Some implementations have limits on how many lines a polygonal path
  87.     may consist of (600 typically).
  88.  
  89. (*)    Unfortunately, there are some ambiguities in the definitions.
  90.     Different implementations will do different things in some cases.
  91.     Often implementation choices reflect what is easy to do    in a 
  92.     particular graphics model. See notes near the end.
  93.  
  94. Here are the TPIC \special commands:
  95. ------------------------------------
  96.  
  97. pn <n>        set pen width for stroking to <n> (milli-inches).
  98.  
  99. bk        flag next graphic to be filled, and 
  100.         set grey-level for fill to 1 (black).
  101.  
  102. wh        flag next graphic to be filled, and 
  103.         set grey-level for fill to 0 (white).
  104.  
  105. sh [<g>]    flag next graphic to be filled, and 
  106.         set grey-level for fill to <g>, if optional argument is given;
  107.         otherwise set grey-level to the default which is 0.5 (grey).
  108.  
  109. tx <hex>    use specified bit-pattern for filling. 
  110.         This is    typically translated to an equivalent grey level.
  111.  
  112. pa <x> <y>    Add the point <x> <y> to the current path. That is,
  113.         move to <x> <y>, if this is the first point in new path, 
  114.         else add a line to <x> <y> to the path being accumulated.
  115.  
  116. fp        stroke solid polygonal line defined using sequence of `pa's.
  117.         If shading was requested using `bk', `gr' or `wh',
  118.         then also fill the shape defined by closing the figure.
  119.  
  120. ip        fill polygonal shape that was defined by sequence of `pa's.
  121.         Use the grey level specified by `bk', `gr' or `wh'.
  122.         The shape is closed first if necessary.
  123.  
  124. da <l>        stroke dashed polygonal line defined using sequence of `pa's.
  125.         <l> is the length of dashes, and the inter-dash interval
  126.         (specified in inches).
  127.         The length of the dash is adjusted so that each line starts
  128.         and ends with a full length dash.
  129.         If shading was requested using `bk', `gr' or `wh',
  130.         then also fill the shape defined by closing the figure.
  131.  
  132. dt <l>        stroke dotted polygonal line defined using sequence of `pa's.
  133.         <l> is the interval between dots (specified in inches).
  134.         The interval between dots is adjusted so that each line
  135.         starts and ends with a dot.
  136.         If shading was requested using `bk', `gr' or `wh',
  137.         then also fill the shape defined by closing the figure.
  138.  
  139. sp [<l>]    stroke a quadratic spline through the midpoints of the lines
  140.         defined using a sequence of `pa's. The spline starts
  141.         with a straight line from the first point to the mid-point
  142.         of the first line.  The spline ends with a straight line
  143.         from the mid-point of the last line to the last point.
  144.  
  145.         If the optional <l> is omitted (or zero) then the spline 
  146.         is stroked solid.
  147.         If <l> is positive, then it gives the length of the dashes
  148.         and the interval between dashes to be used (in inches).
  149.         If <l> is negative, then its magnitude indicates the
  150.         interval between dots to be used (in inches).
  151.  
  152. ar <xo> <yo> <xr> <yr> <sa> <ea>
  153.  
  154.         Stroke an elliptical arc.  The center of the ellipse is
  155.         at <xo> <yo>.  The major and minor axes are aligned with
  156.         the coordinate system axes.  The horizontal and vertical
  157.         semi-axes have lengths <xr> and <yr> respectively. 
  158.         The arc goes clockwise from the starting angle <sa> to
  159.         the ending angle <ea>. 
  160.         If shading is requested using `bk', `gr' or `wh',
  161.         then also fill the shape defined by closing the figure.
  162.  
  163. ia <xo> <yo> <xr> <yr> <sa> <ea>
  164.  
  165.         Fill an elliptical arc after closing the figure.
  166.         Use the grey level specified by `bk', `gr' or `wh'.
  167.         The center of the ellipse is at <xo> <yo>.  
  168.         The major and minor axes are aligned with the coordinate 
  169.         system axes.  The horizontal and vertical
  170.         semi-axes have lengths <xr> and <yr> respectively. 
  171.         The arc goes clockwise from the starting angle <sa> to
  172.         the ending angle <ea>. 
  173.  
  174. Note that TPIC state information, such as pen width and grey level cannot
  175. be carried across page boundaries, or page independence will be lost.
  176.  
  177. There are several ambiguities in the interpretation of TPIC \specials.
  178. Avoid the grey areas if maximum portability is a concern.
  179. To be safe, always specify the pen-width using `pn' before starting to put
  180. together a new polygonal path or drawing an elliptical arc.
  181. To be safe, always explicitly set the grey level if filling is desired 
  182. using `bk', `wh', or `sh'.
  183.  
  184. Ambiguities:
  185. ------------
  186.  
  187.     How should an elliptical arc be `filled' when the difference
  188.     in angles is not 2 pi?
  189.     It could be either as a chord, or as a pie slice.
  190.     The former being easier to implement, the latter more useful.
  191.  
  192.     What is the width of the pen when it is not explicitly specified?
  193.     Does it remain at the last used value or is it reset to some default?
  194.     
  195.     How should the `line join' and `line cap' be set?
  196.     Some implementations set `line cap' to `round' and 
  197.     leave `line join' set to `mitered'. 
  198.     Some graphics models do not provide a choice, and force use of
  199.     `round' for both.
  200.  
  201.     Should the lengths of dashes be reduced to account for the round ends?
  202.  
  203.     Should dots in a dotted curve be circular or should they be somewhat
  204.     elongated (much like very short dashes)?
  205.  
  206.     Can dashed and dotted paths be filled?
  207.  
  208.     Can paths drawn as splines be filled?
  209.  
  210.     For ip and ia, should filling ONLY occur if shading has been
  211.     explicitly specified?
  212.  
  213.     For fp, da, dt, should the path be explicitly closed if the 
  214.     last point is the same as the first? (It matters, since
  215.     `line join' rather than `line cap' comes into play if it is closed).
  216.  
  217.     Can the dash/dot interval argument be given in milli-inches 
  218.     (like all other dimensions) or only in inches?
  219.  
  220.  
  221. Possibly Desirable Extensions:
  222. -----------------------------
  223.  
  224.     provide for shading of shape defined by quadratic spline
  225.  
  226.     provide for dashed/dotted ellipses
  227.  
  228.     provide for smoothly closing paths defined by quadratic splines
  229.  
  230.     allow paths to be built up from lines AND elliptic arcs.
  231.  
  232.  
  233. Berthold K.P. Horn
  234. Cambridge, Massachusetts, USA
  235.