[Tex/LaTex] Replacing labels in EPS file by LaTeX – text not where it should be


I am spawning a .eps file with octave by using this .m file:

function dummy
xlim([0 81]);
x = [0:0.01:81];
plot (x,y*1.85,"-;aaaa;",'linewidth',2,x,y*1.00,"-;bbbb;",'linewidth',2,x,y*1.25,"-;cccc;",'linewidth',2,x,x/2,"-;dddd;",'linewidth',2);
legend ("location", "northwest");
xlabel ("kkkk");
ylabel ("yyyy");
set (gca (), "xtick",[]);
set (gca (), "ytick",[]);
set (gca (), "fontname","DejaVuSans");
print('-dtex', 'dummy.tex');

and including it with this LaTeX "container":


    % You can run this by typing the following commands:
    %    latex 2dplot.tex
    %    dvips -o 2dplot.ps 2dplot.dvi


% The syntax of the "psfrag" command is:
%    \psfrag{tag}[<posn>][<psposn>][<scale>][<rot>]{replacement}
% See the file pfgguide.ps for full documentation.

\psfrag{bbbb}{\small{$s_1 \cdot y$}}
\psfrag{cccc}{\small{$s_2 \cdot y$}}
\psfrag{dddd}{\small{$k(\Sigma + n + g)$}}


But the psfrag replacements show up at bottom left corner of the page.
Running latex ./dummy.tex does not yield any errors.

Best Answer

The replacements not showing on the actual picture are OK. From the psfrag manual:

When viewing the output with a DVI previewer such as dviwin or xdvi, a vertical list of the replacements will be placed on the left side of each figure. This list allows you to check the typesetting of your replacements; it disappears in the final PostScript version. Unfortunately, DVI drivers are incapable of placing the PSfrag replacements on top of the figure, so for that you will need to print it or use a PostScript previewer like GhostView

You should convert your dvi to ps or pdf or print it in order for the replacements to apply.

Related Question