2

I have been trying to figure out the best way to include vector plots from Matlab in Latex. I rounded on to matlabfrag, which is relatively straight forward compared to matlab2tikz.

Somehow, I am not even able to reproduce a basic example. I followed the matlabfrag example from here. In Matlab,

plot(1:10) ; title('help')
matlabfrag('fragtest')

foo.tex :

   \documentclass{article}
   \usepackage{pstool}
   \begin{document}
   \psfragfig{fragtest}
   \end{document}

Compiled with: pdflatex -shell-escape foo.tex. On compilation, I get a blank document with following message: enter image description here

As suggested, I looked into the fragtest-pstool.log file and it contained the following errors:

! Illegal unit of measure (pt inserted).
<to be read again> 
                   e
l.22  \includegraphics [] {fragtest}

Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
                   e
l.22  \includegraphics [] {fragtest}

Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

I searched regarding this error with respect to psfragfig, but could not find any relevant solution. The similar problem is faced and report by someone here [in German]. But they do not mention the solution explicitly. Can someone help me on this? I spent the last two days completely on this issue.

2

This is not a tested solution, but just the translation of an answer on de.comp.text.tex to a similar problem (at least generating the same error).

The error is generated by matlabfrag-pstool.tex: Font sizes are given in exponential notation, which is not acceptable to LaTeX. The is the result of an error in the matlab code, which I have corrected and mailed to the author. [Matthias Pospiech, 10 Oct 2010]

Try to download the latest version of matlabfrag from https://github.com/zprime/matlabfrag (v0.7.0devb04 30-May-2013). At the other download sites that I found matlabfrag is older than the posting above, so doesn't contain the bug fix (if it was fixed indeed).

  • True. Inside the tex file related with the eps file, there was line with \fontsize{1.320000e+01}{1.320000e+01}, which is an invalid Latex unit. Therefore, modifying the font size to an integer or latex valid unit solved the issue. – Sathish Sanjeevi Dec 27 '16 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.