Saturday, July 30, 2005

Matlab: create .eps for LaTex

print -depsc2 c:\temp\myeps.eps
This will save the top image window.

There is another matlab function that can create better eps file, at least for dot lines.
The best one I found is laprint.m. The matlab function create .m file and .tex file. It uses psfrag package in LaTex and this package can put the LaTex font on the .eps figures. Usage:
1. Plot Matlab figures and leave them there.
2. > set(0,'defaulttextinterpreter','none')
3. > laprint and the output name is 'gogo'
4. In LaTex:
\documentclass{article}
\usepackage{graphicx, color, psfrag}
\begin{document}
here comes psfrag.
\input{gogo.tex}
\end{document}

Remember to use (MiKTeX Package Manager) in future update.

DVI viwer cannot view the output well and try to use GSView4.7. Reason:
When viewing the output with a DVI previewer such as \pkg{dviwin} or \pkg{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 \emph{placing} the \pfg\ replacements on top of the figure

No comments:

Post a Comment