Wednesday, September 11, 2013

MATLAB figures in LaTeX

Hey,

Here is how it is done.

  1. Open you figure file in MATLAB
  2. Goto File->Export Setup...->
  3. Apply you modifications like converting to grayscale etc. (Rendering->Colorspace)
  4. Choose "Export"
  5. In "Save as type" choose EPS
  6. Now you can use this EPS file in you .tex file:
    \begin{figure}[t]
    \begin{center}
    \includegraphics[width=\columnwidth]{figure.eps}
    \caption{my caption}
    \label{fig:system}
    \end{center}
    \end{figure}

    and choose latex->ps->pdf in your project builder (e.g. in TeXnicCenter)


    Or if you want to convert this to pdf use the epstopdf utility that comes with MikTeX in the command prompt:

    epstopdf figure.eps

    and use it like this:

    \begin{figure}[t]
    \centering
    \includegraphics[width=columnwidth]{figure.pdf}
    \caption{my caption}
    \label{fig:system}
    \end{center}
    \end{figure}


    Note:
    For some reason, direct export to pdf does not preserve the figure size.

    No comments:

    Post a Comment