MathGroup Archive 1991

[Date Index] [Thread Index] [Author Index]

Search the Archive

PS printing/dumping from Mathematica

  • To: mathgroup at ncsa.uiuc.edu
  • Subject: PS printing/dumping from Mathematica
  • From: Markus.Lautenbacher at physik.tu-muenchen.de
  • Date: Wed, 20 Feb 91 14:56:28 +0100

Recently there has been quite a bit of a discussion on the handling of
Mathematica's PostScript (PS) output in this newsgroup.

I have stumbled over this "problem" already a few months ago and worked my
way around it by (re)writing two Mathematica (UNIX version) routines that

1. allow printing Mathematica graphics on a PS printer of your choice.
(which is a nice thing if you are working in a networked environment
with a number of PS printers available.)
This is done by my rewritten version of the standard Mathematica
routine "PSPrint[]".
By the way, the standard "PSPrint" should still work since it has only one
argument but my version needs two.

2. allow dumping a Mathematica graphics in a user defined file that
includes the necessary PS macro definitions and therefore is suited to be
printed or to be included in documents after the Mathematica session
has been finished.
This is done by my new routine "PSDump[]".

The two functions are defined in the startup file "init.m" located in
my home directory:

--- snip --- snip --- snip --- snip --- snip --- snip --- snip --- snip ---
(* 
 * MATHEMATICA Startup File,
 * Wed Dec 19 10:29:02 MET 1990, Markus at T31
 *)  

(* Load Default Mathematica Init File *)
<< /usr/math/Init/init.m   


(* Redefine PSPrint function *)
Unprotect[PSPrint]
System`PSPrint::usage =
"PSPrint[-graphics-, \"printer\" ] sends graphics to the printer `printer'. 
\nTo ensure proper operation enclose the printer name in double quotes."
Begin["System`Private`"]
PSPrint[x_,P_] := ( 
                    Display[StringJoin["!psfix | lpr -P",ToString[P]], x];
                    Print[ "PSPrint: ", x, " sent to printer `", P, "'" ] 
                  )
End[]
Protect[PSPrint]

(* Define PSDump function *)
System`PSDump::usage =
"PSDump[-graphics-, \"filename\" ] sends graphics to the file `filename'.
\nTo ensure proper operation enclose the file name in double quotes."
Begin["System`Private`"]
PSDump[x_,y_] := ( 
                   Display[ StringJoin[ "!psfix > ", ToString[y]], x]; 
                   Print[ "PSDump: ", x, " sent to file `", y, "'" ] 
                 )
End[]
Protect[PSDump]

Print[" -- ~/init.m loaded --"] 
--- snip --- snip --- snip --- snip --- snip --- snip --- snip --- snip ---


Hope this helps,
                MARKUS

+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#   MARKUS E. LAUTENBACHER,                                               #
#      office:  Technical University Munich, Physics Department           #
#               Theoretical Physics T31, D-8046 Garching, FRG             #
#               phone: 0049/89/3209-2398                                  #
#               INTERNET: lauten at t30.physik.tu-muenchen.de                #
#-------------------------------------------------------------------------#
#   SIR ERNEST RUTHERFORD:  `Science is physics, and the rest is          #
#                            stamp collecting'                            #
#   Surely Rutherford (1871-1937) knew nothing about computers! ;-)       #
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+





  • Prev by Date: New Message and Files
  • Next by Date: Integrate bug
  • Previous by thread: New Message and Files
  • Next by thread: Integrate bug