home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.soft-sys.matlab
- Path: sparky!uunet!spool.mu.edu!news.nd.edu!control!jeff
- From: jeff@control.nd.edu (Jeffrey C. Kantor)
- Subject: Matlab4.0 vs. Framemaker 3.1.1
- Message-ID: <1993Jan28.222050.15220@news.nd.edu>
- Sender: news@news.nd.edu (USENET News System)
- Reply-To: jeff@control.nd.edu
- Organization: University of Notre Dame
- Date: Thu, 28 Jan 1993 22:20:50 GMT
- Lines: 225
-
- I've finally sorted out the problem of importing matlab eps files into
- framemaker. The important thing to do is remove the %%EOF line that
- matlab sticks at the end of the file. I did this by inserted a short
- sed script into print.m.
-
- The second modification I made to print.m was to not add the preview information.
- I'm using Openview 3.0, and framemaker will render the eps file directly, so
- the preview info is redundant for me. Print.m appears to always add -preview
- to the eps files, whether or not you wanted that to happen. I commented out
- this part of print.m
-
- My version of print.m is attached below. Use at your own risk.
-
- Jeff Kantor
- Notre Dame
-
- function print(arg1,arg2,arg3,arg4,arg5)
- %PRINT Print graph or save graph to file.
- % PRINT <filename> saves the current Figure window in PostScript
- % format to the designated filename, overwriting it if it
- % already exists. If the specified filename does not include an
- % extension, ".ps" or ".eps" is appended to the filename.
- % If the filename is omitted, the Figure is sent directly to the
- % printer as specified in PRINTOPT.
- %
- % Syntax: PRINT [ -ddevice] [ -append ] <filename>
- %
- % Available device options are:
- % -dps - PostScript for black and white printers
- % -dpsc - PostScript for color printers
- % -dps2 - Level 2 PostScript for black and white printers
- % -dpsc2 - Level 2 PostScript for color printers
- %
- % -deps - Encapsulated PostScript (EPSF)
- % -depsc - Encapsulated Color PostScript (EPSF)
- % -deps2 - Encapsulated Level 2 PostScript (EPSF)
- % -depsc2 - Encapsulated Level 2 Color PostScript (EPSF)
- %
- % Other PRINT options are:
- % -append - Append the graph to file, rather than overwriting
- %
- % PRINT, by itself, or with a device name, sends the contents
- % of the current Figure window to the printer. See PRINTOPT
- % to control printing defaults.
- %
- % See also PRINTOPT, ORIENT.
-
- % Copyright (c) 1984-92 by The MathWorks, Inc.
-
- %
- % list of all supported devices, for input validation
- %
- devices = [
- 'ps '
- 'psc '
- 'ps2 '
- 'ps2c '
- 'psc2 '
- 'eps '
- 'epsc '
- 'eps2 '
- 'eps2c'
- 'epsc2'
- ];
-
- options = [
- 'append '
- 'preview'
- ];
-
- printplot = 0;
- isEps = 0;
- num_opt_args = 0;
- filename = [];
-
- [lprcmd, dev] = printopt;
-
- for i=1:nargin
- cur_arg = eval(['arg', num2str(i)]);
- if (cur_arg(1) ~= '-')
- if isempty(filename)
- filename = cur_arg;
- else
- error('Multiple inputs that look like filenames, no ''-''.');
- end
-
- elseif (cur_arg(2) == 'd')
- %
- % verify device given is supported
- % device proper starts after '-d', if only '-d'
- % we echo out possible choices
- %
- dev = cur_arg;
- match = 0;
- wasError = 0;
- if ( size(dev,2) > 2 )
- wasError = 1;
- for r = 1:size(devices,1)
- if strcmp( deblank(dev(3:size(dev,2))), deblank(devices(r,:)) )
- match = 1;
- break;
- end
- end
- if ~match
- disp('Illegal device specified.');
- end
- end
- if ~match
- disp('Supported devices are:')
- disp(devices);
- if wasError
- error(' ');
- else
- return;
- end
- end
- if (dev(3) == 'e')
- isEps = 1;
- end
-
- else
- %
- % verify any given options are supported
- %
- match = 0;
- if size(cur_arg,2) > 1
- op = cur_arg(2:size(cur_arg,2));
- for r = 1:size(options,1)
- c = min(size(op,2), size(options(r,:),2));
- if strcmp(op(1:c), options(r,1:c))
- match = 1;
- break;
- end
- end
- end
- if ~match
- error(['Illegal option ''' op ''' given.'])
- end
- num_opt_args = num_opt_args + 1;
- eval(['opt_arg', num2str(num_opt_args), ' = cur_arg;']);
- end
- end
-
- if isempty(filename)
- if (isEps == 1)
- error('Filename must be specified.')
- end
- % Generate a unique filename
- t = fix(clock);
- filename = ['tp' sprintf('%02.0f%02.0f%02.0f.ps',t(4),t(5),t(6))];
- printplot = 1;
- end
-
- % Append appropriate extension to filename if not there already
- if ~any(filename == '.')
- if (isEps)
- filename = [filename '.eps'];
- else
- filename = [filename '.ps'];
- end
- end
-
- % Create objects on screen if not already there
- drawnow
-
- % EPS file gets Adobe standard EPSI bitmap preview
- % Bring figure to top of window stacking order for screen capture
- %if (isEps)
- % num_opt_args = num_opt_args + 1;
- % eval(['opt_arg', num2str(num_opt_args), ' = ''-preview'';']);
- % figure(gcf)
- %end
-
- % Invert B&W color properties of Figure and child objects
- if strcmp( 'on', get(gcf,'InvertHardcopy') )
- cinvert( gcf );
- end
-
- % if not color, set lines and text to a color contrasting background
- if isempty( find('c' == dev) )
- lineTextColors = blt;
- end
-
- if (num_opt_args == 0)
- hardcopy(gcf, filename, dev)
- elseif (num_opt_args == 1)
- hardcopy(gcf, filename, dev, opt_arg1)
- elseif (num_opt_args == 2)
- hardcopy(gcf, filename, dev, opt_arg1, opt_arg2)
- elseif (num_opt_args == 3)
- hardcopy(gcf, filename, dev, opt_arg1, opt_arg2, opt_arg3)
- elseif (num_opt_args == 4)
- hardcopy(gcf, filename, dev, opt_arg1, opt_arg2, opt_arg3, opt_arg4)
- end
-
- if isEps
- eval(['!sed ''s/%%EOF//''',' ',filename,' >temp']);
- eval(['!mv -f temp ',filename]);
- end
-
-
- % set color of lines and text back to what they were
- if isempty( find('c' == dev) )
- blt(lineTextColors);
- end
-
- % Invert back the W&B color properties of Figure and child objects
- if strcmp( 'on', get(gcf,'InvertHardcopy') )
- cinvert( gcf );
- end
-
- %
- % Discard all the object invalidations that occured as a result of changing
- % colors. All objects are back to their previous state, but they don't
- % know that and won't draw themselves.
- %
- if isempty( find('c' == dev) ) | strcmp( 'on', get(gcf,'InvertHardcopy') )
- drawnow('discard')
- end
-
- if printplot
- lprcmd = [lprcmd,' ',filename];
- eval(['!',lprcmd]);
- end
-
-