PIC(1) BSD Reference Manual PIC(1) NNAAMMEE pic - compile pictures for troff or TeX SSYYNNOOPPSSIISS ppiicc [ --nnvvCC ] [ _f_i_l_e_n_a_m_e ... ] ppiicc --tt [ --ccvvzzCC ] [ _f_i_l_e_n_a_m_e ... ] DDEESSCCRRIIPPTTIIOONN This manual page descibes the GNU version of ppiicc, which is part of the groff document formatting system. ppiicc com- piles descriptions of pictures embedded within ttrrooffff or TeX input files into commands that are understood by TeX or ttrrooffff. Each picture starts with a line beginning with ..PPSS and ends with a line beginning with ..PPEE. Anything outside of ..PPSS and ..PPEE is passed through without change. It is the user's responsibility to provide appropriate definitions of the PPSS and PPEE macros. When the macro pack- age being used does not supply such definitions (for exam- ple, old versions of -ms), appropriate definitions can be obtained with --mmppiicc: these will center each picture. OOPPTTIIOONNSS Options that do not take arguments may be grouped behind a single --. The special option ---- can be used to mark the end of the options. A filename of -- refers to the stan- dard input. --CC Recognize ..PPSS and ..PPEE even when followed by a char- acter other than space or newline. --nn Don't use the groff extensions to the troff drawing commands. You should use this if you are using a postprocessor that doesn't support these exten- sions. The extensions are described in ggrrooffff__oouutt(5). The --nn option also causes pic not to use zero-length lines to draw dots in troff mode. --tt TeX mode. --cc Be more compatible with ttppiicc. Implies --tt. Lines beginning with \\ are not passed through transpar- ently. Lines beginning with .. are passed through with the initial .. changed to \\. A line beginning with ..ppss is given special treatment: it takes an optional integer argument specifying the line thickness (pen size) in milliinches; a missing argument restores the previous line thickness; the default line thickness is 8 milliinches. The line thickness thus specified takes effect only when a non-negative line thickness has not been specified Groff Version 1.08 9 August 1992 1 PIC(1) BSD Reference Manual PIC(1) by use of the tthhiicckknneessss attribute or by setting the lliinneetthhiicckk variable. --vv Print the version number. --zz In TeX mode draw dots using zero-length lines. The following options supported by other versions of ppiicc are ignored: --DD Draw all lines using the \D escape sequence. ppiicc always does this. --TT _d_e_v Generate output for the ttrrooffff device _d_e_v. This is unnecessary because the ttrrooffff output generated by ppiicc is device-independent. UUSSAAGGEE This section describes only the differences between GNU pic and the original version of pic. Many of these dif- ferences also apply to newer versions of Unix pic. TTeeXX mmooddee TeX mode is enabled by the --tt option. In TeX mode, pic will define a vbox called \\ggrraapphh for each picture. You must yourself print that vbox using, for example, the com- mand \\cceenntteerrlliinnee{{\\bbooxx\\ggrraapphh}} Actually, since the vbox has a height of zero this will produce slightly more vertical space above the picture than below it; \\cceenntteerrlliinnee{{\\rraaiissee 11eemm\\bbooxx\\ggrraapphh}} would avoid this. You must use a TeX driver that supports the ttppiicc specials, version 2. Lines beginning with \\ are passed through transparently; a %% is added to the end of the line to avoid unwanted spaces. You can safely use this feature to change fonts or to change the value of \\bbaasseelliinneesskkiipp. Anything else may well produce undesirable results; use at your own risk. Lines beginning with a period are not given any special treatment. CCoommmmaannddss Groff Version 1.08 9 August 1992 2 PIC(1) BSD Reference Manual PIC(1) ffoorr _v_a_r_i_a_b_l_e == _e_x_p_r_1 ttoo _e_x_p_r_2 [bbyy [**]_e_x_p_r_3] ddoo _X _b_o_d_y _X Set _v_a_r_i_a_b_l_e to _e_x_p_r_1. While the value of _v_a_r_i_a_b_l_e is less than or equal to _e_x_p_r_2, do _b_o_d_y and incre- ment _v_a_r_i_a_b_l_e by _e_x_p_r_3; if bbyy is not given, incre- ment _v_a_r_i_a_b_l_e by 1. If _e_x_p_r_3 is prefixed by ** then _v_a_r_i_a_b_l_e will instead be multiplied by _e_x_p_r_3. _X can be any character not occurring in _b_o_d_y. iiff _e_x_p_r tthheenn _X _i_f_-_t_r_u_e _X [eellssee _Y _i_f_-_f_a_l_s_e _Y] Evaluate _e_x_p_r; if it is non-zero then do _i_f_-_t_r_u_e, otherwise do _i_f_-_f_a_l_s_e. _X can be any character not occurring in _i_f_-_t_r_u_e. _Y can be any character not occurring in _i_f_-_f_a_l_s_e. pprriinntt _a_r_g... Concatenate the arguments and print as a line on stderr. Each _a_r_g must be an expression, a posi- tion, or text. This is useful for debugging. ccoommmmaanndd _a_r_g... Concatenate the arguments and pass them through as a line to troff orTeX. Each _a_r_g must be an expres- sion, a position, or text. This has a similar effect to a line beginning with .. or \\, but allows the values of variables to be passed through. sshh _X _c_o_m_m_a_n_d _X Pass _c_o_m_m_a_n_d to a shell. _X can be any character not occurring in _c_o_m_m_a_n_d. ccooppyy ""_f_i_l_e_n_a_m_e"" Include _f_i_l_e_n_a_m_e at this point in the file. ccooppyy [""_f_i_l_e_n_a_m_e""] tthhrruu _X _b_o_d_y _X [uunnttiill ""_w_o_r_d""] ccooppyy [""_f_i_l_e_n_a_m_e""] tthhrruu _m_a_c_r_o [uunnttiill ""_w_o_r_d""] This construct does _b_o_d_y once for each line of _f_i_l_e_n_a_m_e; the line is split into blank-delimited words, and occurrences of $$_i in _b_o_d_y, for _i between 1 and 9, are replaced by the _i-th word of the line. If _f_i_l_e_n_a_m_e is not given, lines are taken from the current input up to ..PPEE. If an uunnttiill clause is specified, lines will be read only until a line the first word of which is _w_o_r_d; that line will then be discarded. _X can be any character not occurring in _b_o_d_y. For example, ..PPSS ccooppyy tthhrruu %% cciirrccllee aatt (($$11,,$$22)) %% uunnttiill ""EENNDD"" 11 22 33 44 55 66 Groff Version 1.08 9 August 1992 3 PIC(1) BSD Reference Manual PIC(1) EENNDD bbooxx ..PPEE is equivalent to ..PPSS cciirrccllee aatt ((11,,22)) cciirrccllee aatt ((33,,44)) cciirrccllee aatt ((55,,66)) bbooxx ..PPEE The commands to be performed for each line can also be taken from a macro defined earlier by giving the name of the macro as the argument to tthhrruu. rreesseett rreesseett _v_a_r_i_a_b_l_e_1,, _v_a_r_i_a_b_l_e_2 _._._. Reset pre-defined variables _v_a_r_i_a_b_l_e_1, _v_a_r_i_a_b_l_e_2 ... to their default values. If no arguments are given, reset all pre-defined variables to their default values. Note that assigning a value to ssccaallee also causes all pre-defined variables that control dimensions to be reset to their default values times the new value of scale. pplloott _e_x_p_r [""_t_e_x_t""] This is a text object which is constructed by using _t_e_x_t as a format string for sprintf with an argu- ment of _e_x_p_r. If _t_e_x_t is omitted a format string of ""%%gg"" is used. Attributes can be specified in the same way as for a normal text object. Be very careful that you specify an appropriate format string; pic does only very limited checking of the string. This is deprecated in favour of sspprriinnttff. _v_a_r_i_a_b_l_e::==_e_x_p_r This is similar to == except _v_a_r_i_a_b_l_e must already be defined, and the value of _v_a_r_i_a_b_l_e will be changed only in the innermost block in which it is defined. (By contrast, == defines the variable in the current block if it is not already defined there, and then changes the value in the current block.) Arguments of the form _X anything _X are also allowed to be of the form Groff Version 1.08 9 August 1992 4 PIC(1) BSD Reference Manual PIC(1) {{ _a_n_y_t_h_i_n_g }} In this case _a_n_y_t_h_i_n_g can contain balanced occurrences of {{ and }}. Strings may contain _X or imbalanced occurrences of {{ and }}. EExxpprreessssiioonnss The syntax for expressions has been significantly extended: _x ^^ _y (exponentiation) ssiinn((_x)) ccooss((_x)) aattaann22((_y,, _x)) lloogg((_x)) (base 10) eexxpp((_x)) (base 10, ie 10_x) ssqqrrtt((_x)) iinntt((_x)) rraanndd(()) (return a random number between 0 and 1) rraanndd((_x)) (return a random number between 1 and _x; depre- cated) mmaaxx((_e_1,, _e_2)) mmiinn((_e_1,, _e_2)) !!_e _e_1 &&&& _e_2 _e_1 |||| _e_2 _e_1 ==== _e_2 _e_1 !!== _e_2 _e_1 >>== _e_2 _e_1 >> _e_2 _e_1 <<== _e_2 _e_1 << _e_2 ""_s_t_r_1"" ==== ""_s_t_r_2"" ""_s_t_r_1"" !!== ""_s_t_r_2"" String comparison expressions must be parenthesised in some contexts to avoid ambiguity. OOtthheerr CChhaannggeess A bare expression, _e_x_p_r, is acceptable as an attribute; it is equivalent to _d_i_r _e_x_p_r, where _d_i_r is the current direc- tion. For example lliinnee 22ii means draw a line 2 inches long in the current direction. The maximum width and height of the picture are taken from the variables mmaaxxppsswwiidd and mmaaxxppsshhtt. Initially these have values 8.5 and 11. Groff Version 1.08 9 August 1992 5 PIC(1) BSD Reference Manual PIC(1) Scientific notation is allowed for numbers. For example xx == 55ee--22 Text attributes can be compounded. For example, ""ffoooo"" aabboovvee lljjuusstt is legal. There is no limit to the depth to which blocks can be examined. For example, [[AA:: [[BB:: [[CC:: bbooxx ]]]]]] wwiitthh ..AA..BB..CC..ssww aatt 11,,22 cciirrccllee aatt llaasstt [[]]..AA..BB..CC is acceptable. Arcs now have compass points determined by the circle of which the arc is a part. Circles and arcs can be dotted or dashed. In TeX mode splines can be dotted or dashed. Boxes can have rounded corners. The rraadd attribute speci- fies the radius of the quarter-circles at each corner. If no rraadd or ddiiaamm attribute is given, a radius of bbooxxrraadd is used. Initially, bbooxxrraadd has a value of 0. A box with rounded corners can be dotted or dashed. The ..PPSS line can have a second argument specifying a maxi- mum height for the picture. If the width of zero is spec- ified the width will be ignored in computing the scaling factor for the picture. Note that GNU pic will always scale a picture by the same amount vertically as horizon- tally. This is different from the DWB 2.0 pic which may scale a picture by a different amount vertically than hor- izontally if a height is specified. Each text object has an invisible box associated with it. The compass points of a text object are determined by this box. The implicit motion associated with the object is also determined by this box. The dimensions of this box are taken from the width and height attributes; if the width attribute is not supplied then the width will be taken to be tteexxttwwiidd; if the height attribute is not sup- plied then the height will be taken to be the number of text strings associated with the object times tteexxtthhtt. Initially tteexxttwwiidd and tteexxtthhtt have a value of 0. In places where a quoted text string can be used, an expression of the form sspprriinnttff((""_f_o_r_m_a_t"",, _a_r_g,,...)) can also be used; this will produce the arguments Groff Version 1.08 9 August 1992 6 PIC(1) BSD Reference Manual PIC(1) formatted according to _f_o_r_m_a_t, which should be a string as described in pprriinnttff(3) appropriate for the number of argu- ments supplied, using only the ee, ff, gg or %% format charac- ters. The thickness of the lines used to draw objects is con- trolled by the lliinneetthhiicckk variable. This gives the thick- ness of lines in points. A negative value means use the default thickness: in TeX output mode, this means use a thickness of 8 milliinches; in TeX output mode with the --cc option, this means use the line thickness specified by ..ppss lines; in troff output mode, this means use a thickness proportional to the pointsize. A zero value means draw the thinnest possible line supported by the output device. Initially it has a value of -1. There is also a tthhiicckk[nneessss] attribute. For example, cciirrccllee tthhiicckknneessss 11..55 would draw a circle using a line with a thickness of 1.5 points. The thickness of lines is not affected by the value of the ssccaallee variable, nor by the width or height given in the ..PPSS line. Boxes (including boxes with rounded corners), circles and ellipses can be filled by giving then an attribute of ffiillll[eedd]. This takes an optional argument of an expres- sion with a value between 0 and 1; 0 will fill it with white, 1 with black, values in between with a proportion- ally gray shade. A value greater than 1 can also be used: this means fill with the shade of gray that is currently being used for text and lines. Normally this will be black, but output devices may provide a mechanism for changing this. Without an argument, then the value of the variable ffiillllvvaall will be used. Initially this has a value of 0.5. The invisible attribute does not affect the fill- ing of objects. Any text associated with a filled object will be added after the object has been filled, so that the text will not be obscured by the filling. Arrow heads will be drawn as solid triangles if the vari- able aarrrroowwhheeaadd is non-zero and either TeX mode is enabled or the --xx option has been given. Initially aarrrroowwhheeaadd has a value of 1. The troff output of pic is device-independent. The --TT option is therefore redundant. All numbers are taken to be in inches; numbers are never interpreted to be in troff machine units. Objects can have an aalliiggnneedd attribute. This will only Groff Version 1.08 9 August 1992 7 PIC(1) BSD Reference Manual PIC(1) work when the postprocessor is ggrrooppss. Any text associated with an object having the aalliiggnneedd attribute will be rotated about the center of the object so that it is aligned in the direction from the start point to the end point of the object. Note that this attribute will have no effect for objects whose start and end points are coin- cident. In places where _ntthh is allowed ``_e_x_p_r''tthh is also allowed. Note that ''tthh is a single token: no space is allowed between the '' and the tthh. For example, ffoorr ii == 11 ttoo 44 ddoo {{ line from `i'th box.nw to `i+1'th box.se } FFIILLEESS //uussrr//sshhaarree//ttmmaacc//ttmmaacc..ppiicc Example definitions of the PPSS and PPEE macros. SSEEEE AALLSSOO ttrrooffff(1), ggrrooffff__oouutt(5), tteexx(1) Tpic: Pic for TeX AT&T Bell Laboratories, Computing Science Technical Report No. 116, PIC -- A Graphics Language for Typesetting. (This can be obtained by sending a mail message to netlib@research.att.com with a body of `send 116 from research/cstr'.) BBUUGGSS Input characters that are illegal for ggrrooffff (ie those with ASCII code 0 or between 013 and 037 octal or between 0200 and 0237 octal) are rejected even in TeX mode. The interpretation of ffiillllvvaall is incompatible with the pic in 10th edition Unix, which interprets 0 as black and 1 as white. Groff Version 1.08 9 August 1992 8