# everytime I put a figure, latex puts this huge space between the figure and the next text

I have a huge problem with the figures in my report, I don't know why everytime I put a figure, latex puts this huge space between the figure and the next text. here's an example:

    \documentclass[a4paper,openany,pdflatex,12pt]{book}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}
\usepackage[francais]{layout}
\usepackage[T1]{fontenc}

%\usepackage{a4wide}
%---PACKAGES-------------------------------------------------------------------
\usepackage{makeidx} \makeindex
\usepackage[Lenny]{fncychap}                        % Lenny, Conny ,Bjarne, ejne, Glenn, Sonny
\usepackage{fancyhdr}
\usepackage{fancybox}
%\usepackage{inputenc}
\usepackage{eurosym}
\usepackage{lastpage}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{a4wide}
\usepackage[french]{minitoc}
\usepackage{lettrine}
%\usepackage[hmargin=2cm,vmargin=3cm]{geometry}
%\usepackage{color}
\usepackage{color,framed}
\usepackage{stmaryrd}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{mathrsfs}
\usepackage[left=2cm,right=2cm,top=3cm]{geometry}
%\usepackage{titletoc} % pour la table des matières
%\usepackage{fourier}
%\usepackage{courier}
%\usepackage{setspace}
%\usepackage{ulem} % pour les textes souligné

%---------- LES-COMMANDES --------------------------

\newcommand{\thecompte}{\roman{compte}}
\newcommand{\K}{\mathbb{K}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\Z}{\mathbb{Z}}

\newcommand{\implique}{\Longrightarrow}
\newcommand{\equivalent}{\Longleftrightarrow}
\newcommand{\reunion}{\displaystyle\bigcup}
\newcommand{\intersection}{\displaystyle\bigcap}
\newcommand{\vers}{\longrightarrow}
\newcommand{\inter}{\cap}
\newcommand{\union}{\cup}
\newcommand{\A}{\forall}
\newcommand{\E}{\exists}
%---THEOREMES-------------------------------------------------------------------

\usepackage{ntheorem}
\theoremstyle{break}
{\theorembodyfont{\upshape}
\newtheorem{exo}{Exercice}}
\newshadetheorem{thm}{Th\'eor\eme}[section]
\newtheorem{df}{D\'efinition}[section]
\newtheorem{rmq}{Remarque}[section]
\newtheorem*{proof}{Preuve}
\newtheorem{ex}{Exemples}
%\newtheorem*{nota}{Notations}
\newtheorem{pb}{Probl\eme}

%----En t\^ete et pied de page ------------

\pagestyle{fancy} \fancyhf{} % efface tout ce qu'il y avait avant
% LO = gauche/impair ; RE = droite/pair
\fancyhead[RO,LE]{\rightmark} % RO = droite/impair ; LE = gauche/pair
\fancyfoot[C]{\thepage} % C = centré
\renewcommand{\footrulewidth}{2pt}

\begin{figure}[!h]
\centering
\includegraphics[width=17 cm]{recouvrement.png}
\caption{}
\end{figure}


Edit (by touhami: answer converted here)

@touhami in some places here's what happens, even the other texts which are not part of the figure are not in place. SO i don't really think it's matter of space inside the figure, because i changed all my figures making sure there's no excess of white space, but the problem remains!!

• The space is a result of some tex code in your file, if you do not show the code it is very hard to guess what is causing it. – David Carlisle Jun 12 '16 at 22:08
• The most probable cause is white space in the image. Try doing \fbox{\includegraphics[<options>]{<file>}} (use the real options and file name) and you'll see what TeX thinks the dimensions of the image are. – egreg Jun 12 '16 at 22:20
• the packages are not that relevant to your problem which is either white space in your image file or specified in your document, but looking at your packages, you load a4wide twice (once is more than enough:-) you load inputenc twice you loac color twice you load graphics twice (as it is included by graphicx) – David Carlisle Jun 12 '16 at 22:35
• in the \figure your first command is \centering. but the graphic isn't centered -- it's left-aligned. to me that says there is excess white space, and if there is excess white space on the right, there is almost certainly some at the bottom as well. try enclosing it in an \fbox (as already suggested by egreg) to see what's really there. – barbara beeton Jun 13 '16 at 0:32
• @LAILA yes your right the problem is not as i think. Please add an example that compile and produce the problem. – touhami Jun 14 '16 at 22:22

First, as a man who has been typesetting French documents in France, I strongly recommend using direct Unicode input of your accented chars. Instead of \c ca br\^ ule, write ça brûle as usually; you have \usepackage[utf8]{inputenc} on your side!

Second, for an MWE, get rid of all those extra packages. See if any of them is causing trouble. For example, shadbox was not even present on my system (TeXLive 2016), so I commented it out.

And this is a thing that works normally (with your preamble without that shadbox line):

\begin{document}

La plume de ma tante...

\begin{figure}[!h]
\centering
\includegraphics[width=17 cm]{recouvrement.png}
\caption{La plume que ma tante utilise quotdiennement (en coupe) pour créer des titres qui occupent plusieurs lignes}
\end{figure}

...est sur le bureau de mon oncle.
\end{document}


Are you sure your PNG file does not have any borders? I used this file as recouvrement.png (guaranteed to have no redundant borders; see how it almost occupies the width of your document):

I do suspect that the PDF or PNG graphics might have white borders (if they were produced in an unorthodox way). Try the PNG image above and see if it helps.