14 "pstex:Combined Postscript/LaTeX files:0:pstex:41:pstex\n";
23 static void parse_str(
const char *str,
char *dest );
28 "Color Postscript/LaTeX (color=1|0)" },
33 #ifndef ENABLE_DYNDRIVERS 34 pdt->
pl_MenuStr =
"Combined Postscript/LaTeX files";
70 ofile = (
char *) malloc(
sizeof (
char ) * len );
72 fp = fopen( ofile,
"w" );
76 fprintf( fp,
"\\begin{picture}(0,0)(0,0)%%\n" );
77 fprintf( fp,
"\\includegraphics[scale=1.,clip]{%s}%%\n", pls->
FileName );
78 fprintf( fp,
"\\end{picture}%%\n" );
80 fprintf( fp,
"\\setlength{\\unitlength}{%fbp}%%\n", 1.0 /
ENLARGE );
81 fprintf( fp,
"\\begingroup\\makeatletter\\ifx\\SetFigFont\\undefined%%\n" );
82 fprintf( fp,
"\\gdef\\SetFigFont#1#2#3#4#5{%%\n" );
83 fprintf( fp,
"\\reset@font\\fontsize{#1}{#2pt}%%\n" );
84 fprintf( fp,
"\\fontfamily{#3}\\fontseries{#4}\\fontshape{#5}%%\n" );
85 fprintf( fp,
"\\selectfont}%%\n" );
86 fprintf( fp,
"\\fi\\endgroup%%\n" );
89 fprintf( fp,
"\\begin{picture}(xxxxxx,xxxxxx)(xxxxxx,xxxxxx)%%\n" );
121 scale = pls->
xpmm * 25.4 / 72.;
124 fprintf( fp,
"\\end{picture}\n" );
126 fseek( fp, dev->
cur_pos, SEEK_SET );
127 fprintf( fp,
"\\begin{picture}(%d,%d)(%d,%d)%%\n%%",
140 PLFLT a1, alpha, ft_ht, angle;
141 char cptr[256], jst, ref;
143 PLINT clxmin, clxmax, clymin, clymax;
149 ft_ht = 1.6 * pls->
chrht * 72.0 / 25.4;
153 a1 = acos( t[0] ) * 180. /
PI;
155 alpha = a1 - angle - 90.;
157 alpha = 360. - a1 - angle - 90.;
160 parse_str( args->
string, cptr );
170 if ( args->
base == 2 )
172 else if ( args->
base == 1 )
183 if ( args->
just == 0.5 )
185 else if ( args->
just == 1. )
190 args->
x = args->
refx;
191 args->
y = args->
refy;
195 difilt( &args->
x, &args->
y, 1, &clxmin, &clxmax, &clymin, &clymax );
202 if ( args->
x < clxmin || args->
x > clxmax || args->
y < clymin || args->
y > clymax )
206 &( args->
x ), &( args->
y ) );
209 fprintf( fp,
"\\put(%d,%d){\\circle{10}}\n",
213 fprintf( fp,
"\\put(%d,%d){\\rotatebox{%.1f}{\\makebox(0,0)[%c%c]{\\SetFigFont{%.1f}{12}",
214 args->
x, args->
y, alpha, jst, ref, ft_ht );
226 switch ( pls->
cfont )
228 case ( 1 ): fprintf( fp,
"{\\familydefault}" );
break;
229 case ( 2 ): fprintf( fp,
"{\\rmdefault}" );
break;
230 case ( 3 ): fprintf( fp,
"{\\itdefault}" );
break;
231 case ( 4 ): fprintf( fp,
"{\\sfdefault}" );
break;
232 default: fprintf( fp,
"{\\familydefault}" );
235 fprintf( fp,
"{\\mddefault}{\\updefault}\n" );
240 fprintf( fp,
"\\special{ps: %.3f %.3f %.3f setrgbcolor}{",
243 fprintf( fp,
"\\special{ps: 0 0 0 setrgbcolor}{" );
245 fprintf( fp,
"%% Your text follows:\n" );
246 fprintf( fp,
"%s\n", cptr );
247 fprintf( fp,
"}}}}" );
257 dev->
llx =
MIN( dev->
llx, args->
x - ft_ht * 25.4 / 72. * pls->
xpmm );
258 dev->
lly =
MIN( dev->
lly, args->
y - ft_ht * 25.4 / 72. * pls->
ypmm );
259 dev->
urx =
MAX( dev->
urx, args->
x + ft_ht * 25.4 / 72. * pls->
xpmm );
260 dev->
ury =
MAX( dev->
ury, args->
y + ft_ht * 25.4 / 72. * pls->
ypmm );
264 parse_str(
const char *str,
char *dest )
266 int n, opened = 0, raised = 0, overline = 0, underline = 0, fontset = 0, math = 0;
267 char *tp = dest, c, esc;
268 char greek[] =
"abgGdDezyhHiklLmncCopPrsStuUfFxqQwW";
269 char *mathgreek[] = {
"alpha",
"beta",
"gamma",
"Gamma",
"delta",
"Delta",
270 "epsilon",
"zeta",
"eta",
"theta",
"Theta",
"iota",
271 "kappa",
"lambda",
"Lambda",
"mu",
"nu",
"xi",
"Xi",
272 "o",
"pi",
"Pi",
"rho",
"sigma",
"Sigma",
"tau",
273 "upsilon",
"Upsilon",
"phi",
"Phi",
"chi",
274 "psi",
"Psi",
"omega",
"Omega" };
297 n = sprintf( tp,
"\\raisebox{%.2fex}{", 0.6 );
311 n = sprintf( tp,
"\\raisebox{%.2fex}{", -0.6 );
318 n = sprintf( tp,
"\\hspace{-1em}" );
329 n = sprintf( tp,
"}$" );
332 overline--; opened--;
339 n = sprintf( tp,
"\\overline{" );
340 tp += n; overline++; opened++; math++;
351 n = sprintf( tp,
"}$" );
354 underline--; opened--;
361 n = sprintf( tp,
"\\underline{" );
362 tp += n; underline++; opened++; math++;
375 strcpy( tp, mathgreek[n] );
377 *tp = toupper( *tp );
378 tp += strlen( mathgreek[n] );
388 plwarn(
"'g(...)' text escape sequence not processed." );
389 while ( *str++ !=
')' )
410 n = sprintf( tp,
"\\normalfont " );
416 n = sprintf( tp,
"\\mathrm{" );
418 n = sprintf( tp,
"\\textrm{" );
420 tp += n; opened++; fontset++;
425 n = sprintf( tp,
"\\mathit{" );
427 n = sprintf( tp,
"\\textit{" );
429 tp += n; opened++; fontset++;
434 n = sprintf( tp,
"\\mathsf{" );
436 n = sprintf( tp,
"\\textsf{" );
438 tp += n; opened++; fontset++;
460 #endif // PLD_pstexdev int plParseDrvOpts(DrvOpt *acc_opt)
void plD_init_psc(PLStream *)
void plCloseFile(PLStream *pls)
void plGetFam(PLStream *pls)
void(* plD_tidy_fp)(struct PLStream_struct *)
void plD_init_ps(PLStream *)
void plD_esc_ps(PLStream *pls, PLINT op, void *ptr)
void(* plD_init_fp)(struct PLStream_struct *)
void plD_tidy_pstex(PLStream *)
void(* plD_eop_fp)(struct PLStream_struct *)
void plD_state_ps(PLStream *pls, PLINT op)
void(* plD_line_fp)(struct PLStream_struct *, short, short, short, short)
void(* plD_esc_fp)(struct PLStream_struct *, PLINT, void *)
void(* plD_polyline_fp)(struct PLStream_struct *, short *, short *, PLINT)
void plD_init_pstex(PLStream *)
void plD_bop_pstex(PLStream *)
void difilt(PLINT *xsc, PLINT *ysc, PLINT npts, PLINT *clpxmi, PLINT *clpxma, PLINT *clpymi, PLINT *clpyma)
void plD_tidy_ps(PLStream *pls)
void plD_line_ps(PLStream *pls, short x1a, short y1a, short x2a, short y2a)
#define PLDLLIMPEXP_DRIVER
static PLStream * pls[PL_NSTREAMS]
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pstex(PLDispatchTable *pdt)
static void proc_str(PLStream *, EscText *)
void plD_bop_ps(PLStream *pls)
void(* plD_bop_fp)(struct PLStream_struct *)
void plRotPhy(PLINT orient, PLINT xmin, PLINT ymin, PLINT xmax, PLINT ymax, PLINT *px, PLINT *py)
void plwarn(PLCHAR_VECTOR errormsg)
void plD_polyline_ps(PLStream *pls, short *xa, short *ya, PLINT npts)
void plD_esc_pstex(PLStream *, PLINT, void *)
plD_polyline_fp pl_polyline
void(* plD_state_fp)(struct PLStream_struct *, PLINT)
void plD_eop_ps(PLStream *pls)
PLINT plP_strpos(PLCHAR_VECTOR str, int chr)