4

Im trying to change the size of the picture with "scale" but is not working

\documentclass{report}

\usepackage{graphicx}
\usepackage[left=1.5cm,top=1cm,right=1.5cm,bottom=1cm]{geometry}
\begin{document}
\SweaveOpts{concordance=TRUE}


\begin{figure}[htb]
\begin{center}
\includegraphics[scale=0.5]{D:/R/pdf/pruebas/caratula3.jpg}
\end{center}
\begin{center}
\includegraphics[scale=1]{D:/R/pdf/pruebas/caratula3.jpg}
\end{center}
\end{figure} 

\end{document}

This is the image.

This is the image

Thanks!

5
  • A side note: Do not use the {center} environment in cases like this since it add additional vertical spacing. Better use \centering at the begin of the {figure} environment. Then everything inside will be centers too, but without (unwanted) extra spacing.
    – Tobi
    Aug 22 '16 at 15:25
  • I only see one image, whereas your code should produce two.
    – JPi
    Aug 22 '16 at 16:12
  • Mmm... tex distribution? i think that sweave. And I compile with the option "compile PDF" in RStudio Aug 29 '16 at 12:08
  • Sweave is an R programme that can take a mixture of latex and R, execute the R code and insert the result into a resulting latex file which is then compiled by latex. R and Latex gas nothing in common, you cannot compile a latex file without having installed a latex installation (in the same manner as Rstudio cannot compile R code without an R installation). Do we need to know which latex installation (and version you are using). Perhaps look at the top of the latex log file?
    – daleif
    Aug 30 '16 at 17:56
  • Sorry, I´, noob in this program. Can my version be "MiKTex 2.9"? Sep 1 '16 at 12:23
1

What do you mean it isn't working? What happens if you add an image with scale=1? Also, don't load graphics.

Consider the following:

\documentclass{report}

\usepackage{graphicx}
\usepackage[left=1.5cm,top=1cm,right=1.5cm,bottom=1cm]{geometry}
\begin{document}


\begin{figure}[htb]
\begin{center}
   \includegraphics[scale=0.5]{example-image-a}
\end{center}
\begin{center}
    \includegraphics[scale=1]{example-image-a}
\end{center}
\end{figure} 

\end{document}

enter image description here

5
  • 2
    thanks for the answer. with isnt working i mean "scale" does not modify the size of the image. And when i add an image with scale=1, both imagen remains the same Aug 22 '16 at 14:32
  • I don't understand your comment, sorry.
    – JPi
    Aug 22 '16 at 14:33
  • @MicaelSalomon remember to do as JPi did, load the same image with scale=0.5 and scale=1 in the same document. Otherwise, if the image is very large, might not see a difference. If it still does not work, then please let us see the image.
    – daleif
    Aug 22 '16 at 14:50
  • Ok, @daleif. I already try that and it doesnt work. Now im gonna put the image on the post. I hope you can help me Aug 22 '16 at 15:01
  • Also, I'm not sure it's a good idea to set negative margins in geometry, as you did.
    – JPi
    Aug 22 '16 at 15:25
0

I was facing the same problem (images not scaling with \includegraphics[scale=value]{image}).

In my case, I was unintentionally setting the default scaling values for the \includegraphics command, as detailed here: Turning off default scaling options (\setkeys{Gin}) temporarily

In my case, fixing the problem was as easy as removing the following line:

\setkeys{Gin}{width=<value>}

I hope others find this answer useful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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