Article View: comp.text.tex
Article #142Re: Solution: FrameMaker --> PostScript --> LaTeX figure
From: Martin Boyer
Date: Sat, 31 Oct 1992 13:20
Date: Sat, 31 Oct 1992 13:20
193 lines
6408 bytes
6408 bytes
>>>>> Chuan Lee writes:
>Here is the SOLUTION to put a FrameMaker graphics into a LaTeX doc
>as figures.
>1) Print the FrameMaker file or page to a PostScript file (e.g. fig.ps).
>2) Follow the sample below. Actually there is nothing new except adding
>the 'psfig' at the \documentstyle command.
>3) latex sample.tex, which gives sample.dvi.
>4) That's it!
I'm afraid that's not always enough. FrameMaker sometimes (always, in
our case) puts page size information in the document and that messes
up our LaserWriter II and our QMS PS-800.
I saved the following method which is more robust; the part about
commenting out four lines is specially important.
(NOTE: I edited the message to shorten it.)
- Newsgroups: comp.text.tex,comp.text.frame
- Summary: includes source code, ftp pointers
- Organization: Computer Science & Engineering, U. of Washington, Seattle
- From: peg@cs.washington.edu (Peter Granger)
- Subject: Solution: Figures from FrameMaker to LaTeX
- Date: 08 Oct 92 04:46:36 EDT
-
- [...]
-
- In a nutshell, here's how to do the conversions so FrameMaker figures
- can go in LaTex documents:
-
- 1. Generate figure in Frame.
- 2. Save to a PostScript file with the Print command.
-
- This generates regular PostScript, and not encapsulated. I don't know
- why. But LaTex will choke and puke on non-encapsulated PostScript, so
- you nave to convert it to encapsulated.
-
- 3. Run pstoepsi on the .ps file, generating a .epsi file.
-
- You will probably have to get pstoepsi, and the utility it uses,
- pbmplus, via ftp. You will also have to build them. This is a
- nuisance, but I managed it, so you probably can, too. You can get
- pstoepsi at:
-
- Host: cs.tut.fi (130.230.4.2)
- Directory: /pub/src/commands.1/framemaker-filters
-
- That includes a README document that tells you about pbmplus, which is at:
-
- Host: export.lcs.mit.edu
- Directory: contrib/pbmplus.tar.Z
-
- After running pstoepsi, you have your figure in encapsulated
- PostScript format. However, you may find (as I did) that you can view
- it in GhostScript, but can't get the figures to come out when you
- print it. If so, then you need to...
-
- 4. Use fmfix, or manually edit, to comment out these four
- lines of the .epsi file:
-
- % setpapername
- % manualfeed {true} {papersize} ifelse
- % {manualpapersize} {false} ifelse
- % {desperatepapersize} if
-
- As close as I can tell, and I know *nothing* about PostScript, it
- looks like this only influences things that go onto actual physical
- paper. That would explain why ghostscript worked, but printing didn't.
- No paper, no problem.
-
- The source for fmfix was sent to me by Arthur Castonguay
- (arthurc@doe.carleton.ca). I don't know whether he supports this in
- any way, but considering that the program only has one function, it
- should be near 100% robust. Here is what he gave me. (I include it
- here because I don't think it's available by ftp anywhere; maybe it
- should be.)
-
- ----- 8< ----- Cut Here --- fmfix.c --- Cut Here ----- 8< -----
- /*
- * This is a filter to comment four lines out of FrameMaker
- * generated PostScript files so that they can be imported
- * in to TeX/LaTeX correctly and view with Ghostscript.
- *
- * The lines in question are:
- *
- * setpapername
- * manualfeed {true} {papersize} ifelse
- * {manualpapersize} {false} ifelse
- * {desperatepapersize} if
- */
-
- #define BUFSIZ 1024
- #define EQUAL 0
-
- #include <stdio.h>
-
- char aline[BUFSIZ+1];
-
- char *search_string[] =
- {
- "setpapername",
- "manualfeed {true} {papersize} ifelse",
- "{manualpapersize} {false} ifelse",
- "{desperatepapersize} if"
- };
-
- int num_strings = sizeof( search_string ) / sizeof( char * );
-
- int read_a_line()
- {
- int i, c;
-
- for (i = 0; i < BUFSIZ; i++)
- {
- c = fgetc( stdin );
-
- if (c == EOF)
- {
- aline[i] = '\0'; /* Terminate the string */
- return EOF;
- }
- else
- {
- aline[i] = c;
-
- /* Check for EOL */
- if (c == '\n')
- {
- break;
- }
- }
- }
-
- aline[i+1] = '\0'; /* Terminate the string */
- return 0;
- }
-
-
- /* main(argc) */ /* For older C compilers */
- /* int argc; */
- main( int argc )
- {
- int i, c, done;
- char *s;
-
- if (argc != 1)
- {
- fprintf( stderr, "Usage: fmfix < fmfile.ps > fixedfile.ps\n" );
- exit( 1 );
- }
-
- done = 0;
- do
- {
- if (read_a_line() == EOF)
- {
- done = 1;
- }
-
- /* Find the place in the string where the first non-blank character starts */
- s = aline;
- while (((*s == ' ') || (*s == '\t')) && (*s != '\0')) s++;
-
- /* Search for strings to match */
- for (i = 0; i < num_strings; i++)
- {
- if (strncmp( s, search_string[i], strlen( search_string[i] ) ) == EQUAL)
- {
- fputs( "% ", stdout );
- break;
- }
- }
-
- fputs( aline, stdout );
- }
- while (!done);
-
- exit( 0 );
- }
- ----- 8< ----- Cut Here --- fmfix.c --- Cut Here ----- 8< -----
-
- You now have an encapsulated PostScript file with the trouble-causing
- lines removed. Now you can use psfig, or augpsfig, or probably
- whatever else you like to pull the .epsi file into your LaTex
- document. You can see the result equally well in both GhostScript and
- actual printed pages.
--
Martin Boyer mboyer@ireq-robot.hydro.qc.ca
Institut de recherche d'Hydro-Quebec mboyer@ireq-robot.uucp
Varennes, QC, Canada J3X 1S1
+1 514 652-8412
Technical Details
Message-ID:
<GAMIN.92Oct31082018@amadeus.ireq-robot.hydro.qc.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!utcsri!newsflash.concordia.ca!hobbit.ireq.hydro.qc.ca!NetNews.ireq.hydro.qc.ca!gaminReferences:
<1992Oct20.220126.25309@u.washington.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex,uw.tex Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!newsflash.concordia.ca!hobbit.ireq.hydro.qc.ca!NetNews.ireq.hydro.qc.ca!gamin From: gamin@ireq-robot.hydro.qc.ca (Martin Boyer) Subject: Re: Solution: FrameMaker --> PostScript --> LaTeX figure In-Reply-To: chuan@stein.u.washington.edu's message of 20 Oct 92 17:01:26 EST Message-ID: <GAMIN.92Oct31082018@amadeus.ireq-robot.hydro.qc.ca> Lines: 193 Sender: news@ireq.hydro.qc.ca (Netnews Admin) Organization: Le laboratoire de robotique de l'Institut de recherche d'Hydro-Quebec References: <1992Oct20.220126.25309@u.washington.edu> Date: Sat, 31 Oct 1992 13:20:18 GMT