0

I want to include one image (G0004.jpg) and I got the following error:

D:\Documents\HEIA\Physique\Analyse_spectrale\temp.tex:16: Dimension too large. [...cs[width=0.95\textwidth]{images/G0004.jpg}]
D:\Documents\HEIA\Physique\Analyse_spectrale\temp.tex:16: Dimension too large. [...cs[width=0.95\textwidth]{images/G0004.jpg}]
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{geometry} \geometry{ a4paper, margin=2.5cm }
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[squaren,Gray]{SIunits}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{tabularx}
\usepackage {array}
\graphicspath{ {images/} }
\begin{document}
\begin{figure}[htbp]
    \centering
    \includegraphics[width=0.95\textwidth]{images/G0004.jpg}
    \caption{caption}
    \label{fig:label}
\end{figure}
\end{document}

My picture Thx for your help

Schweinebacke
  • 26,336
Warok
  • 743

1 Answers1

1

Instead of

\includegraphics[width=0.95\textwidth]{images/G0004.jpg}

you should try

\includegraphics[width=\textwidth, height=0.9\textheight, 
                 keepaspectratio]{images/G0004.jpg}

Since the figure environment contains a caption but (apparently) no legend, it should suffice to set aside about 0.1\textheight to place the caption material.

Incidentally, since the float is almost certainly going to occupy an entire page, you might as well replace \begin{figure}[htbp] with \begin{figure}[p]. If nothing else, there'll be less code clutter.

Mico
  • 506,678
  • That's a good suggestion, but the example image is in landscape format (W:H = 700:600) and the paper is A4 (portrait) so this should not be the problem here. – Schweinebacke May 05 '17 at 09:54
  • @Schweinebacke - Thanks. Let's see if the OP provides more information about the natural dimensions of the file G0004.jpg. – Mico May 05 '17 at 10:31
  • @Mico your method will not works for one figure: \includegraphics[width=0.0009\textwidth, height=0.0009\textheight, keepaspectratio]{./figure/figure8/ab01} – acsdaswe Oct 30 '19 at 15:39
  • @acsdaswe - A message such as "your method will not work" is not all that specific and hence is not actionable. What exactly isn't "working"? Is LaTeX throwing an error message? If so, what does the message say? At any rate, I'm afraid I fail to understand your intended use case: What are you trying to achieve by displaying an image whose height and width dimensions are so minuscule as to make the image virtually invisible except under exceptionally high magnification? Please elaborate. – Mico Oct 30 '19 at 16:21