[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.3

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

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