version 1.1.1.1, 2000/01/09 17:01:15 |
version 1.1.1.3, 2003/09/15 07:09:38 |
Line 91 static int PSLATEX_justify; |
|
Line 91 static int PSLATEX_justify; |
|
static int PSLATEX_rotate = TRUE; |
static int PSLATEX_rotate = TRUE; |
static char *PSLATEX_psfile = NULL; |
static char *PSLATEX_psfile = NULL; |
static TBOOLEAN PSLATEX_useAuxFile = FALSE; /* do we write two files? */ |
static TBOOLEAN PSLATEX_useAuxFile = FALSE; /* do we write two files? */ |
static FILE *PSLATEX_auxFile; |
static FILE *PSLATEX_auxFile = NULL; |
static TBOOLEAN PSLATEX_output = TRUE; /* do we write LaTeX? */ |
static TBOOLEAN PSLATEX_output = TRUE; /* do we write LaTeX? */ |
|
static int PSLATEX_fontsize = 0; |
|
|
struct text_command { |
struct text_command { |
int x, y, angle, justify; |
int x, y, angle, justify; |
Line 156 TERM_PUBLIC void PSLATEX_options() |
|
Line 157 TERM_PUBLIC void PSLATEX_options() |
|
if (!END_OF_COMMAND) { |
if (!END_OF_COMMAND) { |
/* We have font size specified */ |
/* We have font size specified */ |
struct value a; |
struct value a; |
int ps_fontsize = (int) real(const_express(&a)); |
/* Copied from latex.trm */ |
term->v_char = (unsigned int) (ps_fontsize * PS_SC); |
PSLATEX_fontsize = (int) real(const_express(&a)); |
term->h_char = (unsigned int) (ps_fontsize * PS_SC / 2); |
/* |
|
term->v_char = (unsigned int) (PSLATEX_fontsize * DOTS_PER_INCH / 72); |
|
term->h_char = (unsigned int) (PSLATEX_fontsize * DOTS_PER_INCH / 144); |
|
*/ |
|
term->v_char = (unsigned int) (PSLATEX_fontsize * DOTS_PER_INCH / 60); |
|
term->h_char = (unsigned int) (PSLATEX_fontsize * DOTS_PER_INCH / 120); |
} |
} |
/* be sure to generate an options string that PSLATEX_init understands */ |
/* be sure to generate an options string that PSLATEX_init understands */ |
|
|
Line 167 TERM_PUBLIC void PSLATEX_options() |
|
Line 173 TERM_PUBLIC void PSLATEX_options() |
|
ps_solid ? "solid" : "dashed", |
ps_solid ? "solid" : "dashed", |
PSLATEX_rotate ? "rotate" : "norotate", |
PSLATEX_rotate ? "rotate" : "norotate", |
PSLATEX_useAuxFile ? " auxfile" : ""); |
PSLATEX_useAuxFile ? " auxfile" : ""); |
|
if (PSLATEX_fontsize) { |
|
char fs[8] = ""; |
|
sprintf(fs," %d", PSLATEX_fontsize); |
|
strcat(term_options, fs); |
|
} |
} |
} |
|
|
TERM_PUBLIC void PSLATEX_init() |
TERM_PUBLIC void PSLATEX_init() |
Line 176 TERM_PUBLIC void PSLATEX_init() |
|
Line 187 TERM_PUBLIC void PSLATEX_init() |
|
if (strcmp(term->name, "pstex") == 0) |
if (strcmp(term->name, "pstex") == 0) |
PSLATEX_output = FALSE; |
PSLATEX_output = FALSE; |
|
|
PSLATEX_auxFile = NULL; /* until we know otherwise */ |
/* until we know otherwise */ |
|
PSLATEX_auxFile = NULL; |
|
|
/* dont tweak PSLATEX_useAuxFile if we decide we cannot comply |
/* dont tweak PSLATEX_useAuxFile if we decide we cannot comply |
* since this affects subsequent plots even after a set out |
* since this affects subsequent plots even after a set out |
* Instead, we will use PSLATEX_auxFile != NULL to indicate |
* Instead, we will use PSLATEX_auxFile != NULL to indicate |
* use of an aux file |
* use of an aux file |
*/ |
*/ |
|
|
|
/* if there's no extension, append ".ps" */ |
|
if (outstr && (dotIndex = strrchr(outstr, '.')) == NULL) |
|
dotIndex = strchr(outstr, NUL); |
|
|
/* try to open the auxiliary file for the postscript parts. */ |
/* try to open the auxiliary file for the postscript parts. */ |
if (outstr && PSLATEX_useAuxFile == TRUE && |
if (outstr && PSLATEX_useAuxFile == TRUE) { |
(dotIndex = strrchr(outstr, '.'))) { |
|
|
|
/* assume file name is ending in ".tex" */ |
/* length of outstr plus ('.' or '\0') plus "ps" plus '\0' */ |
if (PSLATEX_psfile) |
PSLATEX_psfile = gp_realloc (PSLATEX_psfile,(dotIndex - outstr) + 4,"pslatex aux filename"); |
free(PSLATEX_psfile); |
|
PSLATEX_psfile = gp_alloc(dotIndex - outstr + 3, "pslatex aux filename"); |
|
if (PSLATEX_psfile) { |
if (PSLATEX_psfile) { |
/* including . */ |
/* include period or '\0' */ |
safe_strncpy(PSLATEX_psfile, outstr, dotIndex - outstr + 1); |
strncpy(PSLATEX_psfile, outstr, (dotIndex - outstr) + 1); |
strcpy(PSLATEX_psfile + (dotIndex - outstr) + 1, "ps"); |
/* period or '\0' is overwritten with period, and "ps" appended */ |
if ((PSLATEX_auxFile = fopen(PSLATEX_psfile, "w")) == (FILE *) NULL) { |
strcpy(PSLATEX_psfile + (dotIndex - outstr), ".ps"); |
|
PSLATEX_auxFile = fopen(PSLATEX_psfile, "w"); |
|
if (PSLATEX_auxFile == (FILE *) NULL) { |
fprintf(stderr, "Cannot open aux file %s for output\n", |
fprintf(stderr, "Cannot open aux file %s for output\n", |
PSLATEX_psfile); |
PSLATEX_psfile); |
|
/* And what? Error handling????? */ |
} |
} |
} else { |
} else { |
fprintf(stderr, "\ |
fprintf(stderr, "\ |
Cannot make PostScript file name from %s\n\ |
Cannot make PostScript file name from %s\n\ |
Turning off auxfile option\n", outstr); |
Turning off auxfile option\n", outstr); |
PSLATEX_auxFile = NULL; |
PSLATEX_auxFile = NULL; |
|
/* NEW! */ PSLATEX_useAuxFile = FALSE; |
} |
} |
} |
} |
if (PSLATEX_output) { |
if (PSLATEX_output) { |
Line 253 Turning off auxfile option\n", outstr); |
|
Line 271 Turning off auxfile option\n", outstr); |
|
if (PSLATEX_auxFile) { |
if (PSLATEX_auxFile) { |
FILE *tmp = gpoutfile; |
FILE *tmp = gpoutfile; |
gpoutfile = PSLATEX_auxFile; |
gpoutfile = PSLATEX_auxFile; |
PS_common_init(1, 1, 0, 0, 0, xmin_t, ymin_t, xmax_t, ymax_t, NULL); |
PS_common_init(0, 1, 0, 0, 0, |
|
xmin_t, ymin_t, xmax_t, ymax_t, NULL); |
gpoutfile = tmp; |
gpoutfile = tmp; |
} else { |
} else { |
fputs("{\\GNUPLOTspecial{!\n", gpoutfile); |
fputs("{\\GNUPLOTspecial{!\n", gpoutfile); |
PS_common_init(1, 1, 0, 0, 0, xmin_t, ymin_t, xmax_t, ymax_t, NULL); |
PS_common_init(0, 1, 0, 0, 0, |
|
xmin_t, ymin_t, xmax_t, ymax_t, NULL); |
fputs("}}%\n", gpoutfile); |
fputs("}}%\n", gpoutfile); |
} |
} |
} |
} |
Line 272 TERM_PUBLIC void PSLATEX_graphics() |
|
Line 292 TERM_PUBLIC void PSLATEX_graphics() |
|
struct termentry *t = term; |
struct termentry *t = term; |
|
|
if (PSLATEX_output) |
if (PSLATEX_output) |
fprintf(gpoutfile, "\\begin{picture}(%d,%d)(0,0)%%\n", (int) (xsize * t->xmax), (int) |
fprintf(gpoutfile, "\\begin{picture}(%d,%d)(0,0)%%\n", |
(ysize * t->ymax)); |
(int) (xsize * t->xmax), (int) (ysize * t->ymax)); |
else |
else |
fprintf(gpoutfile, "\\GNUPLOTpicture(%d,%d)\n", (int) (xsize * t->xmax), (int) (ysize * t->ymax)); |
fprintf(gpoutfile, "\\GNUPLOTpicture(%d,%d)\n", |
|
(int) (xsize * t->xmax), (int) (ysize * t->ymax)); |
|
|
if (PSLATEX_auxFile) { |
if (PSLATEX_auxFile) { |
FILE *tmp; |
FILE *tmp; |
/* |
/* these are taken from the post.trm file computation |
* these are taken from the post.trm file computation |
* of the bounding box, but without the X_OFF and Y_OFF */ |
* of the bounding box, but without the X_OFF and Y_OFF |
int urx = (int) (xsize * (PSLATEX_XMAX) / PS_SC + 0.5); |
*/ |
int ury = (int) (ysize * (PSLATEX_YMAX) / PS_SC + 0.5); |
int urx = (int) (xsize * (PS_XMAX) / PS_SC + 0.5), ury = (int) (ysize * (PS_YMAX) / PS_SC |
/* moved this code here from beginning of the function |
+ 0.5); |
* PSLATEX_psfile is only != NULL with the `auxfile' option */ |
|
char *psfile_basename = strrchr(PSLATEX_psfile, DIRSEP1); |
|
|
|
if (psfile_basename) |
|
psfile_basename++; |
|
else { |
|
if (DIRSEP2 != NUL) { |
|
psfile_basename = strrchr(PSLATEX_psfile, DIRSEP2); |
|
if (psfile_basename) |
|
psfile_basename++; |
|
else |
|
psfile_basename = PSLATEX_psfile; |
|
} else |
|
psfile_basename = PSLATEX_psfile; |
|
} |
|
|
/* generate special which xdvi and dvips can handle */ |
/* generate special which xdvi and dvips can handle */ |
fprintf(gpoutfile, |
fprintf(gpoutfile, |
"\\special{psfile=%s llx=0 lly=0 urx=%d ury=%d rwi=%d}\n", |
"\\special{psfile=%s llx=0 lly=0 urx=%d ury=%d rwi=%d}\n", |
PSLATEX_psfile, urx, ury, 10 * urx); |
psfile_basename, urx, ury, 10 * urx); |
tmp = gpoutfile; |
tmp = gpoutfile; |
gpoutfile = PSLATEX_auxFile; |
gpoutfile = PSLATEX_auxFile; |
PS_graphics(); |
PS_graphics(); |
Line 367 TERM_PUBLIC void PSLATEX_text() |
|
Line 402 TERM_PUBLIC void PSLATEX_text() |
|
fputs("}}%\n", gpoutfile); |
fputs("}}%\n", gpoutfile); |
} |
} |
|
|
|
if (PSLATEX_fontsize) { |
|
if (PSLATEX_output) |
|
fprintf(gpoutfile, "\\fontsize{%d}{\\baselineskip}\\selectfont\n", |
|
PSLATEX_fontsize); |
|
/* Should have an else clause here to handle pstex equivalent */ |
|
} |
|
|
for (tc = PSLATEX_labels; tc != (struct text_command *) NULL; tc = tc->next) { |
for (tc = PSLATEX_labels; tc != (struct text_command *) NULL; tc = tc->next) { |
fprintf(gpoutfile, "\\put(%d,%d){", tc->x, tc->y); |
fprintf(gpoutfile, "\\put(%d,%d){", tc->x, tc->y); |
if (PSLATEX_output && |
if (PSLATEX_output && |
Line 594 START_HELP(pslatex) |
|
Line 636 START_HELP(pslatex) |
|
"", |
"", |
" <color> is either `color` or `monochrome`. <rotate> is either `rotate` or", |
" <color> is either `color` or `monochrome`. <rotate> is either `rotate` or", |
" `norotate` and determines if the y-axis label is rotated. <font_size> is", |
" `norotate` and determines if the y-axis label is rotated. <font_size> is", |
" used to scale the font from its usual size.", |
" the size (in pts) of the desired font.", |
"", |
"", |
" If `auxfile` is specified, it directs the driver to put the PostScript", |
" If `auxfile` is specified, it directs the driver to put the PostScript", |
" commands into an auxiliary file instead of directly into the LaTeX file.", |
" commands into an auxiliary file instead of directly into the LaTeX file.", |
" This is useful if your pictures are large enough that dvips cannot handle", |
" This is useful if your pictures are large enough that dvips cannot handle", |
" them. The name of the auxiliary PostScript file is derived from the name of", |
" them. The name of the auxiliary PostScript file is derived from the name of", |
" the TeX file given on the `set output` command; it is determined by replacing", |
" the TeX file given on the `set output` command; it is determined by replacing", |
" the trailing `.tex` (actually just the final extent in the file name---and", |
" the trailing `.tex` (actually just the final extent in the file name) with", |
" the option will be turned off if there is no extent) with `.ps` in the output", |
" `.ps` in the output file name, or, if the TeX file has no extension, `.ps`", |
" file name. Remember to close the file before leaving `gnuplot`.", |
" is appended. Remember to close the file before leaving `gnuplot`.", |
"", |
"", |
" All drivers for LaTeX offer a special way of controlling text positioning:", |
" All drivers for LaTeX offer a special way of controlling text positioning:", |
" If any text string begins with '{', you also need to include a '}' at the", |
" If any text string begins with '{', you also need to include a '}' at the", |
Line 626 START_HELP(pslatex) |
|
Line 668 START_HELP(pslatex) |
|
" Specify own positioning (top here):", |
" Specify own positioning (top here):", |
" set xlabel '[t]{\\LaTeX\\ -- $ \\gamma $}'", |
" set xlabel '[t]{\\LaTeX\\ -- $ \\gamma $}'", |
" The other label -- account for long ticlabels:", |
" The other label -- account for long ticlabels:", |
" set ylabel '[r]{\\LaTeX\\ -- $ \\gamma $\\rule{7mm}{0pt}'", |
" set ylabel '[r]{\\LaTeX\\ -- $ \\gamma $\\rule{7mm}{0pt}}'", |
"", |
"", |
" Linewidths and pointsizes may be changed with `set linestyle`." |
" Linewidths and pointsizes may be changed with `set linestyle`." |
END_HELP(pslatex) |
END_HELP(pslatex) |