help-octave
[Top][All Lists]

## Re: Latex Fonts and Octave

 From: Thomas Markovich Subject: Re: Latex Fonts and Octave Date: Thu, 26 Mar 2009 20:00:00 -0500

So I tried your solution and I don't think it worked out to what I needed but I also think that my description of the problem was poor.


My tex file includes images, they used to be .ps files and so I used the psfrag package to have consistent fonts on my axis labels as I did with my paper. The jphyschem requires that all figures be in .tiff or .pdf format, so then I would have to include those in a .tex file but when submitted with the standard gnuplot fonts, they rejected it because of dissimilar fonts. What I'm looking for is a way to implement latex fonts in pdf images of each figure.


I create the pdf images by generating a .ps file and then converting to .pdf. In the creation of the first image, I need to use the latex fonts (for both \varphi and V_+) because the jphyschem didn't like it using helvetica. I looked online alot for how to use latex fonts in octave graphs because I remember seeing it in the thread but I can't find them now.

Right now, I'm on mac osx and octave 3.0.3.

On Mar 26, 2009, at 7:50 PM, Ben Abbott wrote:



On Mar 26, 2009, at 7:56 PM, Ben Abbott wrote:


On Mar 26, 2009, at 5:51 PM, Thomas Markovich wrote:


On Mar 26, 2009, at 4:10 PM, Ben Abbott wrote:


On Thursday, March 26, 2009, at 02:49PM, "Thomas Markovich" <address@hidden

wrote:



Hi all,

I have googled around for about a day and haven't figured out how
to
use latex fonts in octave.

What I am doing right now is using psfrag to replace fonts from
within the latex document with the graphics all being saved as
postscript files. This worked wonderfully; unfortunately the
journal

that we are submitting to doesn't accept postscript files. Instead,
they want everything to be pdfs. To do this what I have to do is
convert the postscript to the pdf so that I have it in the right
format but I lose the functionality of psfrag. To work around
this I
have tried to use octave to generate plots for me with the fonts
but

they aren't very pretty and what's more, the axis labels wander off
the graph when I make them big enough to be seen.

So, is there a way to use latex fonts (so they're consistent with
my
paper) in the generation of pdfs? and is there a way to move my
axis

label up? (our x axis label is \varphi but half of it gets cut off
when the size is set to 18)

I am currently using

x = [-2:0.01:2]*pi;

xtick = [-2,-1.5,-1,-0.5,0,0.5,1,1.5,2] * pi;


xticklabel = { '{/Symbol -2p}', '{/Symbol -3p/2}', '{/Symbol - p}', '{/Symbol -p/2}', '{0}', '{/Symbol p/2}', '{/Symbol p}', '{/ Symbol
3p/2}', '{/Symbol 2p}'};

plot (potential1(:,1),potential1(:,2),'k','linewidth',5);
set (gca, 'xtick', xtick, 'xticklabel', xticklabel);
axis([-7,7,-1.1,1.3])
set(0,"Defaulttextfontsize",18)
xlabel('\varphi');
ylabel('V_+(\varphi)');
print('figures/potential1.ps','-deps')


to generate my functions but unfortunately there's no pretty fonts.

Thanks,

Thomas Markovich


Regarding the pdf requirement, do you imply that your publisher is
using pdflatex, or that he requires the manuscript to be submitted
as a pdf document?

If you need a figure compatible with pdflatex, the only solution I
can think of is a little *hack*.

octave:1> plot (1:10)
octave:2> drawnow ("latex", "test.tex")

Be aware, due to limitations of the latex terminal, gnuplot might
complain. The resulting file "test.tex" is a LaTeX picture.

Ben



I'm not sure what the pdflatex thing is but they require that all
images be either pdf or tiff and the manuscript be submitted as
a .tex file. (Its the journal of physical chemistry) and psfrag
doesn't work for either one. My advisor told me that pdf was
absolutely preferred. I tried your 'hack' but it didn't give it to
me in any way I knew to get it working.


pdflatex is unable to include ps/eps-files. In reciprocal fashion,
normal latex is unable to include pdf-files.

The TikZ and pgf approaches offer a solution to this conundrum.

http://www.texample.net/tikz/examples/

Unfortunately, I don't see this as a solution to your present problem
(there is not TikZ/pgf terminal for gnuplot).

Back to the "test.tex" file ... it is intended for LaTeX picture
environment.

http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/ltx-43.html


I do not know if it will properly render your figure, but it is simple enough to try. The LaTeX commands below will produce a picture that is
6.4x4.8 inches.

\documentclass[onecolumn,12pt,letterpaper]{article}
\begin{document}
\begin{figure}
\begin{center}
\setlength{\unitlength}{2.54cm}
\begin{picture}(6.4,4.8)
\input{test.tex}
\end{picture}
\end{center}
\caption{The figure's caption goes here.}
\label{fig:label_for_ref}
\end{figure}
\end{document}

This works for the example "plot(1:10)", but you'll need to verify it

Ben


p.s. Pls "reply-all" and respond below to make it easier for others to
read along.



Thomas, in the event your problem isn't solved, please let us know what OS your are running (WIndows, Mac OSX, or which Linux variety).

Ben