Latex Fonts and Octave

Ben Abbott bpabbott at mac.com
Thu Mar 26 18:56:05 CDT 2009


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" <thomasmarkovich at gmail.com 
>> > 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  
works for your purposes.

Ben

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




More information about the Help-octave mailing list