help-octave
[Top][All Lists]

## Re: LaTeX codes in plot text (titles, labels, etc.)

 From: Jordi Gutierrez Hermoso Subject: Re: LaTeX codes in plot text (titles, labels, etc.) Date: Mon, 26 Feb 2007 08:49:50 -0600

On 25/02/07, asha g <address@hidden> wrote:
I tried the psfrag option but as I am currently using
Linux, it says it works only with Windows - is that
true? Or is there a Linux version too.

Huh? Where did you read that? I myself was unaware that there was a
Windows version of it. ;-)

Actually, I can't see what would make psfrag depend on any platform.
It's just a bunch of hacks written in PostScript, and it relies on
dvips to do all the hacking. Oh, I suppose dvips might not be as
readily available in the non-free world, but of course it
theoretically should be available everywhere.

I also read that simply saying \psfragscanon
immediately before each relevant \includegraphics shd
do the trick. But it did not for me.

Well, psfrag is hacky, so you'll need to hack a bit more than that.
You must put some text into the .eps file as placeholder and then use
those placeholders withint your .tex source to refer to and replace
with psfrag. E.g. in the header you place

\usepackage{psfrag}

And then when you want to use it, you do something like

\begin{figure}
\psfrag{x2+3}{$x^2 + 3} \psfrag{sin th}{$\sin \theta}
\includegrpahics[width=2in]{thefigure.eps}
\caption{The figure has been psfragged}
\label{thefigure}
\end{figure}

Obviously the relevant part is the \psfrag commands, and thefigure.eps
has been previously labelled with two anchors: "2x+3" and "sin th",
either by Octave/gnuplot, or, say, by xfig.

Then you'll need to first run LaTeX on the .tex file, and then run
dvips on the .dvi file. If you want a pdf, you'll further have to run
ps2pdf on the resulting ps file. A Makefile could be useful if it
seems like you're going to be running through these steps many times.

This, btw, is getting offtopic for this list, but hopefully not
offtopic enough that we'll get yelled at.

HTH,
- Jordi G. H.