Wednesday, April 20, 2011

Figures in LaTex documents

I ran into some problems inserting figures in a LaTex document in TexnicCenter using the LaTex=>PDF configuration. When you create direct pdfs you will be using pdflatex binary, which does only deal with jpg, png image files. In the process you will loose image quality and sometimes encounter other problems; well, I had such a problem where I could not properly span my figure to column width in a two column document.

When you insert figures in your LaTex document it is better to create .ps files (LaTex=>PS) as the quality of your images will be preserved. In this configuration, you have to use image files in .eps format. Use GIMP software to convert your image files into .eps format. Also, it is better if you drag the file into GIMP so that you do not have to worry about the size of your image. And then save it in the .eps format.

So, once you create the .ps file use GSView software to convert it to .pdf files. In the process of installing GSView you will be required to install Ghostscript software as well.

A very simple code for inserting a figure in LaTex would look like this.

\section{Methodology}
The schematic diagram of the proposed system is given in Fig.~\ref{fig:robot}
\begin{figure}[htb]
 \begin{center}
  \includegraphics[width=\columnwidth]{images/robot.eps}
  \caption{Some figure}
  \label{fig:robot}
 \end{center}
\end{figure}


Do not forget to include
\usepackage{graphicx}
at the top 

No comments:

Post a Comment