Re: "Package keyval error" in loading figure to LaTeX document.



kkirtac <kadir.kirtac@xxxxxxxxx> wrote:

Hi, i have mikTeX 2.7 installed and am using WinEdt for editing. I
created my figure in matlab and saved as 'fig1.eps' and moved it to
the same directory with my .tex document. I try to load it in my .tex
document by,

\begin{figure}
\includegraphics[width=3in,keepaspectratio]{fig1.eps}\\
\caption{dummy} \label{fig1}
\end{figure}

i compile it with latex command but always receive the error :
'Package keyval error: width=3in undefined.' I have both included
graphics, graphicx and epsfig packages..need help, thanks in advance..

A minimal example would be helpful, probably the catcode of `=' is
different than the usual catcode 12/other.
For example, some languages use `=' as shorthand in babel
(turkish, ...). Then the equal sign has catcode 13/active.
This can be solved by using \shorthandoff:

\shorthandoff{=}
\includegraphics[width=3in,keepaspectration]{fig1.eps}
\shorthandon{=}

Or the key value parser of package `kvsetkeys' can be used:

\documentclass{article}
\usepackage[turkish]{babel}
\usepackage{graphicx}
\usepackage{kvsetkeys}
\let\setkeys\kvsetkeys

\begin{document}
\section{Hello World}
\begin{figure}
\includegraphics[width=3in,keepaspectratio]{s1.png}
\caption{dummy}\label{fig1}
\end{figure}
\end{document}

Yours sincerely
Heiko <oberdiek@xxxxxxxxxxxxxxx>
.