MathGroup Archive 1999

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

Search the Archive

Re: Exporting PRINT results from Mathematica to other applications

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18859] Re: Exporting PRINT results from Mathematica to other applications
  • From: paulh at wolfram.com (P.J. Hinton)
  • Date: Thu, 22 Jul 1999 22:57:52 -0400
  • Organization: Wolfram Research, Inc.
  • References: <7n68sa$gua@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <7n68sa$gua at smc.vnet.net>, hanssen at zeiss.de writes:

> recently, there was a thread "Exporting  results from Mathematica to 
> other applications" in this group, e.g. mg17737, mg17672.
> We learned from it, first to convert output cells to OutputForm using 
> the ConvertTo command. Later one has to select and use 
> Edit>Copy as>Text.
> 
> If one does this with cells generated with Print, which also contain
> formatted numbers (e.g. generated with one or the other option of
> PaddedForm or 100*Round[#/100]& etc), the well formatted numbers are 
> sometimes extended with insignificant digits and the proper formatting 
> is gone. I have not yet found out, when exactly this happens, at
> least it is highly undesireable.
> 
> Any idea, how to avoid around this (it happens in Matheamtica 3.0.1.1x,
> what about Mathematica 4)? 

I suspect that the problem you are encountering is a ramification of
using StandardForm as your default output format type.  You can force
plain text to be used in Print and other kernel output cells by clicking
on the front end menu command sequence 

	Cell -> Default Output Format Type -> InputForm

or by evaluating an appropriate SetOptions[] command.

sets option on a global level

	SetOptions[$FrontEnd, 
          CommonDefaultFormatTypes -> {"Output" -> OutputForm}]

sets option on an individual notebook level

        SetOptions[EvaluationNotebook[],
          CommonDefaultFormatTypes -> {"Output" -> OutputForm}]          

If you wish to retain StandardForm for output, you could write an
override function for Print[] that does something similar to the
OutputForm.

Unprotect[Print]?

Remove[Print]

System`Print[expr___] := 
  CellPrint[
    Cell[TextData[StringJoin[Map[ToString[#, OutputForm] &, {expr}] ]], 
      "Print"]]

Protect[Print]

--
P.J. Hinton	
Mathematica Programming Group		paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.


  • Prev by Date: How to prevent the saving dialog box ...
  • Next by Date: Re: Slow Version 4 Front End
  • Previous by thread: Exporting PRINT results from Mathematica to other applications
  • Next by thread: Re:Exporting PRINT results from Mathematica to other applications