MathGroup Archive 2003

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

Search the Archive

Re: TeXForm for Plot command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39151] Re: TeXForm for Plot command
  • From: "John Jowett" <John.Jowett at cern.ch>
  • Date: Fri, 31 Jan 2003 04:37:25 -0500 (EST)
  • Organization: CERN
  • References: <b183n2$kgk$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,
       Several years ago, I found it convenient to do something like this:

Unprotect[TeXForm];

graphicsCount=0;

TeXForm[p_Graphics]:=Module[{epsFileName},
    graphicsCount++;
    epsFileName="graphics"<>ToString[graphicsCount++]<>".eps";
    Export[epsFileName,p,"EPS"];
    "\includegraphics{"<>epsFileName<>"}"
    ];

Protect[TeXForm];

I.e., redefine the way TeXForm deals with Graphics objects.  You would need
similar definitions for any other types of Graphics that you need (e.g.
Graphics3D).

Then

TeXForm[Plot[Sin[x],{x,0,1}]]

creates an EPS file and returns a fragment of LaTeX code that you can paste
into your document.

You might want to improve upon it by adding the options of \includegraphics
as options of TeXForm, creating the whole figure environment, etc.

Another way is to use File/Save As Special ../TeX to get a TeX form of a
whole notebook and then pick out the EPS files and other material that you
need.

John Jowett

"Jochen Rädler" <jochen.raedler at gmx.de> wrote in message
news:b183n2$kgk$1 at smc.vnet.net...
> Hi, all!
>
> I'm student and using mathematica 4.0.
> At the moment I have to write a report for my university. I want to use
> LaTeX to write this document. Since I do a lot of calculations with
> mathematica I use the TexForm[...] (//HoldForm) command to get a latex
> output. I just copy/paste the output; it works quite well.
> But then I wanted to include some plots from mathematica in my latex
> document. If I apply it to Plot[...]: e.g.: "TeXForm[Plot[Sin[x], {x, -Pi,
> Pi}]]" I get a strange outputs.
>
> Is it possible to get a LaTeX package, which compiles these instructions?
Or
> is this output just nonsense? Are there other possibilities than using
"copy
> as bitmap" to get my plot into the latex document?
>
> Perhaps anyone had similar problems or knows a useful link.
>
> Thanks,
> Jochen
>




  • Prev by Date: Re: Re: Gaussian intersection
  • Next by Date: Re: mathematica on a palmtop?
  • Previous by thread: Re: TeXForm for Plot command
  • Next by thread: input without output