Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

To set the default scaling values for the \includegraphics command, one can use \setkeys{Gin}{(key)=value)} from the graphicx package. For example, say I put down

\setkeys{Gin}{width=.7\textwidth}

This will automatically scale all succeeding \includegraphics commands by the above width value. Is there a way to turn off this setting for certain graphics? That is, is there a way to still use \includegraphics without having the width set as the above?

I'm aware that

\begin{group}
\setkeys{Gin}{width=.7\textwidth}
\includegraphics{pizza.jpg} %this uses setted values
\end{group}
\includegraphics{pizza.jpg} %this uses normal values

works, but I'm wondering if I can do this without having to surround the \setkeys{Gin} command.

share|improve this question
    
\includegraphics[width=2cm]{pizza.jpg} (or the length you want) should override the default value. Never use \begin{group} and \end{group}. –  egreg Mar 15 '13 at 23:06
    
What I mean is that I want to \includegraphics{pizza.jpg} in its native setting, i.e., with absolutely no scaling values in place. Something like [width=2cm] only overwrites the scaling value with another one. –  Riem Mar 15 '13 at 23:09
add comment

1 Answer

up vote 1 down vote accepted

You can use the value stored in \Gin@nat@width, defining a handier interface to it:

\documentclass{article}
\usepackage{graphicx}

\setkeys{Gin}{width=30pt} % exaggerated for the example
\makeatletter
\let\ginnatwidth\Gin@nat@width
\makeatother

\begin{document}
\includegraphics{example-image-9x16}

\includegraphics[width=\ginnatwidth]{example-image-9x16}
\end{document}

enter image description here

share|improve this answer
    
Sorry, late response! Yes, this works perfectly. By extension, one can do the same for height as well. :) –  Riem Mar 18 '13 at 4:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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