Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ukma!xanth!mcnc!duke!romeo!dfk From: dfk@romeo.cs.duke.edu (David F. Kotz) Newsgroups: comp.text Subject: GnuTeX patch 5a Keywords: (2 of 5) Message-ID: <13510@duke.cs.duke.edu> Date: 12 Feb 89 18:20:56 GMT Sender: news@duke.cs.duke.edu Lines: 1614 #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # patch5a # This archive created: Sun Feb 12 13:16:10 1989 export PATH; PATH=/bin:$PATH if test -f 'patch5a' then echo shar: will not over-write existing file "'patch5a'" else sed 's/^X//' << \SHAR_EOF > 'patch5a' XCommon subdirectories: ../gnutex.old/Help and ./Help Xdiff -cr ../gnutex.old/Makefile ./Makefile X*** ../gnutex.old/Makefile Fri Feb 10 12:16:04 1989 X--- ./Makefile Fri Feb 10 12:12:21 1989 X*************** X*** 14,24 **** X DESTDIR=/usr/local/bin/ X MANDIR=/usr/man/manl X X! # -lplot iff UNIXPLOT you have -DUNIXPLOT X LIBS = -lm -lplot X X # -DVFORK iff vfork() supported X! CFLAGS = -DVFORK X X # -D only if you wish to support X # -DAED Aed767 X--- 14,32 ---- X DESTDIR=/usr/local/bin/ X MANDIR=/usr/man/manl X X! # The name of the help file (./gnutex.help installed as $(HELPFILE)) X! HELPFILE=/usr/local/lib/gnutex.help X! COMMANDFLAGS=-IHelp -DHELPFILE=\"$(HELPFILE)\" X! X! # -lplot iff you have -DUNIXPLOT below X LIBS = -lm -lplot X X+ # Pick either index() on BSD or strchr() on System V and MS-DOS X+ INDEX=-DINDEX=index X+ #INDEX=-DINDEX=strchr X+ X # -DVFORK iff vfork() supported X! CFLAGS = -DVFORK $(INDEX) X X # -D only if you wish to support X # -DAED Aed767 X*************** X*** 31,40 **** X # -DPC IBM PC EGA/CGA graphics X # -DPC -DCORONA IBM PC Corona graphics X # -DLATEX LaTeX output X X! #TERMFLAGS = -DQMS -DTEK -DHALFTEK -DUNIXPLOT -DLATEX X! TERMFLAGS = -DTEK -DUNIXPLOT -DLATEX X! #TERMFLAGS = -DLATEX X X # Your favorite tags program X TAGS=etags X--- 39,49 ---- X # -DPC IBM PC EGA/CGA graphics X # -DPC -DCORONA IBM PC Corona graphics X # -DLATEX LaTeX output X+ # -DIMAGEN Imagen printer output (also use -Idir, where dir is the X+ # location of imPcodes.h) X X! TERMFLAGS = -DTEK -DUNIXPLOT -DLATEX -DIMAGEN -I.. X! #TERMFLAGS = -DLATEX -DIMAGEN -I.. X X # Your favorite tags program X TAGS=etags X*************** X*** 41,67 **** X #TAGS=ctags X X OBJS = plot.o scanner.o parse.o command.o eval.o standard.o internal.o util.o\ X! graphics.o term.o misc.o version.o X X! SRC = plot.h command.c eval.c graphics.c internal.c misc.c \ X! parse.c plot.c scanner.c standard.c term.c util.c version.c X X! all: gnutex X X install: gnutex X! install -c -s gnutex $(DESTDIR)gnutex X install -c lasergnu $(DESTDIR)lasergnu X install -m 444 doc/gnutex.1 $(MANDIR)/gnutex.l X install -m 444 doc/lasergnu.1 $(MANDIR)/lasergnu.l X X gnutex: $(OBJS) X! cc $(CFLAGS) $(OBJS) $(LIBS) -o gnutex X X term.o: term.c X cc $(CFLAGS) $(TERMFLAGS) -c term.c X X $(OBJS): plot.h X X # Make a very simple demo plot X demo: X (cd doc/example; make) X--- 50,92 ---- X #TAGS=ctags X X OBJS = plot.o scanner.o parse.o command.o eval.o standard.o internal.o util.o\ X! graphics.o term.o misc.o help.o version.o X X! SRC = plot.h Help/help.h command.c eval.c graphics.c internal.c misc.c \ X! parse.c plot.c scanner.c standard.c term.c util.c Help/help.c version.c X X! all: gnutex mail X X install: gnutex X! install -c gnutex $(DESTDIR)gnutex X install -c lasergnu $(DESTDIR)lasergnu X install -m 444 doc/gnutex.1 $(MANDIR)/gnutex.l X install -m 444 doc/lasergnu.1 $(MANDIR)/lasergnu.l X+ install -m 444 -c gnutex.help $(HELPFILE) X X+ install-sysv: gnutex X+ mv gnutex $(DESTDIR) X+ cp lasergnu $(DESTDIR) X+ cp doc/*.1 $(MANDIR) X+ cp gnutex.help $(HELPFILE) X+ X gnutex: $(OBJS) X! cc $(CFLAGS) -O -s $(OBJS) $(LIBS) -o gnutex -lm X X term.o: term.c X cc $(CFLAGS) $(TERMFLAGS) -c term.c X X+ command.o: command.c X+ cc $(CFLAGS) $(COMMANDFLAGS) -c command.c X+ X+ help.o: Help/help.c X+ cc $(CFLAGS) -c Help/help.c X+ X $(OBJS): plot.h X X+ mail: X+ maildfk X+ X # Make a very simple demo plot X demo: X (cd doc/example; make) X*************** X*** 76,81 **** X--- 101,107 ---- X X clean: X rm -f *.o *~ core X+ (cd Help; make clean) X X spotless: X rm -f *.o *~ core gnutex TAGS Xdiff -cr ../gnutex.old/PATCHLEVEL ./PATCHLEVEL X*** ../gnutex.old/PATCHLEVEL Fri Feb 10 12:16:04 1989 X--- ./PATCHLEVEL Wed Feb 1 11:24:36 1989 X*************** X*** 1 **** X! 4 X--- 1 ---- X! 5 XOnly in ../gnutex.old: Patch3-rm Xdiff -cr ../gnutex.old/Patch5-rm ./Patch5-rm X*** ../gnutex.old/Patch5-rm Fri Feb 10 12:27:39 1989 X--- ./Patch5-rm Fri Feb 10 12:22:19 1989 X*************** X*** 0 **** X--- 1,8 ---- X+ #!/bin/sh X+ # X+ # remove files from old versions that aren't used any more X+ X+ rm -rf help/ vmshelp.csh Patch3-rm X+ X+ # remove this file X+ rm Patch5-rm Xdiff -cr ../gnutex.old/README ./README X*** ../gnutex.old/README Mon Dec 5 13:25:42 1988 X--- ./README Wed Feb 1 18:01:33 1989 X*************** X*** 6,13 **** X generally tried to retain the style of the original and to modify as X little as possible to make this possible. X X I have not tried compiling this for VMS, and only use the Latex and X! tektronix drivers. X X Documentation is in X gnutex.1 - man page for gnutex X--- 6,16 ---- X generally tried to retain the style of the original and to modify as X little as possible to make this possible. X X+ This version should compile successfully on Vaxes, Suns, Microvaxes, X+ IBM PCs, and HP-UX (a System V box). It also may work on VMS. X+ X I have not tried compiling this for VMS, and only use the Latex and X! Tektronix drivers. X X Documentation is in X gnutex.1 - man page for gnutex X*************** X*** 37,42 **** X--- 40,51 ---- X as long as you follow the usage statement given by the gnuplot authors X in each file. X X+ THANKS: X+ Thanks to many people who have pointed out bugs and made suggestions, X+ including Bob Desinger, Paul E. McKenney, and J. D. McDonald; to X+ bd@hp-sde.sde.hp.com, for the help-file code; and to the local users X+ who put up with the newest bugs. X+ X PATCHES: X patch1: Enhancement to add "set format" command. See help/set-show/format. X patch2: Small change to source so VMS compilers accept it. X*************** X*** 43,48 **** X--- 52,59 ---- X patch3: New manual written (see doc/). Several small but annoying bugs X fixed. Note that start-up initialization file is no long ".gnuplot" X but ".gnutex". X+ patch4: Mostly changes to make it work on an IBM PC. X+ patch5: Some bug fixes, System V support, Imagen support. X X David Kotz X November 4, 1988 Xdiff -cr ../gnutex.old/command.c ./command.c X*** ../gnutex.old/command.c Fri Feb 10 12:16:08 1989 X--- ./command.c Thu Feb 2 13:09:30 1989 X*************** X*** 21,26 **** X--- 21,27 ---- X #include X #include X #include "plot.h" X+ #include "help.h" X X #ifndef STDOUT X #define STDOUT 1 X*************** X*** 62,69 **** X char title_string[MAX_LINE_LEN] = ""; X char xlabel_string[MAX_LINE_LEN] = ""; X char ylabel_string[MAX_LINE_LEN] = ""; X! char xformat[MAX_ID_LEN] = "$%g$"; X! char yformat[MAX_ID_LEN] = "$%g$"; X int y_skip_factor = 0; X double plot_width = 4; /* width in inches, for latex */ X double plot_height = 3; /* height in inches, for latex */ X--- 63,70 ---- X char title_string[MAX_LINE_LEN] = ""; X char xlabel_string[MAX_LINE_LEN] = ""; X char ylabel_string[MAX_LINE_LEN] = ""; X! char xformat[MAX_ID_LEN] = ""; X! char yformat[MAX_ID_LEN] = ""; X int y_skip_factor = 0; X double plot_width = 4; /* width in inches, for latex */ X double plot_height = 3; /* height in inches, for latex */ X*************** X*** 93,99 **** X X struct curve_points plot[MAX_PLOTS]; X X! static char help[80] = HELP; X X #ifdef MSDOS X #include X--- 94,100 ---- X X struct curve_points plot[MAX_PLOTS]; X X! static char helpbuf[80]; X X #ifdef MSDOS X #include X*************** X*** 114,122 **** X $DESCRIPTOR(line_desc,input_line); X $DESCRIPTOR(null_desc,""); X X- $DESCRIPTOR(help_desc,help); X- $DESCRIPTOR(helpfile_desc,"GNUPLOT$HELP"); X- X struct dsc$descriptor_s *cmd_ptr; X X #endif X--- 115,120 ---- X*************** X*** 256,277 **** X define(); X else if (equals(c_token,"help") || equals(c_token,"?")) { X c_token++; X! len = sizeof(HELP)-1; X! help[len] = '\0'; /* remove previous help arguments */ X while (!(END_OF_COMMAND)) { X! help[len] = ' '; /* put blank between help segments */ X! copy_str(help+len+1,c_token++); X! len = strlen(help); X } X! #ifdef vms X! help_desc.dsc$w_length = len; X! if ((vaxc$errno = lbr$output_help(lib$put_output,0,&help_desc, X! &helpfile_desc,0,lib$get_input)) != SS$_NORMAL) X! os_error("can't open GNUPLOT$HELP"); X! #else /* vms */ X! if (system(help)) X! os_error("can't spawn help"); X! #endif /* vms */ X screen_ok = FALSE; X c_token++; X } X--- 254,286 ---- X define(); X else if (equals(c_token,"help") || equals(c_token,"?")) { X c_token++; X! len = 0; X while (!(END_OF_COMMAND)) { X! copy_str(helpbuf+len,c_token++); X! len = strlen(helpbuf); X! helpbuf[len++] = ' '; X! helpbuf[len] = '\0'; X } X! if (len > 0) { X! helpbuf[len-1] = '\n'; X! lower_case(helpbuf); X! } else X! sprintf(helpbuf, "\n"); X! switch (help(helpbuf, HELPFILE)) { X! case H_FOUND: X! /* already printed the help info; do nothing */ X! break; X! case H_NOTFOUND: X! printf("Sorry, no help for %s", helpbuf); X! break; X! case H_ERROR: X! perror(HELPFILE); X! break; X! default: /* defensive programming */ X! int_error("Impossible case in switch\n", NO_CARET); X! break; X! } X! X screen_ok = FALSE; X c_token++; X } X*************** X*** 749,756 **** X (*term_tbl[term].init)(); X term_init = TRUE; X } X! /* Below is a hack; no terminal but LATEX uses all these X! * arguments, and calling this here in LATEX hardly 'clears' X * the screen. (DFK 10/87) X */ X (*term_tbl[term].graphics)(plot_width, plot_height, X--- 758,765 ---- X (*term_tbl[term].init)(); X term_init = TRUE; X } X! /* Below is a hack; no terminals but LATEX and IMAGEN uses all X! * these arguments, and calling this for them hardly 'clears' X * the screen. (DFK 10/87) X */ X (*term_tbl[term].graphics)(plot_width, plot_height, X*************** X*** 966,971 **** X--- 975,982 ---- X /* x coordinate */ X const_express(&a); X x = real(&a); X+ if (log_x) /* handle coords on logscale plot. PEM 01/17/89 */ X+ x = log10(x); X X if (!equals(c_token, ",")) X int_error("comma expected", c_token); X*************** X*** 974,979 **** X--- 985,992 ---- X /* y coordinate */ X const_express(&a); X y = real(&a); X+ if (log_y) /* handle coords on logscale plot. PEM 01/17/89 */ X+ y = log10(y); X X /* text */ X if (isstring(c_token)) XCommon subdirectories: ../gnutex.old/doc and ./doc Xdiff -cr ../gnutex.old/gnutex.help ./gnutex.help X*** ../gnutex.old/gnutex.help Fri Feb 10 12:24:38 1989 X--- ./gnutex.help Wed Feb 1 21:12:46 1989 X*************** X*** 0 **** X--- 1,1068 ---- X+ ?? X+ ? X+ GNUTEX is a command-driven interactive function plotting program. X+ It is case sensitive (commands and function names written in lowercase X+ are not the same as those written in CAPS). All command names may be X+ abbreviated, as long as the abbreviation is not ambiguous. X+ X+ Commands may extend over several input lines, by ending each line but X+ the last with a backslash (\). The backslash must be the LAST X+ character on each line. The effect is as if the backslash and newline X+ were not there. That is, no white space is implied, nor is a comment X+ terminated. Therefore, commenting out a continued line comments out X+ the entire command. X+ X+ Additional help is available for each of these topics: X+ clear key plot shell X+ comments label print start-up X+ exit latex save substitution X+ expressions load set user-defined X+ ?continue X+ Commands may extend over several input lines, by ending each line but X+ the last with a backslash (\). The backslash must be the LAST X+ character on each line. The effect is as if the backslash and newline X+ were not there. That is, no white space is implied, nor is a comment X+ terminated. Therefore, commenting out a continued line comments out X+ the entire command. X+ ?clear X+ This command erases the current screen or output device as specified by X+ 'set output'. This usually generates a formfeed on hardcopy devices. X+ Use 'set terminal' to set the device type. X+ ?comments X+ X+ Comments: X+ Comments are now supported: a # may appear in most places in a line X+ and gnutex will ignore the rest of the line. It will not have this X+ affect inside quotes, inside numbers (incl. complex numbers), inside X+ command substitutions, etc. In short, it works anywhere it makes sense X+ to work. X+ ?exit X+ ?quit X+ 'exit', 'quit' and your computer's END-OF-FILE character will X+ exit GNUTEX. All these commands will clear the output device X+ (as the 'clear' command does) before exiting. X+ ?expressions X+ In general, any mathematical expression accepted by C, FORTRAN, Pascal, or X+ BASIC is valid. The precedence of these operators is determined by the X+ specifications of the C programming language. White space (spaces and tabs) X+ is ignored inside expressions. X+ X+ Complex constants may be expressed as {real,imag}, where and X+ must be numerical constants. For example {3,2} represents X+ 3 + 2i; {0,1} represents 'i' itself. X+ X+ Additional help is available for each of these topics: X+ functions operators X+ ?functions X+ ?expressions functions X+ The functions in GNUTEX are the same as the corresponding functions in X+ the UNIX math library, except that all functions accept integer, real, X+ and complex arguments, unless otherwise noted. The BASIC sgn() X+ function is also supported. X+ X+ Additional help is available for each of these topics: X+ abs asin besj1 ceil exp int real sinh tanh X+ acos atan besy0 cos floor log sgn sqrt X+ arg besj0 besy1 cosh imag log10 sin tan X+ ?expressions functions abs X+ ?abs X+ This function returns the absolute value of its argument. X+ The returned value is of the same type as the argument. X+ X+ For complex arguments, abs(x) is defined as the length of x in the X+ complex plane [i.e. sqrt(real(arg)**2 + imag(arg)**2) ]. X+ ?expressions functions acos X+ ?acos X+ This function returns the arc cosine (inverse cosine) of its argument. 'acos' X+ returns its argument in radians. X+ ?expressions functions arg X+ ?arg X+ This function returns the phase of a complex number, in radians. X+ ?expressions functions asin X+ ?asin X+ This function returns the arc sin (inverse sin) of its argument. 'asin' X+ returns its argument in radians. X+ ?expressions functions atan X+ ?atan X+ This function returns the arc tangent (inverse tangent) of its argument. X+ 'atan' returns its argument in radians. X+ ?expressions functions besj0 X+ ?besj0 X+ This function returns the j0th Bessel function of its argument. 'besj0' X+ expects its argument to be in radians. X+ ?expressions functions besj1 X+ ?besj1 X+ This function returns the j1st Bessel function of its argument. 'besj1' X+ expects its argument to be in radians. X+ ?expressions functions besy0 X+ ?besy0 X+ This function returns the y0th Bessel function of its argument. 'besy0' X+ expects its argument to be in radians. X+ ?expressions functions besy1 X+ ?besy1 X+ This function returns the y1st Bessel function of its argument. 'besy1' X+ expects its argument to be in radians. X+ ?expressions functions ceil X+ ?ceil X+ This function returns the largest integer not less than its argument. X+ For complex numbers, 'ceil' returns the largest integer not less than X+ the real part of its argument. X+ ?expressions functions cos X+ ?cos X+ This function returns the cosine of its argument. 'cos' expects its argument X+ to be in radians. X+ ?expressions functions cosh X+ ?cosh X+ This function returns the hyperbolic cosine of its argument. 'cosh' expects X+ its argument to be in radians. X+ ?expressions functions exp X+ ?exp X+ This function returns the exponential function of its argument (e raised to X+ the power of its argument). X+ ?expressions functions floor X+ ?floor X+ This function returns the smallest integer not greater than its argument. X+ For complex numbers, 'floor' returns the smallest integer not greater than X+ the real part of its argument. X+ ?expressions functions imag X+ ?imag X+ This function returns the imaginary part of its argument as a real number. X+ ?expressions functions int X+ ?int X+ This function returns the integer part of its argument, truncated toward X+ zero. X+ ?expressions functions log X+ ?log X+ This function returns the natural logarithm (base e) of its argument. X+ ?expressions functions log10 X+ ?log10 X+ This function returns the logarithm (base 10) of its argument. X+ ?expressions functions real X+ ?real X+ This function returns the real part of its argument. X+ ?expressions functions sgn X+ ?sgn X+ This function returns 1 if its argument is positive, -1 if its X+ argument is negative, and 0 if its argument is 0. If the argument X+ is a complex value, the imaginary component is ignored. X+ ?expressions functions sin X+ ?sin X+ This function returns the sine of its argument. 'sin' expects its argument X+ to be in radians. X+ ?expressions functions sinh X+ ?sinh X+ This function returns the hyperbolic sine of its argument. 'sinh' expects X+ its argument to be in radians. X+ ?expressions functions sqrt X+ ?sqrt X+ This function returns the square root of its argument. X+ ?expressions functions tan X+ ?tan X+ This function returns the tangent of its argument. 'tan' expects its argument X+ to be in radians. X+ ?expressions functions tanh X+ ?tanh X+ This function returns the hyperbolic tangent of its argument. 'tanh' expects X+ its argument to be in radians. X+ ?operators X+ ?expressions operators X+ The operators in GNUTEX are the same as the corresponding operators X+ in the C programming language, except that all operators accept integer, real, X+ and complex arguments, unless otherwise noted. The FORTRAN ** X+ (exponentiation) operator is also supported. X+ X+ Parentheses may be used to change order of evaluation. X+ X+ Additional help is available for each of these topics: X+ binary unary X+ ?expressions operators binary X+ ?binary X+ The following is a list of all the binary operators and their usage: X+ X+ Symbol Example Explanation X+ ** a**b exponentiation X+ * a*b multiplication X+ / a/b division X+ % a%b modulo X+ + a+b addition X+ - a-b subtraction X+ == a==b equality X+ != a!=b inequality X+ & a&b bitwise and X+ ^ a^b bitwise exclusive or X+ | a|b bitwise inclusive or X+ && a&&b logical and X+ || a||b logical or X+ ?: a?b:c terniary operation X+ X+ The terniary operator evaluates its first argument (a). If it is true X+ (non-zero) the second argument (b) is returned, otherwise the X+ third argument (c) is returned. X+ ?expressions operators unary X+ ?unary X+ The following is a list of all the unary operators and their usage: X+ X+ Symbol Example Explantion X+ - -a unary minus X+ ~ ~a one's complement X+ ! !a logical negation X+ ?key X+ LATEX ONLY: X+ X+ Plotting a Key: X+ If you wish a key describing the plots to be made, use the "key" command: X+ key x,y "description1" w [, "description2" w "] ... X+ X+ The key command looks a lot like a plot command. The coordinates x,y X+ specify the location of the key on the plot (see below). The key is X+ drawn as a sequence lines, with one plot described on each line. On X+ the left-hand side of each line is a representation that attempts to X+ mimic the way the curve is plotted (eg, a bunch of dots for a line, X+ the point symbol for a point, etc). On the right side of each line is X+ the text "description" given in the command. The lines are vertically X+ arranged so an imaginary straight line divides the left- and X+ right-hand sides of the key. It is the x-coordinate of this line that X+ you specify with the x in the key command; the y in the key command is X+ the bottom of the key. X+ X+ For example, the plot command X+ plot "foo" w points, "bar" w lines, "funky" w linespoints X+ followed by X+ key 5,5 "This is foo" w points, "This is bar" w lines, \ X+ "This is funky" w linespoints X+ would give us a key that looks (roughly) like this: X+ <> This is foo X+ ..... This is bar X+ ...+.. This is funky X+ (The <> is a diamond). X+ X+ Any styles may be used in the key entries, including user-defined X+ styles. For the points and linespoints styles, the point type plotted X+ is determined in the same way as in the plot command, so your key X+ entries should be in the same order as in the plot command. Note that X+ a key entry with an empty (ie "") description will not be included in X+ the key, but may be included to affect the point-type determination. X+ For example, if you didn't want to key the "foo" curve above, but you X+ wanted "funky" to look right, the key command is X+ key 5,5 "" w points, "This is bar" w lines, \ X+ "This is funky" w linespoints X+ and gives us a key that looks (roughly) like this: X+ ..... This is bar X+ ...+.. This is funky X+ X+ The key is fairly rough at this time and I may find ways to make it X+ look better. Suggestions welcome. X+ ?label X+ IMAGEN and LATEX ONLY: X+ X+ Arbitrary labels may be placed on the most recent plot, using the new X+ "label" command. The syntax is X+ label x,y "text" X+ where x,y is some coordinate in your plot's coordinate system (the X+ commas are important). The text is any arbitrary LaTeX input, and will X+ be processed in LR mode. The text is centered at the point x,y. The X+ label command should follow the plot command. Any number of labels may X+ be placed. X+ X+ If you want to adjust the way the label is positioned with respect to X+ the point x,y, add another parameter: X+ label x,y "text" pos X+ where pos is one of r,l,t,b,lt,lb,rt,rb indicating that the text X+ should be placed so that the point is at the right center, left X+ center, top center, bottom center, left top corner, etc. X+ X+ An arrow can be drawn out from the point simply by giving its X+ length in problem coordinates, after the pos: X+ label x,y "text" pos length X+ The length is defined to be the HORIZONTAL extent of the arrow, unless X+ the arrow is vertical, in which case it is the vertical extent of the X+ arrow. The arrow is drawn AWAY FROM the text; for example, if pos is X+ lt, then away is defined to be up and to the left. If it is b, away is X+ defined to be down. This allows for eight different directions of X+ arrows. X+ X+ Further control over the slope of the arrow can be gained by X+ specifying exactly the slope you want. You should read about vectors X+ on page 198 in the LaTeX manual. The command looks like X+ label x,y "text" pos length, h_slope, v_slope X+ (the commas are important). The h_slope and v_slope are integers in X+ the range -4 to 4, which specify the slope of the line (run, rise). X+ A horizontal line is 1,0, vertical is 0,1. The two numbers may not X+ have a common divisor other than +1 or -1. X+ X+ Labels outside of the plotted boundaries are permitted but may X+ interfere with axes labels or other text; use at your own risk. X+ ?latex X+ Documentation for the LATEX extensions to gnuplot (gnutex) (updated 11/4/88): X+ X+ To run gnutex, type X+ /usr/local/bin/gnutex X+ See /usr/local/public/doc/gnutex/* for examples and help. X+ X+ To use the LaTeX facilities of gnutex, the first command to gnutex X+ should be X+ set terminal latex X+ and the output of latex should be directed to a file, for example, X+ set output "plot.tex" X+ This may be anything you like but it should have a ".tex" extension, X+ of course. Then the size of the plot should be given, eg X+ set size 5, 4 X+ tells gnutex to use a 5 inch wide by 4 inch high box for the plot. X+ This is the size of the actual plotting area; labels (see below) will X+ extend outside of this size. X+ X+ When finished, the file will contain all of the plots you have X+ specified (you probably only want one plot per file). This file can X+ then be used in a LaTeX document, for example, X+ \begin {figure} X+ \input{plot} X+ \end {figure} X+ This puts the plot into a figure. X+ X+ Other than the above, gnutex acts much as gnuplot used to do. The plot X+ command will do its usual thing, but since TeX cannot draw straight X+ lines with arbitrary slopes, and runs out of memory if lines are X+ approximated by a series of many tiny dots, lines are drawn as a X+ series of dots. The usual symbols are plotted for the "with points" X+ linestyle. User-defined styles are described below. X+ X+ NOTE: Linestyles may no longer be abbreviated, for example, "p" for X+ "points", "l" for "lines", and "linesp" for "linespoints". The full X+ word must be written out. X+ X+ The plot is also labeled in a variety of ways. The ticks on the x X+ and y axes are labeled with the appropriate numbers. The axes may be X+ labeled and a title provided for the plot with new 'set' commands. X+ The labels in effect at the time of the "plot" command are used, so X+ they should be set before the plot. Once set, they retain their values X+ until explicitly changed. For example, X+ set title "This is the title of the plot" X+ set xlabel "This is the x axis" X+ set ylabel "This is the y axis" X+ will label the top, bottom, and left sides of the plot, respectively. X+ These can be more sophisticated, for example, X+ set title "This is a very long title\\because it has\\three lines" X+ set xlabel "This is the $x$ axis\\with more than two\\lines in the label" X+ set ylabel "This is a longer\\version of\\the $y$ axis" X+ Here there are line breaks, and math mode is used to make the 'x' and X+ 'y' look like variables. The line breaks are particularly useful for X+ the y axis label. X+ X+ If the ylabel is not coming out quite right (too close to the plot), X+ its position may be adjusted with a second parameter, such as X+ set ylabel "This is the y axis" 2 X+ This will slide the y label about 2 characters further left (away from X+ the plot). Positive and negative integers are allowed. X+ X+ Sometimes the x- or y-axis numbers really don't mean anything, and you X+ would rather not have the numbers and tics printed on the axis. If X+ this is the case, insert a X+ set noxtics X+ and/or X+ set noytics X+ before the plot command. To turn them back on use X+ set xtics X+ set ytics X+ X+ The tics on both axes are labelled with a format "$%g$", which uses X+ the general-purpose printf format and math mode to format the number. X+ If you want to change this, use the "set format" command: X+ set format "format-string" X+ set format "format-string" X+ where is 'x', 'y', or 'xy'. Using 'xy' is the same as using X+ nothing at all, as in the first form. This sets the format string to X+ be used for the given axis (axes). For example, you may prefer X+ "$%3.1f$" (note that math mode almost always looks better, but is not X+ necessary). Or maybe "$%3.0f \mu$sec", or "$%5.2 \cdot 10^{-3}$". Use X+ your imagination, but restrict yourself to the f, e, and g formats, as X+ the number is a double-precision number, and the other formats X+ (d,o,x,u,c,s) will not work correctly. X+ X+ X+ Plotting a Key: X+ If you wish a key describing the plots to be made, use the "key" command: X+ key x,y "description1" w [, "description2" w "] ... X+ X+ The key command looks a lot like a plot command. The coordinates x,y X+ specify the location of the key on the plot (see below). The key is X+ drawn as a sequence of lines, with one plot described on each line. On X+ the left-hand side of each line is a representation that attempts to X+ mimic the way the curve is plotted (eg, a bunch of dots for a line, X+ the point symbol for a point, etc). On the right side of each line is X+ the text "description" given in the command. The lines are vertically X+ arranged so an imaginary straight line divides the left- and X+ right-hand sides of the key. It is the x-coordinate of this line that X+ you specify with the x in the key command; the y in the key command is X+ the bottom of the key. X+ X+ For example, the plot command X+ plot "foo" w points, "bar" w lines, "funky" w linespoints X+ followed by X+ key 5,5 "This is foo" w points, "This is bar" w lines, \ X+ "This is funky" w linespoints X+ would give us a key that looks (roughly) like this: X+ <> This is foo X+ ..... This is bar X+ ...+.. This is funky X+ (The <> is a diamond). X+ X+ Any styles may be used in the key entries, including user-defined X+ styles. For the points and linespoints styles, the point type plotted X+ is determined in the same way as in the plot command, so your key X+ entries should be in the same order as in the plot command. Note that X+ a key entry with an empty (ie "") description will not be included in X+ the key, but may be included to affect the point-type determination. X+ For example, if you didn't want to key the "foo" curve above, but you X+ wanted "funky" to look right, the key command is X+ key 5,5 "" w points, "This is bar" w lines, \ X+ "This is funky" w linespoints X+ and gives us a key that looks (roughly) like this: X+ ..... This is bar X+ ...+.. This is funky X+ X+ The key is fairly rough at this time and I may find ways to make it X+ look better. Suggestions welcome. X+ X+ X+ User-defined linestyles: X+ If you find the "dot" approximation to lines to be inadequate, or X+ desire your different curves on the same plot to have different X+ styles, then you can define your own style (up to 16 may be defined). X+ A style may be defined at any time with a command of the form X+ set style X+ or X+ set style ... X+ or X+ set style ... X+ X+ The first form defines a style similar to "points", the second similar X+ to "lines" and the third to "linespoints". The is any X+ identifier, just as with user-defined variables and functions (it may X+ not be lines, points, impulses, or linespoints). To use the style, X+ simply use the where you would use any of the standard X+ linestyle names: "with ", "set data style ", or "set X+ function style ". X+ X+ The is a quoted string of LaTeX source which describes text to X+ be plotted at each point. Picture-mode and math-mode commands are the X+ most useful. For example, "\circle*{100}" draws a disk 1pt in X+ diameter at each data point (the units of picture coordinates in use X+ are 1/100 point). "$\Diamond$" produces a large diamond symbol. X+ X+ The and arguments define a line in terms of a sequence X+ of "dots" to be output every points along the line to be X+ plotted. is a real number whose units are points. Each dot X+ (up to 5 dots are allowed) is a quoted string of LaTeX text, as with X+ the point above. The dots are plotted in rotation along the whole X+ curve. X+ X+ Thus, to simulate a linespoints linestyle with alternating big and X+ little dots every 4 points the curve but to use a plus sign at each X+ data point, X+ set style mine "$+$" 4 "\circle*{100}" "\circle*{200}" X+ X+ The default style is as if X+ set style lines 2 "\circle*{1}" X+ set style linespoints 2 "\circle*{1}" X+ Had been executed. (The smallest circle that will be drawn is about X+ 100 units; smaller sizes as this one will use that smallest size). X+ Linespoints is special in that its points vary with each curve on the X+ plot, as with classic gnutex. This is not possible to embody in a X+ single user-defined linestyle. X+ X+ Labeling Curves: X+ Arbitrary labels may be placed on the most recent plot, using the new X+ "label" command. The syntax is X+ label x,y "text" X+ where x,y is some coordinate in your plot's coordinate system (the X+ commas are important). The text is any arbitrary LaTeX input, any will X+ be processed in LR mode. The text is centered at the point x,y. The X+ label command should follow the plot command. Any number of labels may X+ be placed. X+ X+ If you want to adjust the way the label is positioned with respect to X+ the point x,y, add another parameter: X+ label x,y "text" pos X+ where pos is one of r,l,t,b,lt,lb,rt,rb indicating that the text X+ should be placed so that the point is at the right center, left X+ center, top center, bottom center, left top corner, etc. X+ X+ An arrow can be drawn out from the point simply by giving its X+ length in problem coordinates, after the pos: X+ label x,y "text" pos length X+ The length is defined to be the HORIZONTAL extent of the arrow, unless X+ the arrow is vertical, in which case it is the vertical extent of the X+ arrow. The arrow is drawn AWAY FROM the text; for example, if pos is X+ lt, then away is defined to be up and to the left. If it is b, away is X+ defined to be down. This allows for eight different directions of X+ arrows. X+ X+ Further control over the slope of the arrow can be gained by X+ specifying exactly the slope you want. You should read about vectors X+ on page 198 in the LaTeX manual. The command looks like X+ label x,y "text" pos length, h_slope, v_slope X+ (the commas are important). The h_slope and v_slope are integers in X+ the range -4 to 4, which specify the slope of the line (run, rise). X+ A horizontal line is 1,0, vertical is 0,1. The two numbers may not X+ have a common divisor other than +1 or -1. X+ X+ Labels outside of the plotted boundaries are permitted but may X+ interfere with axes labels or other text; use at your own risk. X+ X+ Other X+ ----- X+ X+ Gnutex normally clips (actually, does not plot at all) data points X+ that fall within but too close to the boundaries (this is so the large X+ symbols used for points will not extend outside the boundary lines). X+ With the user-defined styles it is often desirable to make smaller X+ points, and thus points near the boundaries may be plotted. To turn X+ off clipping, use X+ set noclip X+ To turn it back on, use X+ set clip X+ The default is 'clip'. Without clipping you may have points near the X+ boundaries that look bad; try adjusting the x and y ranges. X+ X+ Comments: X+ Comments are now supported: a # may appear in most places in a line X+ and gnutex will ignore the rest of the line. It will not have this X+ affect inside quotes, inside numbers (incl. complex numbers), inside X+ command substitutions, etc. In short, it works anywhere it makes sense X+ to work. X+ X+ Please send bug reports and suggestions to dfk@cs.duke.edu. X+ ?load X+ This command executes each line of the specified input file X+ as if it had been typed in interactively. Files created by the 'save' X+ command can later be 'load'ed. Any text file containing valid commands X+ can be created and then executed by the 'load' command. Files being X+ 'load'ed may themselves contain 'load' commands. X+ X+ The 'load' command must be the last command on the line. X+ X+ Syntax: load X+ X+ The name of the input file must be enclosed in quotes. X+ ?plot X+ The 'plot' command is the primary command of the program. It displays X+ functions and data in many, many ways. The full syntax of this X+ command is: X+ X+ plot {ranges} {style} {, {style}...} X+ X+ Where is either a mathematical expression or the name of a X+ data file enclosed in quotes. User-defined functions and variables may also X+ be defined here. X+ X+ Curly braces {,} denote optional items. X+ X+ A 'plot' command can be as simple as X+ X+ plot sin(x) X+ X+ or as complex as (!) X+ X+ plot [t=1:100] [-pi:pi*2] tan(t), "data.1" with lines, besj0(t) with points X+ X+ Additional help is available for each of these topics: X+ data-file ranges style X+ ?plot data-file X+ ?data-file X+ ?data X+ Discrete data contained in a file can displayed by specifying the X+ name of the data file (enclosed in quotes) on the 'plot' command line. X+ X+ Data files should contain one data point per line. A data point may be X+ specified either as an X and Y value separated by blank space, or as X+ just the Y value, in which case the program will use the number of the X+ coordinate as the X value. Coordinate numbers starts at 0 and are X+ incremented for each data point read. Blank lines and lines beginning X+ with ! or # will be treated as comments and ignored. X+ X+ X+ This example compares the data in the file population.dat to a theoretical X+ curve: X+ pop(x) = 103*exp((1965-x)/10) X+ plot [1960:1990] 'population.dat', pop(x) X+ X+ The file population.dat might contain: X+ X+ ! Gnu population in Antarctica since 1965 X+ 1965 103 X+ 1970 55 X+ 1975 34 X+ 1980 24 X+ 1985 10 X+ ?plot ranges X+ ?ranges X+ ?range X+ These two options specify the region of the plot which will be displayed. X+ X+ Ranges may be provided on the 'plot' command line as synonyms for the X+ 'set xrange' and 'set yrange' commands. X+ X+ Syntax: [{dummy-var =} {xmin : xmax}] { [{ymin : ymax}] } X+ X+ Where dummy-var is the independent variable ('x' is used by default) and X+ the min and max terms can be expressions or constants. X+ X+ Both the min and max terms are optional. The ':' is also optional if X+ neither a min nor a max term is specified. This allows '[]' to be used X+ as a null range specification. X+ X+ Specifying a Y range turns autoscaling OFF. X+ X+ Examples: X+ X+ plot cos(x) ; use current ranges X+ plot [-10:30] sin(pi*x)/(pi*x) ; set xrange only X+ plot [t = -10 :30] sin(pi*t)/(pi*t) ; same, but use t as dummy-var X+ plot [-pi:pi] [-3:3] tan(x), 1/x ; set y and xranges X+ plot [] [-2:sin(5)*-8] sin(x)**besj0(x) ; set only yrange X+ plot [:200] [-pi:] exp(sin(x)) ; set xmax and ymin only X+ ?plot style X+ ?style X+ Plots may be displayed in one of these styles: 'lines', 'points', X+ 'linespoints', 'impulses', or 'dots'. The 'lines' style connects X+ adjacent points with lines. The 'points' style displays a small X+ symbol at each point. The 'linespoints' style is a combination of the X+ previous two styles. The 'impulses' style displays a vertical line X+ from the X axis to each point. The 'dots' style is like the 'points' X+ style except a very tiny dot is plotted at each point, and the symbol X+ does not vary from plot to plot. This is useful for plotting very many X+ points to get a feel for the distribution. In addition, for LaTeX X+ output only, there are user-defined styles (see the 'set style' X+ command in 'user-styles'). X+ X+ Default styles are chosen with the 'set function style' and 'set data style' X+ commands. X+ X+ Syntax: with