Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

6,908 views
Skip to first unread message

kkirtac

unread,
May 17, 2008, 6:32:45 AM5/17/08
to
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..

Enrico Gregorio

unread,
May 17, 2008, 7:08:31 AM5/17/08
to
kkirtac <kadir....@gmail.com> wrote:

Load graphicx only.

Ciao
Enrico

Heiko Oberdiek

unread,
May 17, 2008, 7:08:26 AM5/17/08
to
kkirtac <kadir....@gmail.com> wrote:

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 <ober...@uni-freiburg.de>

Randy Yates

unread,
May 17, 2008, 7:41:03 AM5/17/08
to
kkirtac <kadir....@gmail.com> writes:

> 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}

If this is graphicx.sty, then keepaspectratio requires a boolean
value. Try \includegraphics[width=3in,keepaspectratio=true]{fig1.eps}
--
% Randy Yates % "With time with what you've learned,
%% Fuquay-Varina, NC % they'll kiss the ground you walk
%%% 919-577-9882 % upon."
%%%% <ya...@ieee.org> % '21st Century Man', *Time*, ELO
http://www.digitalsignallabs.com

Message has been deleted

kkirtac

unread,
May 17, 2008, 8:12:19 AM5/17/08
to
Thank you all, the suggestions of Heiko was useful in particular, so i
conclude that babel(turkish) caused the problem..
Regards


Heiko Oberdiek

unread,
May 17, 2008, 2:23:43 PM5/17/08
to
kkirtac <kadir....@gmail.com> wrote:

> > This can be solved by using \shorthandoff:
> >
> > \shorthandoff{=}
> > \includegraphics[width=3in,keepaspectration]{fig1.eps}
> > \shorthandon{=}
>

> Thanks Heiko, this resolved the error. It arranges a 3in width figure
> space in the document and establishes the caption in the bottom, but
> the figure place is empty :S maybe the figure is not visible or...?

Perhaps you are using a DVI viewer that doesn't support PostScript
figures? Then convert to PostScript or PDF. Also assure that you
are using the right graphicx driver and that your driver supports
PostScript images (e.g., pdfTeX does not).

Yours sincerely
Heiko <ober...@uni-freiburg.de>

Robin Fairbairns

unread,
May 17, 2008, 6:03:08 PM5/17/08
to
Randy Yates <ya...@ieee.org> writes:
>kkirtac <kadir....@gmail.com> writes:
>
>> 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}
>
>If this is graphicx.sty, then keepaspectratio requires a boolean
>value.

no it doesn't: boolean keys default to true.
--
Robin Fairbairns, Cambridge

Randy Yates

unread,
May 17, 2008, 7:48:50 PM5/17/08
to
rf...@cl.cam.ac.uk (Robin Fairbairns) writes:

I assume you are correct, although the graphicx package documentation
doesn't really say that exactly. It defines each key uniquely, and all
boolean keys are defined to operate in this manner.

In either case, I was wrong and I am happy to be corrected.
--
% Randy Yates % "Bird, on the wing,
%% Fuquay-Varina, NC % goes floating by
%%% 919-577-9882 % but there's a teardrop in his eye..."
%%%% <ya...@ieee.org> % 'One Summer Dream', *Face The Music*, ELO
http://www.digitalsignallabs.com

Serhat Tadik

unread,
Apr 30, 2023, 10:36:31 PM4/30/23
to
17 Mayıs 2008 Cumartesi tarihinde saat 07:08:26 UTC-4 itibarıyla Heiko Oberdiek şunları yazdı:
I really appreciate you sharing this. Thank you so much!
0 new messages