From: etwz@levels.unisa.edu.au
Newsgroups: sci.math.symbolic
Subject: Re: Reduce BoundingBox of Mma Encap. PostScript?
Date: 14 Aug 92 07:20:37 GMT
Organization: University of South Australia


In article <18260.2a882baf@levels.unisa.edu.au>, 
I writes:
>   I use Mma 2.0 and psfix -epsf to generate ecapsulated PostScript.
> However, the margins or BoundingBox in the epsf file seem quite large.
> It is thus hard to put two plottings in one LaTeX page, unless scale
> them a lot. 
> 
>   Is there a way to adjust the BoundingBox in the PostScript file,
> rather by hand?
> 
Thanks to the kind responders now I have an almost satisfactory
solution.  Although I still hope Wolfram modify its default in psfix
(change epsf size from 4x4 to 5x3). The following is a summary.

(1) Lars A. Stole (lars@gsblas.uchicago.EDU) suggested BBFig for NeXT on
sonata.cc.purdue.edu or cs.orst.edu in /pub/next/2.0-release/source/.

(2) dave stephens (dws@forager.unl.edu) suggested using

psfix -epsf -lmarg 0 -bmarg 0 -tmarg 0 -bmarg 0 -width 5 -length 3 filename \
> newfile.ps

or as I tried, simply 

psfix -epsf -width 5 -length 3 filename > newfile.ps

gave the same result.

(3) Brian Berg (berg@a1.arc.umn.edu) seems have the best solution:

        here is PSFile & a modification of PSFile called PSFile2.
In the 2 version, one can specify the size of the graphic or
allow the default 3 by 5 inches to be used.

---------------
(* 2/25/1991 Dan Dill dan@chem.bu.edu *)
(* 10/1992 modified by Brian Berg for PSFile2 *)

Unprotect[System`PSFile]


System`PSFile::usage = "PSFile[-graphics-, \"file\"].  Capture a Mathematica
graphic object in a PostScript file. Quotes are required around the file name
and suffix `.ps' is added.  The graphic object is preprocessed through psfix
to prepend the Mathematica PostScript procedures to the file, so that it may
be printed directly with lpr.  For example,
\n
\n
\t PSFile[myplot, \"myplot\"]
\n
\n
  will convert the Mathematica graphic myplot to the PostScript file myplot.ps
in the subdirectory p4 of the current directory."

System`PSFile2::usage = "PSFile2[-graphics-, \"file\", width, height].  
Capture a Mathematica
graphic object in a PostScript file. Quotes are required around the file name
and suffix `.ps' is added.  The graphic object is preprocessed through psfix
to prepend the Mathematica PostScript procedures to the file, so that it may
be printed directly with lpr.  For example,
\n
\n
\t PSFile[myplot, \"p4\", width, height]
\n
\n
  will convert the Mathematica graphic myplot to the PostScript file myplot.ps
in the subdirectory p4 of the current directory with a width and
height as specified in inches."

System`PSFile::file = "Graphics being processed (with prolog) to file
\"`1`\".";
System`PSFile2::file = "Graphics w/ zero margins processing with prolog to file
\"
`1`\".";Begin["System`Private`"]
PSFile[g_, f_String] := Block[{filename},
        filename = StringJoin[f, ".ps"];
        Message[PSFile::file, filename];
        Display[StringJoin[
                "! ",
                "psfix",
                " > ",
                filename
                ], g
        ];
]
PSFile2[g_, f_String, w_:5.0, h_:3.0] := Block[{filename},
        filename = StringJoin[f, ".ps"];
        Message[PSFile2::file, filename];
        Display[StringJoin[
                "! ",
                "psfix -lmarg 0 -rmarg 0 -bmarg 0 -tmarg 0 ",
                " -width ",ToString[ w], " -height ",ToString[ h],
                " > ",
                filename
                ], g
        ];
]
End[]

Protect[PSFile]
-----------------
 
Brian also suggested to put the above codes into init.m file.

Thanks to you all, from down under (Australia).

--
Weimin Zhang (weimin@panda.levels.unisa.edu.au)

{panda:71} cat temp

Thanks to the kind responders now I have an almost satisfactory
solution.  Although I still hope Wolfram modify its default in psfix
(change epsf size from 4x4 to 5x3). The following is a summary.

(1) Lars A. Stole (lars@gsblas.uchicago.EDU) suggested BBFig for NeXT on
sonata.cc.purdue.edu or cs.orst.edu in /pub/next/2.0-release/source/.

(2) dave stephens (dws@forager.unl.edu) suggested using

psfix -epsf -lmarg 0 -bmarg 0 -tmarg 0 -bmarg 0 -width 5 -length 3 filename \
> newfile.ps

or as I tried, simply 

psfix -epsf -width 5 -length 3 filename > newfile.ps

gave the same result.

(3) Brian Berg (berg@a1.arc.umn.edu) has the best solution:

        here is PSFile & a modification of PSFile called PSFile2.
In the 2 version, one can specify the size of the graphic or
allow the default 3 by 5 inches to be used.

--------------------------
(* 2/25/1991 Dan Dill dan@chem.bu.edu *)
(* 10/1992 modified by Brian Berg for PSFile2 *)

Unprotect[System`PSFile]


System`PSFile::usage = "PSFile[-graphics-, \"file\"].  Capture a Mathematica
graphic object in a PostScript file. Quotes are required around the file name
and suffix `.ps' is added.  The graphic object is preprocessed through psfix
to prepend the Mathematica PostScript procedures to the file, so that it may
be printed directly with lpr.  For example,
\n
\n
\t PSFile[myplot, \"myplot\"]
\n
\n
  will convert the Mathematica graphic myplot to the PostScript file myplot.ps
in the subdirectory p4 of the current directory."

System`PSFile2::usage = "PSFile2[-graphics-, \"file\", width, height].  
Capture a Mathematica
graphic object in a PostScript file. Quotes are required around the file name
and suffix `.ps' is added.  The graphic object is preprocessed through psfix
to prepend the Mathematica PostScript procedures to the file, so that it may
be printed directly with lpr.  For example,
\n
\n
\t PSFile[myplot, \"p4\", width, height]
\n
\n
  will convert the Mathematica graphic myplot to the PostScript file myplot.ps
in the subdirectory p4 of the current directory with a width and
height as specified in inches."

System`PSFile::file = "Graphics being processed (with prolog) to file
\"`1`\".";
System`PSFile2::file = "Graphics w/ zero margins processing with prolog to file
\"`1`\".";

Begin["System`Private`"]
PSFile[g_, f_String] := Block[{filename},
        filename = StringJoin[f, ".ps"];
        Message[PSFile::file, filename];
        Display[StringJoin[
                "! ",
                "psfix",
                " > ",
                filename
                ], g
        ];
]
PSFile2[g_, f_String, w_:5.0, h_:3.0] := Block[{filename},
        filename = StringJoin[f, ".ps"];
        Message[PSFile2::file, filename];
        Display[StringJoin[
                "! ",
                "psfix -lmarg 0 -rmarg 0 -bmarg 0 -tmarg 0 ",
                " -width ",ToString[ w], " -height ",ToString[ h],
                " > ",
                filename
                ], g
        ];
]
End[]

Protect[PSFile]
--------------------------
 
Brian also suggested to put the above codes into init.m file.

Thanks to you all, from down under of the earth.

--
Weimin Zhang (weimin@panda.levels.unisa.edu.au)
Newsgroups: sci.math.symbolic