16 "pstex:Combined Postscript/LaTeX files:0:pstex:41:pstex\n";
25 static void parse_str(
const char *str,
char *dest );
30 "Color Postscript/LaTeX (color=1|0)" },
35 #ifndef ENABLE_DYNDRIVERS
36 pdt->
pl_MenuStr =
"Combined Postscript/LaTeX files";
72 ofile = (
char *) malloc(
sizeof (
char ) * len );
74 fp = fopen( ofile,
"w" );
78 fprintf( fp,
"\\begin{picture}(0,0)(0,0)%%\n" );
79 fprintf( fp,
"\\includegraphics[scale=1.,clip]{%s}%%\n", pls->
FileName );
80 fprintf( fp,
"\\end{picture}%%\n" );
82 fprintf( fp,
"\\setlength{\\unitlength}{%fbp}%%\n", 1.0 /
ENLARGE );
83 fprintf( fp,
"\\begingroup\\makeatletter\\ifx\\SetFigFont\\undefined%%\n" );
84 fprintf( fp,
"\\gdef\\SetFigFont#1#2#3#4#5{%%\n" );
85 fprintf( fp,
"\\reset@font\\fontsize{#1}{#2pt}%%\n" );
86 fprintf( fp,
"\\fontfamily{#3}\\fontseries{#4}\\fontshape{#5}%%\n" );
87 fprintf( fp,
"\\selectfont}%%\n" );
88 fprintf( fp,
"\\fi\\endgroup%%\n" );
91 fprintf( fp,
"\\begin{picture}(xxxxxx,xxxxxx)(xxxxxx,xxxxxx)%%\n" );
123 scale = pls->
xpmm * 25.4 / 72.;
126 fprintf( fp,
"\\end{picture}\n" );
128 fseek( fp, dev->
cur_pos, SEEK_SET );
129 fprintf( fp,
"\\begin{picture}(%d,%d)(%d,%d)%%\n%%",
142 PLFLT a1, alpha, ft_ht, angle;
143 char cptr[256], jst, ref;
145 PLINT clxmin, clxmax, clymin, clymax;
151 ft_ht = 1.6 * pls->
chrht * 72.0 / 25.4;
155 a1 = acos( t[0] ) * 180. /
PI;
157 alpha = a1 - angle - 90.;
159 alpha = 360. - a1 - angle - 90.;
162 parse_str( args->
string, cptr );
172 if ( args->
base == 2 )
174 else if ( args->
base == 1 )
185 if ( args->
just == 0.5 )
187 else if ( args->
just == 1. )
192 args->
x = args->
refx;
193 args->
y = args->
refy;
197 difilt( &args->
x, &args->
y, 1, &clxmin, &clxmax, &clymin, &clymax );
204 if ( args->
x < clxmin || args->
x > clxmax || args->
y < clymin || args->
y > clymax )
208 &( args->
x ), &( args->
y ) );
211 fprintf( fp,
"\\put(%d,%d){\\circle{10}}\n",
215 fprintf( fp,
"\\put(%d,%d){\\rotatebox{%.1f}{\\makebox(0,0)[%c%c]{\\SetFigFont{%.1f}{12}",
216 args->
x, args->
y, alpha, jst, ref, ft_ht );
228 switch ( pls->
cfont )
230 case ( 1 ): fprintf( fp,
"{\\familydefault}" );
break;
231 case ( 2 ): fprintf( fp,
"{\\rmdefault}" );
break;
232 case ( 3 ): fprintf( fp,
"{\\itdefault}" );
break;
233 case ( 4 ): fprintf( fp,
"{\\sfdefault}" );
break;
234 default: fprintf( fp,
"{\\familydefault}" );
237 fprintf( fp,
"{\\mddefault}{\\updefault}\n" );
242 fprintf( fp,
"\\special{ps: %.3f %.3f %.3f setrgbcolor}{",
245 fprintf( fp,
"\\special{ps: 0 0 0 setrgbcolor}{" );
247 fprintf( fp,
"%% Your text follows:\n" );
248 fprintf( fp,
"%s\n", cptr );
249 fprintf( fp,
"}}}}" );
259 dev->
llx =
MIN( dev->
llx, args->
x - ft_ht * 25.4 / 72. * pls->
xpmm );
260 dev->
lly =
MIN( dev->
lly, args->
y - ft_ht * 25.4 / 72. * pls->
ypmm );
261 dev->
urx =
MAX( dev->
urx, args->
x + ft_ht * 25.4 / 72. * pls->
xpmm );
262 dev->
ury =
MAX( dev->
ury, args->
y + ft_ht * 25.4 / 72. * pls->
ypmm );
266 parse_str(
const char *str,
char *dest )
268 int n, opened = 0, raised = 0, overline = 0, underline = 0, fontset = 0, math = 0;
269 char *tp = dest, c, esc;
270 char greek[] =
"abgGdDezyhHiklLmncCopPrsStuUfFxqQwW";
271 char *mathgreek[] = {
"alpha",
"beta",
"gamma",
"Gamma",
"delta",
"Delta",
272 "epsilon",
"zeta",
"eta",
"theta",
"Theta",
"iota",
273 "kappa",
"lambda",
"Lambda",
"mu",
"nu",
"xi",
"Xi",
274 "o",
"pi",
"Pi",
"rho",
"sigma",
"Sigma",
"tau",
275 "upsilon",
"Upsilon",
"phi",
"Phi",
"chi",
276 "psi",
"Psi",
"omega",
"Omega" };
299 n = sprintf( tp,
"\\raisebox{%.2fex}{", 0.6 );
313 n = sprintf( tp,
"\\raisebox{%.2fex}{", -0.6 );
320 n = sprintf( tp,
"\\hspace{-1em}" );
331 n = sprintf( tp,
"}$" );
334 overline--; opened--;
341 n = sprintf( tp,
"\\overline{" );
342 tp += n; overline++; opened++; math++;
353 n = sprintf( tp,
"}$" );
356 underline--; opened--;
363 n = sprintf( tp,
"\\underline{" );
364 tp += n; underline++; opened++; math++;
377 strcpy( tp, mathgreek[n] );
379 *tp = toupper( *tp );
380 tp += strlen( mathgreek[n] );
390 plwarn(
"'g(...)' text escape sequence not processed." );
391 while ( *str++ !=
')' )
412 n = sprintf( tp,
"\\normalfont " );
418 n = sprintf( tp,
"\\mathrm{" );
420 n = sprintf( tp,
"\\textrm{" );
422 tp += n; opened++; fontset++;
427 n = sprintf( tp,
"\\mathit{" );
429 n = sprintf( tp,
"\\textit{" );
431 tp += n; opened++; fontset++;
436 n = sprintf( tp,
"\\mathsf{" );
438 n = sprintf( tp,
"\\textsf{" );
440 tp += n; opened++; fontset++;
462 #endif // PLD_pstexdev
int plParseDrvOpts(DrvOpt *acc_opt)
void(* plD_line_fp)(struct PLStream_struct *, short, short, short, short)
void(* plD_eop_fp)(struct PLStream_struct *)
void(* plD_state_fp)(struct PLStream_struct *, PLINT)
void plD_polyline_ps(PLStream *, short *, short *, PLINT)
void plD_init_psc(PLStream *)
void(* plD_tidy_fp)(struct PLStream_struct *)
void plCloseFile(PLStream *pls)
void plD_init_psm(PLStream *)
void plGetFam(PLStream *pls)
void plD_esc_ps(PLStream *, PLINT, void *)
void plD_tidy_pstex(PLStream *)
void plD_tidy_ps(PLStream *)
void(* plD_polyline_fp)(struct PLStream_struct *, short *, short *, PLINT)
void plD_line_ps(PLStream *, short, short, short, short)
void plD_state_ps(PLStream *, PLINT)
void(* plD_esc_fp)(struct PLStream_struct *, PLINT, void *)
void(* plD_bop_fp)(struct PLStream_struct *)
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)
#define PLDLLIMPEXP_DRIVER
void plD_bop_ps(PLStream *)
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pstex(PLDispatchTable *pdt)
static void proc_str(PLStream *, EscText *)
PLINT plP_strpos(const char *str, int chr)
void plD_eop_ps(PLStream *)
void plwarn(const char *errormsg)
void plRotPhy(PLINT orient, PLINT xmin, PLINT ymin, PLINT xmax, PLINT ymax, PLINT *px, PLINT *py)
void plD_esc_pstex(PLStream *, PLINT, void *)
plD_polyline_fp pl_polyline
void(* plD_init_fp)(struct PLStream_struct *)