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

Annotation of OpenXM_contrib/gnuplot/term/pslatex.trm, Revision 1.1.1.2

1.1       maekawa     1: /*
1.1.1.2 ! maekawa     2:  * $Id: pslatex.trm,v 1.15.2.2 1999/10/01 18:22:37 lhecking Exp $
1.1       maekawa     3:  */
                      4:
                      5: /* GNUPLOT - pslatex.trm */
                      6:
                      7: /*[
                      8:  * Copyright 1990 - 1993, 1998
                      9:  *
                     10:  * Permission to use, copy, and distribute this software and its
                     11:  * documentation for any purpose with or without fee is hereby granted,
                     12:  * provided that the above copyright notice appear in all copies and
                     13:  * that both that copyright notice and this permission notice appear
                     14:  * in supporting documentation.
                     15:  *
                     16:  * Permission to modify the software is granted, but not the right to
                     17:  * distribute the complete modified source code.  Modifications are to
                     18:  * be distributed as patches to the released version.  Permission to
                     19:  * distribute binaries produced by compiling modified sources is granted,
                     20:  * provided you
                     21:  *   1. distribute the corresponding source modifications from the
                     22:  *    released version in the form of a patch file along with the binaries,
                     23:  *   2. add special version identification to distinguish your version
                     24:  *    in addition to the base release version number,
                     25:  *   3. provide your name and address as the primary contact for the
                     26:  *    support of your modified version, and
                     27:  *   4. retain our contact information in regard to use of the base
                     28:  *    software.
                     29:  * Permission to distribute the released version of the source code along
                     30:  * with corresponding source modifications in the form of a patch file is
                     31:  * granted with same provisions 2 through 4 for binary distributions.
                     32:  *
                     33:  * This software is provided "as is" without express or implied warranty
                     34:  * to the extent permitted by applicable law.
                     35: ]*/
                     36:
                     37: /*
                     38:  * This file is included by ../term.c.
                     39:  *
                     40:  * This file supplies the terminal drivers:
                     41:  *     pslatex --latex with embedded postscript
                     42:  *     pstex   --plain TeX with embedded postscript
                     43:  *
                     44:  * AUTHORS
                     45:  *  George Phillips
                     46:  *  Russell Lang
                     47:  *  David Kotz
                     48:  *
                     49:  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
                     50:  */
                     51:
                     52: #include "driver.h"
                     53:
                     54: #ifdef TERM_REGISTER
                     55: register_term(pslatex)
                     56: register_term(pstex)
                     57: #endif
                     58:
                     59: #ifdef TERM_PROTO
                     60: TERM_PUBLIC void PSLATEX_options __PROTO((void));
                     61: TERM_PUBLIC void PSLATEX_init __PROTO((void));
                     62: TERM_PUBLIC void PSLATEX_graphics __PROTO((void));
                     63: TERM_PUBLIC void PSLATEX_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
                     64: TERM_PUBLIC int PSLATEX_justify_text __PROTO((enum JUSTIFY mode));
                     65: TERM_PUBLIC int PSLATEX_text_angle __PROTO((int ang));
                     66: TERM_PUBLIC void PSLATEX_reset __PROTO((void));
                     67: TERM_PUBLIC void PSLATEX_text __PROTO((void));
                     68: TERM_PUBLIC void PSLATEX_move __PROTO((unsigned int x, unsigned int y));
                     69: TERM_PUBLIC void PSLATEX_vector __PROTO((unsigned int x, unsigned int y));
                     70: TERM_PUBLIC void PSLATEX_linetype __PROTO((int lt));
                     71: TERM_PUBLIC void PSLATEX_point __PROTO((unsigned int x, unsigned int y, int number));
                     72: TERM_PUBLIC void PSLATEX_pointsize __PROTO((double size));
                     73: TERM_PUBLIC void PSLATEX_linewidth __PROTO((double width));
                     74:
                     75: #define PSLATEX_XMAX (5*720)
                     76: #define PSLATEX_YMAX (3*720)
                     77:
                     78: /* 10 pt char is about 10 pts high (say) */
                     79: #define PSLATEX_VCHAR (100)
                     80: /* 10 pt char is about 6 pts wide (say) */
                     81: /* I find about 5 points (output from test) - div */
                     82: #define PSLATEX_HCHAR (50)
                     83: #define GOT_PSLATEX_PROTO
                     84: #endif
                     85:
                     86: #ifndef TERM_PROTO_ONLY
                     87:
                     88: #ifdef TERM_BODY
                     89: static int PSLATEX_angle;
                     90: static int PSLATEX_justify;
                     91: static int PSLATEX_rotate = TRUE;
                     92: static char *PSLATEX_psfile = NULL;
                     93: static TBOOLEAN PSLATEX_useAuxFile = FALSE;    /* do we write two files? */
1.1.1.2 ! maekawa    94: static FILE *PSLATEX_auxFile = NULL;
1.1       maekawa    95: static TBOOLEAN PSLATEX_output = TRUE; /* do we write LaTeX? */
                     96:
                     97: struct text_command {
                     98:     int x, y, angle, justify;
                     99:     char *label;
                    100:     struct text_command *next;
                    101: };
                    102:
                    103: static struct text_command *PSLATEX_labels;
                    104:
                    105: TERM_PUBLIC void PSLATEX_options()
                    106: {
                    107:     if (!END_OF_COMMAND) {
                    108:        if (almost_equals(c_token, "d$efault")) {
                    109:            ps_color = FALSE;
                    110:            ps_solid = FALSE;
                    111:            PSLATEX_rotate = TRUE;
                    112:            PSLATEX_useAuxFile = FALSE;
                    113:            c_token++;
                    114:        }
                    115:     }
                    116:     if (!END_OF_COMMAND) {
                    117:        if (almost_equals(c_token, "c$olor")
                    118:            || almost_equals(c_token, "c$olour")) {
                    119:            ps_color = TRUE;
                    120:            c_token++;
                    121:        }
                    122:     }
                    123:     if (!END_OF_COMMAND) {
                    124:        if (almost_equals(c_token, "m$onochrome")) {
                    125:            ps_color = FALSE;
                    126:            c_token++;
                    127:        }
                    128:     }
                    129:     if (!END_OF_COMMAND) {
                    130:        if (almost_equals(c_token, "so$lid")) {
                    131:            ps_solid = TRUE;
                    132:            c_token++;
                    133:        } else if (almost_equals(c_token, "da$shed")) {
                    134:            ps_solid = FALSE;
                    135:            c_token++;
                    136:        }
                    137:     }
                    138:     if (!END_OF_COMMAND) {
                    139:        if (almost_equals(c_token, "r$otate")) {
                    140:            PSLATEX_rotate = TRUE;
                    141:            c_token++;
                    142:        }
                    143:     }
                    144:     if (!END_OF_COMMAND) {
                    145:        if (almost_equals(c_token, "n$orotate")) {
                    146:            PSLATEX_rotate = FALSE;
                    147:            c_token++;
                    148:        }
                    149:     }
                    150:     if (!END_OF_COMMAND) {
                    151:        if (almost_equals(c_token, "a$uxfile")) {
                    152:            PSLATEX_useAuxFile = TRUE;
                    153:            c_token++;
                    154:        }
                    155:     }
                    156:     if (!END_OF_COMMAND) {
                    157:        /* We have font size specified */
                    158:        struct value a;
                    159:        int ps_fontsize = (int) real(const_express(&a));
                    160:        term->v_char = (unsigned int) (ps_fontsize * PS_SC);
                    161:        term->h_char = (unsigned int) (ps_fontsize * PS_SC / 2);
                    162:     }
                    163:     /* be sure to generate an options string that PSLATEX_init understands */
                    164:
                    165:     sprintf(term_options, "%s %s %s%s",
                    166:            ps_color ? "color" : "monochrome",
                    167:            ps_solid ? "solid" : "dashed",
                    168:            PSLATEX_rotate ? "rotate" : "norotate",
                    169:            PSLATEX_useAuxFile ? " auxfile" : "");
                    170: }
                    171:
                    172: TERM_PUBLIC void PSLATEX_init()
                    173: {
                    174:     char *dotIndex;
                    175:
                    176:     if (strcmp(term->name, "pstex") == 0)
                    177:        PSLATEX_output = FALSE;
                    178:
1.1.1.2 ! maekawa   179:     /* until we know otherwise */
        !           180:     PSLATEX_auxFile = NULL;
        !           181:
1.1       maekawa   182:     /* dont tweak PSLATEX_useAuxFile if we decide we cannot comply
                    183:      * since this affects subsequent plots even after a set out
                    184:      * Instead, we will use PSLATEX_auxFile != NULL to indicate
                    185:      * use of an aux file
                    186:      */
                    187:
1.1.1.2 ! maekawa   188:     /* if there's no extension, append ".ps" */
        !           189:     if ((dotIndex = strrchr(outstr, '.')) == NULL)
        !           190:        dotIndex = strchr(outstr, NUL);
        !           191:
1.1       maekawa   192:     /* try to open the auxiliary file for the postscript parts. */
1.1.1.2 ! maekawa   193:     if (outstr && PSLATEX_useAuxFile == TRUE) {
1.1       maekawa   194:
1.1.1.2 ! maekawa   195:        /* length of outstr plus ('.' or '\0') plus "ps" plus '\0' */
        !           196:        PSLATEX_psfile = gp_realloc (PSLATEX_psfile,(dotIndex - outstr) + 4,"pslatex aux filename");
1.1       maekawa   197:        if (PSLATEX_psfile) {
1.1.1.2 ! maekawa   198:            /* include period or '\0' */
        !           199:            strncpy(PSLATEX_psfile, outstr, (dotIndex - outstr) + 1);
        !           200:            /* period or '\0' is overwritten with period, and "ps" appended */
        !           201:            strcpy(PSLATEX_psfile + (dotIndex - outstr), ".ps");
        !           202:            PSLATEX_auxFile = fopen(PSLATEX_psfile, "w");
        !           203:            if (PSLATEX_auxFile  == (FILE *) NULL) {
1.1       maekawa   204:                fprintf(stderr, "Cannot open aux file %s for output\n",
                    205:                        PSLATEX_psfile);
1.1.1.2 ! maekawa   206:                /* And what? Error handling????? */
1.1       maekawa   207:            }
                    208:        } else {
                    209:            fprintf(stderr, "\
                    210: Cannot make PostScript file name from %s\n\
                    211: Turning off auxfile option\n", outstr);
                    212:            PSLATEX_auxFile = NULL;
1.1.1.2 ! maekawa   213:            /* NEW! */ PSLATEX_useAuxFile = FALSE;
1.1       maekawa   214:        }
                    215:     }
                    216:     if (PSLATEX_output) {
                    217:        fputs("\
                    218: % GNUPLOT: LaTeX picture with Postscript\n\
                    219: \\begingroup%\n\
                    220:   \\makeatletter%\n\
                    221:   \\newcommand{\\GNUPLOTspecial}{%\n\
                    222:     \\@sanitize\\catcode`\\%=14\\relax\\special}%\n\
                    223:   \\setlength{\\unitlength}{0.1bp}%\n", gpoutfile);
                    224:     } else {
                    225:
                    226:        /* write plain TeX header */
                    227:
                    228:        fputs("\
                    229: % GNUPLOT: plain TeX with Postscript\n\
                    230: \\begingroup\n\
                    231:   \\catcode`\\@=11\\relax\n\
                    232:   \\def\\GNUPLOTspecial{%\n\
                    233:     \\def\\do##1{\\catcode`##1=12\\relax}\\dospecials\n\
                    234:     \\catcode`\\{=1\\catcode`\\}=2\\catcode\\%=14\\relax\\special}%\n\
                    235: %\n\
                    236: \\expandafter\\ifx\\csname GNUPLOTpicture\\endcsname\\relax\n\
                    237:   \\csname newdimen\\endcsname\\GNUPLOTunit\n\
                    238:   \\gdef\\GNUPLOTpicture(#1,#2){\\vbox to#2\\GNUPLOTunit\\bgroup\n\
                    239:     \\def\\put(##1,##2)##3{\\unskip\\raise##2\\GNUPLOTunit\n\
                    240:       \\hbox to0pt{\\kern##1\\GNUPLOTunit ##3\\hss}\\ignorespaces}%\n\
                    241:     \\def\\ljust##1{\\vbox to0pt{\\vss\\hbox to0pt{##1\\hss}\\vss}}%\n\
                    242:     \\def\\cjust##1{\\vbox to0pt{\\vss\\hbox to0pt{\\hss ##1\\hss}\\vss}}%\n\
                    243:     \\def\\rjust##1{\\vbox to0pt{\\vss\\hbox to0pt{\\hss ##1}\\vss}}%\n\
                    244:     \\def\\stack##1{\\let\\\\=\\cr\\tabskip=0pt\\halign{\\hfil ####\\hfil\\cr ##1\\crcr}}%\n\
                    245:     \\def\\lstack##1{\\hbox to0pt{\\vbox to0pt{\\vss\\stack{##1}}\\hss}}%\n\
                    246:     \\def\\cstack##1{\\hbox to0pt{\\hss\\vbox to0pt{\\vss\\stack{##1}}\\hss}}%\n\
                    247:     \\def\\rstack##1{\\hbox to0pt{\\vbox to0pt{\\stack{##1}\\vss}\\hss}}%\n\
                    248:     \\vss\\hbox to#1\\GNUPLOTunit\\bgroup\\ignorespaces}%\n\
                    249:   \\gdef\\endGNUPLOTpicture{\\hss\\egroup\\egroup}%\n\
                    250: \\fi\n\
                    251: \\GNUPLOTunit=0.1bp\n", gpoutfile);
                    252:     }
                    253:
                    254:     {
                    255:        unsigned int xmin_t = xoffset * PSLATEX_XMAX / PS_SC;
                    256:        unsigned int xmax_t = (xoffset + xsize) * PSLATEX_XMAX / PS_SC;
                    257:        unsigned int ymin_t = yoffset * PSLATEX_YMAX / PS_SC;
                    258:        unsigned int ymax_t = (yoffset + ysize) * PSLATEX_YMAX / PS_SC;
                    259:
                    260:        if (PSLATEX_auxFile) {
                    261:            FILE *tmp = gpoutfile;
                    262:            gpoutfile = PSLATEX_auxFile;
                    263:            PS_common_init(1, 1, 0, 0, 0, xmin_t, ymin_t, xmax_t, ymax_t, NULL);
                    264:            gpoutfile = tmp;
                    265:        } else {
                    266:            fputs("{\\GNUPLOTspecial{!\n", gpoutfile);
                    267:            PS_common_init(1, 1, 0, 0, 0, xmin_t, ymin_t, xmax_t, ymax_t, NULL);
                    268:            fputs("}}%\n", gpoutfile);
                    269:        }
                    270:     }
                    271:
                    272:     PSLATEX_angle = 0;
                    273:     PSLATEX_justify = 0;
                    274:     PSLATEX_labels = 0;
                    275: }
                    276:
                    277: TERM_PUBLIC void PSLATEX_graphics()
                    278: {
                    279:     struct termentry *t = term;
                    280:
                    281:     if (PSLATEX_output)
1.1.1.2 ! maekawa   282:        fprintf(gpoutfile, "\\begin{picture}(%d,%d)(0,0)%%\n",
        !           283:                (int) (xsize * t->xmax), (int) (ysize * t->ymax));
1.1       maekawa   284:     else
1.1.1.2 ! maekawa   285:        fprintf(gpoutfile, "\\GNUPLOTpicture(%d,%d)\n",
        !           286:                (int) (xsize * t->xmax), (int) (ysize * t->ymax));
1.1       maekawa   287:
                    288:     if (PSLATEX_auxFile) {
                    289:        FILE *tmp;
1.1.1.2 ! maekawa   290:        /* these are taken from the post.trm file computation
        !           291:         * of the bounding box, but without the X_OFF and Y_OFF */
        !           292:        int urx = (int) (xsize * (PS_XMAX) / PS_SC + 0.5);
        !           293:        int ury = (int) (ysize * (PS_YMAX) / PS_SC + 0.5);
        !           294:        /* moved this code here from beginning of the function
        !           295:         * PSLATEX_psfile is only != NULL with the `auxfile' option */
        !           296:        char *psfile_basename = strrchr(PSLATEX_psfile, DIRSEP1);
        !           297:
        !           298:        if (psfile_basename)
        !           299:            psfile_basename++;
        !           300:        else {
        !           301:            if (DIRSEP2 != NUL) {
        !           302:                psfile_basename = strrchr(PSLATEX_psfile, DIRSEP2);
        !           303:                if (psfile_basename)
        !           304:                    psfile_basename++;
        !           305:                else
        !           306:                    psfile_basename = PSLATEX_psfile;
        !           307:            } else
        !           308:                psfile_basename = PSLATEX_psfile;
        !           309:        }
1.1       maekawa   310:
                    311:        /* generate special which xdvi and dvips can handle */
                    312:        fprintf(gpoutfile,
                    313:                "\\special{psfile=%s llx=0 lly=0 urx=%d ury=%d rwi=%d}\n",
1.1.1.2 ! maekawa   314:                psfile_basename, urx, ury, 10 * urx);
1.1       maekawa   315:        tmp = gpoutfile;
                    316:        gpoutfile = PSLATEX_auxFile;
                    317:        PS_graphics();
                    318:        gpoutfile = tmp;
                    319:     } else {
                    320:        fputs("{\\GNUPLOTspecial{\"\n", gpoutfile);
                    321:        PS_graphics();
                    322:     }
                    323:
                    324:     PSLATEX_labels = (struct text_command *) NULL;
                    325: }
                    326:
                    327: TERM_PUBLIC void PSLATEX_put_text(x, y, str)
                    328: unsigned int x, y;
                    329: char str[];
                    330: {
                    331:     struct text_command *tc;
                    332:
                    333:     /* ignore empty strings */
                    334:     if (str[0] == NUL)
                    335:        return;
                    336:
                    337:     tc = (struct text_command *) gp_alloc(sizeof(struct text_command), term->name);
                    338:     tc->x = x;
                    339:     tc->y = y;
                    340:     tc->label = (char *) gp_alloc(strlen(str) + 1, term->name);
                    341:     strcpy(tc->label, str);
                    342:     tc->justify = PSLATEX_justify;
                    343:     tc->angle = PSLATEX_angle;
                    344:
                    345:     tc->next = PSLATEX_labels;
                    346:     PSLATEX_labels = tc;
                    347: }
                    348:
                    349: TERM_PUBLIC int PSLATEX_justify_text(mode)
                    350: enum JUSTIFY mode;
                    351: {
                    352:     PSLATEX_justify = mode;
                    353:     return TRUE;
                    354: }
                    355:
                    356: TERM_PUBLIC int PSLATEX_text_angle(ang)
                    357: int ang;
                    358: {
                    359:     /* rotated text is put in a short stack, and optionally uses
                    360:      * postscript specials depending on PSLATEX_rotate */
                    361:     PSLATEX_angle = ang;
                    362:     return TRUE;
                    363: }
                    364:
                    365:
                    366: TERM_PUBLIC void PSLATEX_reset()
                    367: {
                    368:     if (PSLATEX_auxFile) {
                    369:        fclose(PSLATEX_auxFile);
                    370:        PSLATEX_auxFile = NULL;
                    371:     }
                    372:     if (PSLATEX_psfile) {
                    373:        free(PSLATEX_psfile);
                    374:        PSLATEX_psfile = NULL;
                    375:     }
                    376: }
                    377:
                    378: TERM_PUBLIC void PSLATEX_text()
                    379: {
                    380:     struct text_command *tc;
                    381:
                    382:     if (PSLATEX_auxFile) {
                    383:        FILE *tmp = gpoutfile;
                    384:        gpoutfile = PSLATEX_auxFile;
                    385:        PS_text();
                    386:        gpoutfile = tmp;
                    387:     } else {
                    388:        PS_text();
                    389:        fputs("}}%\n", gpoutfile);
                    390:     }
                    391:
                    392:     for (tc = PSLATEX_labels; tc != (struct text_command *) NULL; tc = tc->next) {
                    393:        fprintf(gpoutfile, "\\put(%d,%d){", tc->x, tc->y);
                    394:        if (PSLATEX_output &&
                    395:            ((tc->label[0] == '{') || (tc->label[0] == '['))) {
                    396:            fprintf(gpoutfile, "\\makebox(0,0)%s", tc->label);
                    397:        } else
                    398:            switch (tc->angle) {
                    399:            case 0:
                    400:                switch (tc->justify) {
                    401:                case LEFT:
                    402:                    fprintf(gpoutfile, (PSLATEX_output
                    403:                                        ? "\\makebox(0,0)[l]{%s}"
                    404:                                        : "\\ljust{%s}"), tc->label);
                    405:                    break;
                    406:                case CENTRE:
                    407:                    fprintf(gpoutfile, (PSLATEX_output
                    408:                                        ? "\\makebox(0,0){%s}"
                    409:                                        : "\\cjust{%s}"), tc->label);
                    410:                    break;
                    411:                case RIGHT:
                    412:                    fprintf(gpoutfile, (PSLATEX_output
                    413:                                        ? "\\makebox(0,0)[r]{%s}"
                    414:                                        : "\\rjust{%s}"), tc->label);
                    415:                    break;
                    416:                }
                    417:                break;
                    418:            case 1:             /* put text in a short stack */
                    419:                if (PSLATEX_rotate) {
                    420:                    fputs("\
                    421: %\n\\special{ps: gsave currentpoint currentpoint translate\n\
                    422: 270 rotate neg exch neg exch translate}%\n", gpoutfile);
                    423:                }
                    424:                switch (tc->justify) {
                    425:                case LEFT:
                    426:                    fprintf(gpoutfile, (PSLATEX_output
                    427:                                        ? "\\makebox(0,0)[lb]{\\shortstack{%s}}"
                    428:                                        : "\\lstack{%s}"),
                    429:                            tc->label);
                    430:                    break;
                    431:                case CENTRE:
                    432:                    fprintf(gpoutfile, (PSLATEX_output
                    433:                                        ? "\\makebox(0,0)[b]{\\shortstack{%s}}"
                    434:                                        : "\\cstack{%s}"),
                    435:                            tc->label);
                    436:                    break;
                    437:                case RIGHT:
                    438:                    fprintf(gpoutfile, (PSLATEX_output
                    439:                                        ? "\\makebox(0,0)[lt]{\\shortstack{%s}}"
                    440:                                        : "\\rstack{%s}"),
                    441:                            tc->label);
                    442:                    break;
                    443:                }
                    444:                if (PSLATEX_rotate) {
                    445:                    fputs("%\n\\special{ps: currentpoint grestore moveto}%\n", gpoutfile);
                    446:                }
                    447:            }
                    448:        fputs("}%\n", gpoutfile);
                    449:     }
                    450:
                    451:     while (PSLATEX_labels) {
                    452:        tc = PSLATEX_labels->next;
                    453:        free(PSLATEX_labels->label);
                    454:        free(PSLATEX_labels);
                    455:        PSLATEX_labels = tc;
                    456:     }
                    457:
                    458:     if (PSLATEX_output) {
                    459:        fputs("\
                    460: \\end{picture}%\n\
                    461: \\endgroup\n\
                    462: \\endinput\n", gpoutfile);
                    463:     } else {
                    464:        fputs("\
                    465: \\endGNUPLOTpicture\n\
                    466: \\endgroup\n\
                    467: \\endinput\n", gpoutfile);
                    468:     }
                    469: }
                    470:
                    471: TERM_PUBLIC void PSLATEX_move(x, y)
                    472: unsigned int x, y;
                    473: {
                    474:     if (PSLATEX_auxFile) {
                    475:        FILE *tmp = gpoutfile;
                    476:        gpoutfile = PSLATEX_auxFile;
                    477:        PS_move(x, y);
                    478:        gpoutfile = tmp;
                    479:     } else {
                    480:        PS_move(x, y);
                    481:     }
                    482: }
                    483:
                    484:
                    485: TERM_PUBLIC void PSLATEX_vector(x, y)
                    486: unsigned int x, y;
                    487: {
                    488:
                    489:     if (PSLATEX_auxFile) {
                    490:        FILE *tmp = gpoutfile;
                    491:        gpoutfile = PSLATEX_auxFile;
                    492:        PS_vector(x, y);
                    493:        gpoutfile = tmp;
                    494:     } else {
                    495:        PS_vector(x, y);
                    496:     }
                    497: }
                    498:
                    499:
                    500: TERM_PUBLIC void PSLATEX_linetype(lt)
                    501: int lt;
                    502: {
                    503:     if (PSLATEX_auxFile) {
                    504:        FILE *tmp = gpoutfile;
                    505:        gpoutfile = PSLATEX_auxFile;
                    506:        PS_linetype(lt);
                    507:        gpoutfile = tmp;
                    508:     } else {
                    509:        PS_linetype(lt);
                    510:     }
                    511: }
                    512:
                    513: TERM_PUBLIC void PSLATEX_point(x, y, number)
                    514: unsigned int x, y;
                    515: int number;
                    516: {
                    517:     if (PSLATEX_auxFile) {
                    518:        FILE *tmp = gpoutfile;
                    519:        gpoutfile = PSLATEX_auxFile;
                    520:        PS_point(x, y, number);
                    521:        gpoutfile = tmp;
                    522:     } else
                    523:        PS_point(x, y, number);
                    524: }
                    525:
                    526:
                    527: TERM_PUBLIC void PSLATEX_pointsize(ps)
                    528: double ps;
                    529: {
                    530:     if (PSLATEX_auxFile) {
                    531:        FILE *tmp = gpoutfile;
                    532:        gpoutfile = PSLATEX_auxFile;
                    533:        PS_pointsize(ps);
                    534:        gpoutfile = tmp;
                    535:     } else
                    536:        PS_pointsize(ps);
                    537: }
                    538:
                    539:
                    540: TERM_PUBLIC void PSLATEX_linewidth(ps)
                    541: double ps;
                    542: {
                    543:     if (PSLATEX_auxFile) {
                    544:        FILE *tmp = gpoutfile;
                    545:        gpoutfile = PSLATEX_auxFile;
                    546:        PS_linewidth(ps);
                    547:        gpoutfile = tmp;
                    548:     } else
                    549:        PS_linewidth(ps);
                    550: }
                    551:
                    552: #endif /* TERM_BODY */
                    553:
                    554: #ifdef TERM_TABLE
                    555:
                    556: #ifndef GOT_POST_PROTO
                    557: #define TERM_PROTO_ONLY
                    558: #include "post.trm"
                    559: #undef TERM_PROTO_ONLY
                    560: #endif
                    561:
                    562: TERM_TABLE_START(pslatex_driver)
                    563:     "pslatex", "LaTeX picture environment with PostScript \\specials",
                    564:     PSLATEX_XMAX, PSLATEX_YMAX, PSLATEX_VCHAR, PSLATEX_HCHAR,
                    565:     PS_VTIC, PS_HTIC, PSLATEX_options, PSLATEX_init, PSLATEX_reset,
                    566:     PSLATEX_text, null_scale, PSLATEX_graphics, PSLATEX_move,
                    567:     PSLATEX_vector, PSLATEX_linetype, PSLATEX_put_text, PSLATEX_text_angle,
                    568:     PSLATEX_justify_text, PSLATEX_point, do_arrow, set_font_null,
                    569:     PSLATEX_pointsize, 0 /*flags */ , 0 /*suspend */
                    570:     , 0 /*resume */ , 0 /*fillbox */ ,
                    571:     PSLATEX_linewidth
                    572: TERM_TABLE_END(pslatex_driver)
                    573: #undef LAST_TERM
                    574: #define LAST_TERM pslatex_driver
                    575:
                    576: TERM_TABLE_START(pstex_driver)
                    577:     "pstex", "plain TeX with PostScript \\specials",
                    578:     PSLATEX_XMAX, PSLATEX_YMAX, PSLATEX_VCHAR, PSLATEX_HCHAR,
                    579:     PS_VTIC, PS_HTIC, PSLATEX_options, PSLATEX_init, PSLATEX_reset,
                    580:     PSLATEX_text, null_scale, PSLATEX_graphics, PSLATEX_move,
                    581:     PSLATEX_vector, PSLATEX_linetype, PSLATEX_put_text, PSLATEX_text_angle,
                    582:     PSLATEX_justify_text, PSLATEX_point, do_arrow, set_font_null,
                    583:     PSLATEX_pointsize, 0 /*flags */ , 0 /*suspend */
                    584:     , 0 /*resume */ , 0 /*fillbox */ ,
                    585:     PSLATEX_linewidth
                    586: TERM_TABLE_END(pstex_driver)
                    587: #undef LAST_TERM
                    588: #define LAST_TERM pstex_driver
                    589:
                    590: #endif /* TERM_TABLE */
                    591: #endif /* TERM_PROTO_ONLY */
                    592:
                    593:
                    594: #ifdef TERM_HELP
                    595: START_HELP(pslatex)
                    596: "1 pslatex and pstex",
                    597: "?commands set terminal pslatex",
                    598: "?set terminal pslatex",
                    599: "?set term pslatex",
                    600: "?terminal pslatex",
                    601: "?term pslatex",
                    602: "?pslatex",
                    603: "?commands set terminal pstex",
                    604: "?set terminal pstex",
                    605: "?set term pstex",
                    606: "?terminal pstex",
                    607: "?term pstex",
                    608: "?pstex",
                    609: " The `pslatex` and `pstex` drivers generate output for further processing by",
                    610: " LaTeX and TeX, respectively.  Figures generated by `pstex` can be included",
                    611: " in any plain-based format (including LaTeX).",
                    612: "",
                    613: " Syntax:",
                    614: "       set terminal pslatex | |pstex {<color>} {<dashed>} {<rotate>}",
                    615: "                                     {auxfile} {<font_size>}",
                    616: "",
                    617: " <color> is either `color` or `monochrome`.  <rotate> is either `rotate` or",
                    618: " `norotate` and determines if the y-axis label is rotated.  <font_size> is",
                    619: " used to scale the font from its usual size.",
                    620: "",
                    621: " If `auxfile` is specified, it directs the driver to put the PostScript",
                    622: " commands into an auxiliary file instead of directly into the LaTeX file.",
                    623: " This is useful if your pictures are large enough that dvips cannot handle",
                    624: " them.  The name of the auxiliary PostScript file is derived from the name of",
                    625: " the TeX file given on the `set output` command; it is determined by replacing",
1.1.1.2 ! maekawa   626: " the trailing `.tex` (actually just the final extent in the file name) with",
        !           627: " `.ps` in the output file name, or, if the TeX file has no extension, `.ps`",
        !           628: " is appended.  Remember to close the file before leaving `gnuplot`.",
1.1       maekawa   629: "",
                    630: " All drivers for LaTeX offer a special way of controlling text positioning:",
                    631: " If any text string begins with '{', you also need to include a '}' at the",
                    632: " end of the text, and the whole text will be centered both horizontally",
                    633: " and vertically by LaTeX. --- If the text string begins with '[', you need",
                    634: " to continue it with: a position specification (up to two out of t,b,l,r),",
                    635: " ']{', the text itself, and finally, '}'. The text itself may be anything",
                    636: " LaTeX can typeset as an LR-box. \\rule{}{}'s may help for best positioning.",
                    637: "",
                    638: " Examples:",
                    639: "       set term pslatex monochrome dashed rotate       # set to defaults",
                    640: " To write the PostScript commands into the file \"foo.ps\":",
                    641: "       set term pslatex auxfile",
                    642: "       set output \"foo.tex\"; plot ...: set output",
                    643: " About label positioning:",
                    644: " Use gnuplot defaults (mostly sensible, but sometimes not really best):",
                    645: "        set title '\\LaTeX\\ -- $ \\gamma $'",
                    646: " Force centering both horizontally and vertically:",
                    647: "        set label '{\\LaTeX\\ -- $ \\gamma $}' at 0,0",
                    648: " Specify own positioning (top here):",
                    649: "        set xlabel '[t]{\\LaTeX\\ -- $ \\gamma $}'",
                    650: " The other label -- account for long ticlabels:",
                    651: "        set ylabel '[r]{\\LaTeX\\ -- $ \\gamma $\\rule{7mm}{0pt}'",
                    652: "",
                    653: " Linewidths and pointsizes may be changed with `set linestyle`."
                    654: END_HELP(pslatex)
                    655: #endif /* TERM_HELP */

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