1

I want to include this image (shown below) at the right side of my page, surrounded by text. But I got the following error

! Dimension too large.<argument> \wd \@tempboxa l.291 ...phics[width=3cm, height=5cm]{vinyeta.jpg}
! Dimension too large.<argument> \ht \@tempboxa l.291 ...phics[width=3cm, height=5cm]{vinyeta.jpg}

I am using this code

\documentclass[12,twoside]{mammeTFM}
\usepackage{amsthm,amsmath,amssymb,amsfonts,amscd}
\usepackage{graphicx}
\usepackage{wrapfig}
\graphicspath{ {./images/} } %Images' path, for efficiency.
\usepackage{enumerate}
\usepackage[all]{xy}
\usepackage{booktabs}
\begin{document}
\begin{wrapfigure}{R}{5cm}
    \centering
    \includegraphics[width=3cm, height=5cm]{vinyeta.jpg}
\end{wrapfigure}
\end{document}

enter image description here

Bean Guy
  • 113
  • With [width=\textwidth] there is no space left for text. Not to mention the \columnsep gap. – John Kormylo Sep 26 '20 at 14:27
  • @JohnKormylo I changed the code, so its more realisitc. I tried to insert a \rule{3cm}{7cm} and worked perfectly, but with the images is not working. – Bean Guy Sep 26 '20 at 22:11
  • 1
    Your example does not match your error messages. Your error comes from an \includegraphics command with "keepaspectratio" in its options. Show that command. – Donald Arseneau Sep 27 '20 at 00:39
  • @DonaldArseneau I corrected the error, I edites my wrapfigure environment multiple times, that's why the error was not matching the example. – Bean Guy Sep 27 '20 at 07:32
  • Those errors don't come from wrapfigure though, they come from \includegraphics with something wrong in the arguments. – Donald Arseneau Sep 27 '20 at 07:49
  • 1
    I think that the issue is due to the particular JPG file. – egreg Sep 27 '20 at 07:56
  • @egreg That made the trick. I changed the format from JPG to PNG and now it is working perfectly. – Bean Guy Sep 27 '20 at 08:21
  • @BeanGuy Conversion from JPG to PNG is to avoid, in general; you need to fix the JPG instead. – egreg Sep 27 '20 at 08:33
  • Did you save your image with ImageMagick? https://tex.stackexchange.com/a/243791/5763 – Martin Schröder Oct 04 '20 at 09:54

1 Answers1

1

It seems that some cameras will add metadata to the image that provokes this error message. The most expedient way to fix this is to remove the nonessential metadata.

If you have the exiftool package installed, this is easy:

exiftool -all=  -overwrite_original myimage.jpg
Frotz
  • 378
  • 2
  • 12