[BACK]Return to eepic.trm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot / term

Annotation of OpenXM_contrib/gnuplot/term/eepic.trm, Revision 1.1.1.3

1.1       maekawa     1: /*
1.1.1.3 ! ohara       2:  * $Id: eepic.trm,v 1.8.2.3 2002/12/11 19:24:26 lhecking Exp $
1.1       maekawa     3:  *
                      4:  */
                      5:
                      6: /* GNUPLOT - eepic.trm */
                      7:
                      8: /*[
                      9:  * Copyright 1990 - 1993, 1998
                     10:  *
                     11:  * Permission to use, copy, and distribute this software and its
                     12:  * documentation for any purpose with or without fee is hereby granted,
                     13:  * provided that the above copyright notice appear in all copies and
                     14:  * that both that copyright notice and this permission notice appear
                     15:  * in supporting documentation.
                     16:  *
                     17:  * Permission to modify the software is granted, but not the right to
                     18:  * distribute the complete modified source code.  Modifications are to
                     19:  * be distributed as patches to the released version.  Permission to
                     20:  * distribute binaries produced by compiling modified sources is granted,
                     21:  * provided you
                     22:  *   1. distribute the corresponding source modifications from the
                     23:  *    released version in the form of a patch file along with the binaries,
                     24:  *   2. add special version identification to distinguish your version
                     25:  *    in addition to the base release version number,
                     26:  *   3. provide your name and address as the primary contact for the
                     27:  *    support of your modified version, and
                     28:  *   4. retain our contact information in regard to use of the base
                     29:  *    software.
                     30:  * Permission to distribute the released version of the source code along
                     31:  * with corresponding source modifications in the form of a patch file is
                     32:  * granted with same provisions 2 through 4 for binary distributions.
                     33:  *
                     34:  * This software is provided "as is" without express or implied warranty
                     35:  * to the extent permitted by applicable law.
                     36: ]*/
                     37:
                     38: /*
                     39:  * This file is included by ../term.c.
                     40:  *
                     41:  * This terminal driver supports:
                     42:  *   The EEPIC macros for LaTeX.
                     43:  *
                     44:  * AUTHORS
                     45:  *   David Kotz
                     46:  *
                     47:  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
                     48:  *
                     49:  */
                     50: /*
                     51:  *  This file contains the eepic terminal driver, intended for use with the
                     52:  *  eepic.sty macro package for LaTeX. This is an alternative to the
                     53:  *  latex driver. You need eepic.sty, epic.sty, and a printer driver that
                     54:  *  supports the tpic \specials.
                     55:  *
                     56:  * Although dotted and dashed lines are possible with EEPIC, and are
                     57:  * tempting, they do not work well for high-sample-rate curves, mushing
                     58:  * the dashes all together into a solid line. For now anyway, the EEPIC
                     59:  * driver will have only solid lines. Anyone got a solution?
                     60:  *
                     61:  * LATEX must also be defined.
                     62:  */
                     63: /*
                     64:  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
                     65:  */
1.1.1.3 ! ohara      66: /* Additions by Gabriel Zachmann (Gabriel.Zachmann@gmx.net), Nov 2000:
        !            67:  * - little bug fix in stacked (faked rotated) text
        !            68:  * - color support
        !            69:  * - true rotated text
        !            70:  * - augmented line types set with dashed lines
        !            71:  * - optionally small or tiny point symbols
        !            72:  * - font size
        !            73:  */
        !            74:
1.1       maekawa    75:
                     76: #include "driver.h"
                     77:
                     78: #ifdef TERM_REGISTER
                     79: register_term(eepic)
                     80: #endif
                     81:
                     82: #ifdef TERM_PROTO
1.1.1.3 ! ohara      83:
        !            84: #include <ctype.h>
        !            85:
1.1       maekawa    86: TERM_PUBLIC void EEPIC_init __PROTO((void));
                     87: TERM_PUBLIC void EEPIC_graphics __PROTO((void));
                     88: TERM_PUBLIC void EEPIC_text __PROTO((void));
                     89: TERM_PUBLIC void EEPIC_linetype __PROTO((int linetype));
                     90: TERM_PUBLIC void EEPIC_move __PROTO((unsigned int x, unsigned int y));
                     91: TERM_PUBLIC void EEPIC_point __PROTO((unsigned int x, unsigned int y,
                     92:                                      int number));
                     93: TERM_PUBLIC void EEPIC_vector __PROTO((unsigned int ux, unsigned int uy));
                     94: TERM_PUBLIC void EEPIC_arrow __PROTO((unsigned int sx, unsigned int sy,
                     95:                                      unsigned int ex, unsigned int ey,
                     96:                                      TBOOLEAN head));
                     97: TERM_PUBLIC void EEPIC_put_text __PROTO((unsigned int x, unsigned int y,
                     98:                                         char str[]));
                     99: TERM_PUBLIC int EEPIC_justify_text __PROTO((enum JUSTIFY mode));
                    100: TERM_PUBLIC int EEPIC_text_angle __PROTO((int ang));
                    101: TERM_PUBLIC void EEPIC_reset __PROTO((void));
1.1.1.3 ! ohara     102: TERM_PUBLIC void EEPIC_options __PROTO((void));
1.1       maekawa   103:
1.1.1.3 ! ohara     104: #define EEPIC_PTS_PER_INCH 72.27
1.1       maekawa   105: /* resolution of printer we expect to use */
1.1.1.3 ! ohara     106: #define EEPIC_DOTS_PER_INCH 600
1.1       maekawa   107: /* dot size in pt */
1.1.1.3 ! ohara     108: #define EEPIC_UNIT (EEPIC_PTS_PER_INCH/EEPIC_DOTS_PER_INCH)
1.1       maekawa   109:
                    110: /* 5 inches wide by 3 inches high (default) */
1.1.1.3 ! ohara     111: #define EEPIC_XMAX (EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0)
        !           112: #define EEPIC_YMAX (EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0)
        !           113:
        !           114: #define EEPIC_HTIC (5.0/EEPIC_UNIT)
        !           115: #define EEPIC_VTIC (5.0/EEPIC_UNIT)
        !           116: #define EEPIC_VCHAR (10.0/EEPIC_UNIT)
        !           117: #define EEPIC_HCHAR (EEPIC_VCHAR/2.0)
1.1       maekawa   118: #endif /* TERM_PROTO */
                    119:
                    120: #ifndef TERM_PROTO_ONLY
                    121: #ifdef TERM_BODY
                    122:
                    123: static unsigned int EEPIC_posx;
                    124: static unsigned int EEPIC_posy;
1.1.1.3 ! ohara     125: static enum JUSTIFY eepic_justify = LEFT;
1.1       maekawa   126: static int eepic_angle = 0;
1.1.1.3 ! ohara     127: static int eepic_color_on = FALSE;             /* use \color */
        !           128: static int eepic_true_rotate = FALSE;          /* use \rotatebox */
        !           129: static int fontsize_set = FALSE;
1.1       maekawa   130:
                    131: /* for DOTS point style */
                    132: #define EEPIC_TINY_DOT "\\rule{.1pt}{.1pt}"
                    133:
                    134: /* POINTS */
1.1.1.3 ! ohara     135: static int eepic_num_point_types[] = { 12, 10, 8 };
        !           136: static int eepic_pointsize = 0;
        !           137: static char GPFAR *GPFAR EEPIC_points[][12] =
        !           138: {
        !           139:        {
        !           140:                "\\makebox(0,0){$\\Diamond$}",
        !           141:                "\\makebox(0,0){$+$}",
        !           142:                "\\makebox(0,0){$\\Box$}",
        !           143:                "\\makebox(0,0){$\\times$}",
        !           144:                "\\makebox(0,0){$\\triangle$}",
        !           145:                "\\makebox(0,0){$\\star$}",
        !           146:                "\\circle{12}", "\\circle{18}", "\\circle{24}",
        !           147:                "\\circle*{12}", "\\circle*{18}", "\\circle*{24}"
        !           148:        },
        !           149:        {
        !           150:                "\\makebox(0,0){$\\scriptstyle\\Diamond$}",
        !           151:                "\\makebox(0,0){$\\scriptstyle +$}",
        !           152:                "\\makebox(0,0){$\\scriptstyle\\Box$}",
        !           153:                "\\makebox(0,0){$\\scriptstyle\\times$}",
        !           154:                "\\makebox(0,0){$\\scriptstyle\\triangle$}",
        !           155:                "\\makebox(0,0){$\\scriptstyle\\star$}",
        !           156:                "\\circle{12}", "\\circle{18}",
        !           157:                "\\circle*{12}", "\\circle*{18}",
        !           158:        },
        !           159:        {
        !           160:                "\\makebox(0,0){$\\scriptscriptstyle\\Diamond$}",
        !           161:                "\\makebox(0,0){$\\scriptscriptstyle +$}",
        !           162:                "\\makebox(0,0){$\\scriptscriptstyle\\Box$}",
        !           163:                "\\makebox(0,0){$\\scriptscriptstyle\\times$}",
        !           164:                "\\makebox(0,0){$\\scriptscriptstyle\\triangle$}",
        !           165:                "\\makebox(0,0){$\\scriptscriptstyle\\star$}",
        !           166:                "\\circle{12}",
        !           167:                "\\circle*{12}",
        !           168:        }
1.1       maekawa   169: };
                    170:
                    171: /* LINES */
1.1.1.3 ! ohara     172: static int eepic_numlines[] = { 5, 7, 8 };     /* number of linetypes below */
        !           173: #define EEPIC_MAX_NUMLINES 8                           /* max of eepic_numlines[] */
        !           174: static int eepic_lineset = 0;
        !           175: static char GPFAR *GPFAR EEPIC_lines[][EEPIC_MAX_NUMLINES] =
        !           176: {
        !           177:        {
        !           178:                "\\thicklines \\path",  /* -2 border */
        !           179:                "\\thinlines \\drawline[-50]",  /* -1 axes */
        !           180:                "\\thinlines \\path",   /*  0 solid thin  */
        !           181:                "\\thicklines \\path",  /*  1 solid thick */
        !           182:                "\\Thicklines \\path"   /*  2 solid Thick */
        !           183:        },
        !           184:        {
        !           185:                "\\thicklines \\path",  /* -2 border */
        !           186:                "\\thinlines \\drawline[-50]",  /* -1 axes */
        !           187:                "\\thinlines \\path",   /*  0 solid thin  */
        !           188:                "\\thinlines \\dashline[90]{10}",
        !           189:                "\\thinlines \\dottedline{10}",
        !           190:                "\\thinlines \\dashline[60]{20}",
        !           191:                "\\thinlines \\dottedline{20}"
        !           192:        },
        !           193:        {
        !           194:                "\\thicklines \\path",  /* -2 border */
        !           195:                "\\thinlines \\drawline[-50]",  /* -1 axes */
        !           196:                "\\thinlines \\path",
        !           197:                "\\thinlines \\path",
        !           198:                "\\thinlines \\path",
        !           199:                "\\thinlines \\path",
        !           200:                "\\thinlines \\path",
        !           201:                "\\thinlines \\path"
        !           202:        }
1.1       maekawa   203: };
                    204: static int EEPIC_type;         /* current line type */
                    205: static TBOOLEAN EEPIC_inline = FALSE;  /* are we in the middle of a line */
1.1.1.3 ! ohara     206: static void EEPIC_endline __PROTO((void)); /* terminate any line in progress */
1.1       maekawa   207: static int EEPIC_linecount = 0;        /* number of points in line so far */
                    208: #define EEPIC_LINEMAX 50       /* max value for linecount */
                    209:
1.1.1.3 ! ohara     210: #define EEPIC_NUM_COLORS 7
        !           211: static int eepic_color = 0;
        !           212: static char GPFAR *GPFAR eepic_colors[EEPIC_NUM_COLORS] =
        !           213: {
        !           214:        "\\color{black}\n",     /* border and axes (must be black!) */
        !           215:        "\\color{red}\n",
        !           216:        "\\color{blue}\n",
        !           217:        "\\color{green}\n",
        !           218:        "\\color{magenta}\n",
        !           219:        "\\color{cyan}\n",
        !           220:        "\\color{yellow}\n"
        !           221: };
        !           222:
1.1       maekawa   223: /* ARROWS */
                    224: /* we use the same code as for LATEX */
                    225: /* figure out the best arrow */
1.1.1.3 ! ohara     226: void best_latex_arrow __PROTO((int sx, int sy, int ex, int ey, int who, TBOOLEAN head));
1.1       maekawa   227:
1.1.1.3 ! ohara     228: TERM_PUBLIC void
        !           229: EEPIC_init()
1.1       maekawa   230: {
                    231:     EEPIC_posx = EEPIC_posy = 0;
1.1.1.3 ! ohara     232:        EEPIC_type = 0;
        !           233:        EEPIC_linecount = 0;
        !           234:        EEPIC_inline = FALSE;
        !           235:        eepic_color = 0;
        !           236:     fprintf(gpoutfile, "\
        !           237: %% GNUPLOT: LaTeX picture using EEPIC macros\n\
        !           238: \\setlength{\\unitlength}{%fpt}\n",
        !           239:            EEPIC_UNIT);
1.1       maekawa   240: }
                    241:
                    242:
1.1.1.3 ! ohara     243: TERM_PUBLIC void
        !           244: EEPIC_graphics()
1.1       maekawa   245: {
                    246:     register struct termentry *t = term;
                    247:
1.1.1.3 ! ohara     248:     /* HBB 20001027: respect 'size' and 'offset' settings to modify
        !           249:      * picture box size and position */
        !           250:     fprintf(gpoutfile, "\\begin{picture}(%d,%d)(%d,%d)\n",
        !           251:            (int) (t->xmax * xsize),
        !           252:            (int) (t->ymax * ysize),
        !           253:            (int) (t->xmax * xoffset),
        !           254:            (int) (t->ymax * xoffset));
        !           255:     if ( fontsize_set )
        !           256:     {
        !           257:        float x = t->v_char * EEPIC_UNIT + 0.5;
        !           258:        fprintf(gpoutfile,"\\fontsize{%d}{%g}\\selectfont\n",
        !           259:                (int) x,  1.2 * x );
        !           260:     }
        !           261:     else
        !           262:        fprintf(gpoutfile,"\\footnotesize\n" );
1.1       maekawa   263:
                    264: }
                    265:
                    266:
1.1.1.3 ! ohara     267: TERM_PUBLIC void
        !           268: EEPIC_text()
1.1       maekawa   269: {
                    270:     EEPIC_endline();
                    271:     fputs("\\end{picture}\n", gpoutfile);
                    272: }
                    273:
                    274:
1.1.1.3 ! ohara     275: TERM_PUBLIC void
        !           276: EEPIC_linetype(linetype)
        !           277:     int linetype;
1.1       maekawa   278: {
                    279:     EEPIC_endline();
                    280:
1.1.1.3 ! ohara     281:     EEPIC_type = linetype % (eepic_numlines[eepic_lineset] - 2);
1.1       maekawa   282:
1.1.1.3 ! ohara     283:        if ( eepic_color_on )
        !           284:        {
        !           285:                eepic_color = linetype;
        !           286:                if ( eepic_color < 0 )
        !           287:                        eepic_color = 0;
        !           288:                else
        !           289:                {
        !           290:                        eepic_color %= EEPIC_NUM_COLORS - 1;
        !           291:                        eepic_color += 1;
        !           292:                }
        !           293:                fputs( eepic_colors[eepic_color], gpoutfile );
        !           294:        }
1.1       maekawa   295: }
                    296:
                    297:
                    298:
1.1.1.3 ! ohara     299: TERM_PUBLIC void
        !           300: EEPIC_move(x, y)
        !           301:     unsigned int x, y;
1.1       maekawa   302: {
                    303:     EEPIC_endline();
                    304:
                    305:     EEPIC_posx = x;
                    306:     EEPIC_posy = y;
                    307: }
                    308:
                    309:
1.1.1.3 ! ohara     310: TERM_PUBLIC void
        !           311: EEPIC_point(x, y, number)      /* version of line_and_point */
        !           312:     unsigned int x, y;
        !           313:     int number;                        /* type of point */
1.1       maekawa   314: {
                    315:     EEPIC_move(x, y);
                    316:
                    317:     /* Print the character defined by 'number'; number < 0 means
                    318:        to use a dot, otherwise one of the defined points. */
                    319:     fprintf(gpoutfile, "\\put(%d,%d){%s}\n", x, y,
                    320:            (number < 0 ? EEPIC_TINY_DOT
1.1.1.3 ! ohara     321:             : EEPIC_points[eepic_pointsize][number % eepic_num_point_types[eepic_pointsize]]));
1.1       maekawa   322: }
                    323:
                    324:
1.1.1.3 ! ohara     325: TERM_PUBLIC void
        !           326: EEPIC_vector(ux, uy)
1.1       maekawa   327: unsigned int ux, uy;
                    328: {
1.1.1.3 ! ohara     329:        if (!EEPIC_inline) {
        !           330:                EEPIC_inline = TRUE;
1.1       maekawa   331:
1.1.1.3 ! ohara     332:                /* Start a new line. This depends on line type */
        !           333:                fprintf(gpoutfile, "%s(%u,%u)",
        !           334:                                EEPIC_lines[eepic_lineset][EEPIC_type + 2],
        !           335:                                EEPIC_posx, EEPIC_posy);
        !           336:                EEPIC_linecount = 1;
        !           337:        } else {
        !           338:                /* Even though we are in middle of a path,
        !           339:                 * we may want to start a new path command.
        !           340:                 * If they are too long then latex will choke.
        !           341:                 */
        !           342:                if (EEPIC_linecount++ >= EEPIC_LINEMAX) {
        !           343:                        fprintf(gpoutfile, "\n%s(%u,%u)",
        !           344:                                        EEPIC_lines[eepic_lineset][EEPIC_type + 2],
        !           345:                                        EEPIC_posx, EEPIC_posy);
        !           346:                        EEPIC_linecount = 1;
        !           347:                }
1.1       maekawa   348:        }
                    349:     fprintf(gpoutfile, "(%u,%u)", ux, uy);
                    350:     EEPIC_posx = ux;
                    351:     EEPIC_posy = uy;
                    352: }
                    353:
1.1.1.3 ! ohara     354: static void
        !           355: EEPIC_endline()
1.1       maekawa   356: {
                    357:     if (EEPIC_inline) {
                    358:        putc('\n', gpoutfile);
                    359:        EEPIC_inline = FALSE;
                    360:     }
                    361: }
                    362:
                    363:
1.1.1.3 ! ohara     364: TERM_PUBLIC void
        !           365: EEPIC_arrow(sx, sy, ex, ey, head)
1.1       maekawa   366: unsigned int sx, sy, ex, ey;
                    367: TBOOLEAN head;
                    368: {
                    369:     best_latex_arrow(sx, sy, ex, ey, 2, head); /* call latex routine */
                    370:
                    371:     EEPIC_posx = ex;
                    372:     EEPIC_posy = ey;
                    373: }
                    374:
                    375:
1.1.1.3 ! ohara     376: TERM_PUBLIC void
        !           377: EEPIC_put_text(x, y, str)
        !           378:     unsigned int x, y;         /* reference point of string */
        !           379:     char str[];                        /* the text */
1.1       maekawa   380: {
1.1.1.3 ! ohara     381:     int i, l;
        !           382:
1.1       maekawa   383:     EEPIC_endline();
                    384:
                    385:     fprintf(gpoutfile, "\\put(%d,%d)", x, y);
                    386:     if ((str[0] == '{') || (str[0] == '[')) {
                    387:        fprintf(gpoutfile, "{\\makebox(0,0)%s}\n", str);
1.1.1.3 ! ohara     388:     }
        !           389:     else
        !           390:     switch (eepic_angle)
        !           391:     {
        !           392:        case 0:
        !           393:        {
        !           394:           switch (eepic_justify) {
        !           395:               case LEFT:
        !           396:                   fputs("{\\makebox(0,0)[l]{",gpoutfile);
        !           397:                   break;
        !           398:               case CENTRE:
        !           399:                   fputs("{\\makebox(0,0){",gpoutfile);
        !           400:                   break;
        !           401:               case RIGHT:
        !           402:                   fputs("{\\makebox(0,0)[r]{",gpoutfile);
        !           403:                   break;
        !           404:           }
        !           405:           fprintf(gpoutfile,"%s}}\n", str);
        !           406:           break;
1.1       maekawa   407:        }
1.1.1.3 ! ohara     408:        case 1:
        !           409:        {
        !           410:           if ( eepic_true_rotate )
        !           411:           {
        !           412:               /* use \rotatebox */
        !           413:               switch (eepic_justify) {
        !           414:                   case LEFT:
        !           415:                       fputs("{\\makebox(0,0)[lb]{\\rotatebox[origin=c]{90}{",
        !           416:                             gpoutfile);
        !           417:                       break;
        !           418:                   case CENTRE:
        !           419:                       fputs("{\\makebox(0,0)[l]{\\rotatebox[origin=c]{90}{",
        !           420:                             gpoutfile);
        !           421:                       break;
        !           422:                   case RIGHT:
        !           423:                       fputs("{\\makebox(0,0)[lt]{\\rotatebox[origin=c]{90}{",
        !           424:                             gpoutfile);
        !           425:                       break;
        !           426:               }
        !           427:               fprintf(gpoutfile,"%s}}}\n", str);
        !           428:           }
        !           429:           else
        !           430:           {
        !           431:               /* put text in a short stack */
        !           432:               switch (eepic_justify) {
        !           433:                   case LEFT:
        !           434:                       fputs("{\\makebox(0,0)[lb]{\\shortstack{",gpoutfile);
        !           435:                       break;
        !           436:                   case CENTRE:
        !           437:                       fputs("{\\makebox(0,0)[l]{\\shortstack{",gpoutfile);
        !           438:                       break;
        !           439:                   case RIGHT:
        !           440:                       fputs("{\\makebox(0,0)[lt]{\\shortstack{",gpoutfile);
        !           441:                       break;
        !           442:               }
        !           443:               l = strlen(str)-1;
        !           444:               for ( i = 0; i < l; i ++ )
        !           445:                   fprintf(gpoutfile, "%c\\\\", str[i] );
        !           446:               fputc(str[l],gpoutfile);
        !           447:               fputs("}}}\n",gpoutfile);
        !           448:           }
        !           449:           break;
        !           450:        }
        !           451:     }
1.1       maekawa   452: }
                    453:
                    454:
                    455:
1.1.1.3 ! ohara     456: TERM_PUBLIC int
        !           457: EEPIC_justify_text(mode)
1.1       maekawa   458: enum JUSTIFY mode;
                    459: {
                    460:     eepic_justify = mode;
                    461:     return (TRUE);
                    462: }
                    463:
1.1.1.3 ! ohara     464: TERM_PUBLIC int
        !           465: EEPIC_text_angle(ang)
1.1       maekawa   466: int ang;
                    467: {
                    468:     eepic_angle = ang;
                    469:     return (TRUE);
                    470: }
                    471:
1.1.1.3 ! ohara     472: TERM_PUBLIC void
        !           473: EEPIC_reset()
1.1       maekawa   474: {
                    475:     EEPIC_endline();
                    476:     EEPIC_posx = EEPIC_posy = 0;
                    477: }
                    478:
1.1.1.3 ! ohara     479: TERM_PUBLIC void
        !           480: EEPIC_options()
        !           481: {
        !           482:     float fontsize = 0;
        !           483:
        !           484:     eepic_color_on =
        !           485:     eepic_true_rotate = FALSE;
        !           486:     eepic_lineset = 0;
        !           487:     eepic_pointsize = 0;
        !           488:
        !           489:     while (!END_OF_COMMAND)
        !           490:     {
        !           491:        if (almost_equals(c_token, "de$fault"))
        !           492:        {
        !           493:            fontsize_set = FALSE;
        !           494:            eepic_color_on =
        !           495:            eepic_true_rotate = FALSE;
        !           496:            eepic_lineset = 0;
        !           497:            eepic_pointsize = 0;
        !           498:            c_token++;
        !           499:        }
        !           500:        else
        !           501:        if (almost_equals(c_token, "c$olor") ||
        !           502:            almost_equals(c_token, "c$olour"))
        !           503:        {
        !           504:            eepic_color_on = TRUE;
        !           505:            eepic_lineset = 2;
        !           506:            c_token++;
        !           507:        }
        !           508:        else
        !           509:        if (almost_equals(c_token, "r$otate"))
        !           510:        {
        !           511:            eepic_true_rotate = TRUE;
        !           512:            c_token++;
        !           513:        }
        !           514:        else
        !           515:        if (almost_equals(c_token, "da$shed"))
        !           516:        {
        !           517:            if ( ! eepic_color_on )
        !           518:                eepic_lineset = 1;      /* ignore when color is on */
        !           519:            c_token++;
        !           520:        }
        !           521:        else
        !           522:        if (almost_equals(c_token, "s$mall"))
        !           523:        {
        !           524:            eepic_pointsize = 1;
        !           525:            c_token++;
        !           526:        }
        !           527:        else
        !           528:        if (almost_equals(c_token, "t$iny"))
        !           529:        {
        !           530:            eepic_pointsize = 2;
        !           531:            c_token++;
        !           532:        }
        !           533:        if ( isdigit((unsigned char)
        !           534:                     input_line[token[c_token].start_index]) )
        !           535:        {
        !           536:            /* stolen from pslatex.trm */
        !           537:            struct value a;
        !           538:            fontsize = real(const_express(&a));
        !           539:            if ( fontsize < 1 || fontsize > 100 )
        !           540:            {
        !           541:                int_error("font size out of bounds [1..100]", c_token);
        !           542:                fontsize_set = FALSE;
        !           543:            }
        !           544:            else
        !           545:            {
        !           546:                fontsize_set = TRUE;
        !           547:                term->v_char = (unsigned int)(fontsize/EEPIC_UNIT);
        !           548:                term->h_char = (unsigned int)((fontsize/EEPIC_UNIT)/2);
        !           549:            }
        !           550:            c_token++;
        !           551:        }
        !           552:     }
        !           553:
        !           554:     sprintf(term_options, "default%s%s%s%s",
        !           555:            eepic_color_on ? " color" : "",
        !           556:            eepic_lineset == 1 ? " dashed" : "",
        !           557:            eepic_true_rotate ? " rotate" : "",
        !           558:            eepic_pointsize == 1 ?
        !           559:            " small" :
        !           560:            eepic_pointsize == 2 ?
        !           561:            " tiny" : "" );
        !           562:     if ( fontsize_set )
        !           563:        sprintf( term_options+strlen(term_options), " %d", (int) fontsize );
        !           564: }
        !           565:
1.1       maekawa   566: #endif
                    567:
                    568: #ifdef TERM_TABLE
                    569:
                    570: TERM_TABLE_START(eepic_driver)
                    571:     "eepic", "EEPIC -- extended LaTeX picture environment",
                    572:     EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR,
1.1.1.3 ! ohara     573:     EEPIC_VTIC, EEPIC_HTIC, EEPIC_options, EEPIC_init, EEPIC_reset,
1.1       maekawa   574:     EEPIC_text, null_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector,
                    575:     EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle,
                    576:     EEPIC_justify_text, EEPIC_point, EEPIC_arrow, set_font_null
                    577: TERM_TABLE_END(eepic_driver)
                    578:
                    579: #undef LAST_TERM
                    580: #define LAST_TERM eepic_driver
                    581:
                    582: #endif
                    583: #endif
                    584:
                    585: #ifdef TERM_HELP
                    586: START_HELP(eepic)
                    587: "1 eepic",
                    588: "?commands set terminal eepic",
                    589: "?set terminal eepic",
                    590: "?set term eepic",
                    591: "?terminal eepic",
                    592: "?term eepic",
                    593: "?eepic",
                    594: " The `eepic` terminal driver supports the extended LaTeX picture environment.",
                    595: " It is an alternative to the `latex` driver.",
                    596: "",
                    597: " The output of this terminal is intended for use with the \"eepic.sty\" macro",
                    598: " package for LaTeX.  To use it, you need \"eepic.sty\", \"epic.sty\" and a",
                    599: " printer driver that supports the \"tpic\" \\specials.  If your printer driver",
                    600: " doesn't support those \\specials, \"eepicemu.sty\" will enable you to use some",
                    601: " of them.",
1.1.1.3 ! ohara     602: " dvips and dvipdfm do support the \"tpic\" \\specials.",
        !           603: "",
        !           604: " Syntax:",
        !           605: "    set terminal eepic {color, dashed, rotate, small, tiny, default, <fontsize>}",
1.1       maekawa   606: "",
1.1.1.3 ! ohara     607: " Options:",
        !           608: " You can give options in any order you wish.",
        !           609: " 'color' causes gnuplot to produce \\color{...} commands so that the graphs are",
        !           610: " colored. Using this option, you must include \\usepackage{color} in the preambel",
        !           611: " of your latex document.",
        !           612: " 'dashed' will allow dashed line types; without this option, only solid lines",
        !           613: " with varying thickness will be used.",
        !           614: " 'dashed' and 'color' are mutually exclusive; if 'color' is specified, then 'dashed'",
        !           615: " will be ignored",
        !           616: " 'rotate' will enable true rotated text (by 90 degrees). Otherwise, rotated text",
        !           617: " will be typeset with letters stacked above each other. If you use this option",
        !           618: " you must include \\usepackage{graphicx} in the preamble.",
        !           619: " 'small' will use \\scriptsize symbols as point markers (Probably does not work",
        !           620: " with TeX, only LaTeX2e). Default is to use the default math size.",
        !           621: " 'tiny' uses \\scriptscriptstyle symbols.",
        !           622: " 'default' resets all options to their defaults = no color, no dashed lines,",
        !           623: " pseudo-rotated (stacked) text, large point symbols.",
        !           624: " <fontsize> is a number which specifies the font size inside the picture",
        !           625: " environment; the unit is pt (points), i.e., 10 pt equals approx. 3.5 mm.",
        !           626: " If fontsize is not specified, then all text inside the picture will be set",
        !           627: " in \\footnotesize.",
1.1       maekawa   628: "",
1.1.1.3 ! ohara     629: " Notes:",
        !           630: " Remember to escape the # character (or other chars meaningful to (La-)TeX)",
        !           631: " by \\\\ (2 backslashes).",
        !           632: " It seems that dashed lines become solid lines when the vertices of a plot",
        !           633: " are too close. (I do not know if that is a general problem with the tpic specials,",
        !           634: " or if it is caused by a bug in eepic.sty or dvips/dvipdfm.)",
        !           635: " The default size of an eepic plot is 5x3 inches, which can be scaled ",
        !           636: " by 'set size a,b'",
        !           637: " Points, among other things, are drawn using the LaTeX commands \"\\Diamond\",",
        !           638: " \"\\Box\", etc.  These commands no longer belong to the LaTeX2e core; they are",
        !           639: " included in the latexsym package, which is part of the base distribution and",
        !           640: " thus part of any LaTeX implementation. Please do not forget to use this package.",
        !           641: " Instead of latexsym, you can also include the amssymb package."
1.1       maekawa   642: " All drivers for LaTeX offer a special way of controlling text positioning:",
                    643: " If any text string begins with '{', you also need to include a '}' at the",
1.1.1.3 ! ohara     644: " end of the text, and the whole text will be centered both horizontally and",
        !           645: " vertically.  If the text string begins with '[', you need to follow this with",
        !           646: " a position specification (up to two out of t,b,l,r), ']{', the text itself,",
        !           647: " and finally '}'.  The text itself may be anything LaTeX can typeset as an",
        !           648: " LR-box.  '\\rule{}{}'s may help for best positioning.",
1.1       maekawa   649: "",
                    650: " Examples:",
1.1.1.3 ! ohara     651: " set term eepic",
        !           652: "   output graphs as eepic macros inside a picture environment;",
        !           653: "   \\input the resulting file in your LaTeX document.",
        !           654: " set term eepic color tiny rotate 8",
        !           655: "   eepic macros with \\color macros, \\scripscriptsize point markers,",
        !           656: "   true rotated text, and all text set with 8pt.",
        !           657: "",
1.1       maekawa   658: " About label positioning:",
                    659: " Use gnuplot defaults (mostly sensible, but sometimes not really best):",
                    660: "        set title '\\LaTeX\\ -- $ \\gamma $'",
                    661: " Force centering both horizontally and vertically:",
                    662: "        set label '{\\LaTeX\\ -- $ \\gamma $}' at 0,0",
                    663: " Specify own positioning (top here):",
                    664: "        set xlabel '[t]{\\LaTeX\\ -- $ \\gamma $}'",
                    665: " The other label -- account for long ticlabels:",
1.1.1.3 ! ohara     666: "        set ylabel '[r]{\\LaTeX\\ -- $ \\gamma $\\rule{7mm}{0pt}}'"
1.1       maekawa   667: END_HELP(eepic)
                    668: #endif /* TERM_HELP */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>