MathGroup Archive 2003

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

Search the Archive

Specifying plain text output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39549] Specifying plain text output
  • From: carlos at colorado.edu (Carlos Felippa)
  • Date: Sat, 22 Feb 2003 03:38:50 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I am converting an old code written 8 yrs ago in Mathematica 2.2 to
4.2, and would like to keep the same plain text tabular output.  
To see what I mean, consider the 2.2 fragment

PrintNodeCoordinates[xyzcoor_]:= Module[
  {numnod=Length[xyzcoor],t,n,c},
   t=Table["   ",{numnod+1},{4}]; 
   For [n=1,n<=numnod,n++,c=xyzcoor[[n]]; 
       If [Length[c]<=2, AppendTo[c,0]];
       If [Length[c]==1, AppendTo[c,0]];
       t[[n+1,1]]=ToString[n];
       t[[n+1,2]]=PaddedForm[c[[1]]]; 
       t[[n+1,3]]=PaddedForm[c[[2]]];
       t[[n+1,4]]=PaddedForm[c[[3]]];
   ];
   t[[1]] = {"node","x","y","z"};
   Print[TableForm[t,TableAlignments->{Right},
           TableDirections->{Column,Row},TableSpacing->{0,1}]];
   ];         
PrintNodeCoordinates[
  {{2,3,2000},{5,a+b,168.09},{x_dir,y_dir,z_dir}}];

The output from 2.2 is

 node  x     y     z
 1     2     3     2000
 2     5    a + b  168.09
 3    x_dir y_dir z_dir

What you see is exactly what you get if you move the output cell
to another program like TeX, e.g. for verbatim display.
Running this under 4.2 gives a messy output.  Saving the output
cell with Save Selection As  -> Plain Text I see

\!\(\*
  TagBox[GridBox[{
        {"\<\"node\"\>", "\<\"x\"\>", "\<\"y\"\>", "\<\"z\"\>"},
        {"\<\"1\"\>", 
          TagBox[
            InterpretationBox["\<\" 2\"\>",
              2,
              Editable->False],
            PaddedForm], 
   
<30+ more lines snipped, you get the idea>

How can I get exact plain text output?   I looked for something 
like a TextForm or PlainTextForm filter, so I could say

  Print[PlainTextForm[TableForm[t,TableAlignments->{Right},
           TableDirections->{Column,Row},TableSpacing->{0,1}]]];

but found nothing in the 4.2 help file. Is there a way?


  • Prev by Date: Display of legend in MultiListPlot
  • Next by Date: Re: Finding the closest number from a list
  • Previous by thread: Re: Display of legend in MultiListPlot
  • Next by thread: Comment lines in different colour or font