Graphics, Figures & TablesAbnormal space between two paragraphs

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
phil_1264
Posts: 4
Joined: Sun Apr 25, 2010 3:27 am

Abnormal space between two paragraphs

Post by phil_1264 »

I am writing my master thesis on LaTeX and I learned how it works 14 days ago. Nevertheless, I was able to get everything sorted out except one problem. I tried past solutions I've read on this forum but for some reasons I ignore, it doesn't correct my problem.

I've put a table between two paragraphs (using the table environment to make it float) and I was clearly happy to see it move on the next page (something Word won't do !). BUT, when I saw the space it left between my two paragraphs, I lost that happiness.

Here is a MWE where you can see my problem :
Warning ! Long code ... I kept every thing I thought might be of some help.

Code: Select all

\documentclass[12pt,oneside]{book}

\usepackage{setspace}  % package pour la taille des interlignes
\usepackage{latexsym}
\usepackage{multirow} % allow multirow
\usepackage{dcolumn} % allow to center a table on the decimal point
\usepackage{booktabs}  % allow professionnal table presentation (toprule midrule bottomrule)
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage{fancyhdr}  % package pour mettre le nom des chapitres en haut de chaque page
\usepackage[francais]{babel}

\textheight=22cm \textwidth=14cm \oddsidemargin=2.25cm \topmargin=-20pt
\parskip=10pt	%Saut entre les paragraphes
\parindent=0pt % Pour enlever toute indentation de début de paragraphe.

\begin{document}
\onehalfspacing  % Interligne 1,5

Some text here to create a paragraph in which I discuss results I have printed in Table 1. 

\begin{center}
\begin{table}[!tp]\footnotesize
\caption[Short title]{\textbf{Official title} \\{\small Here we have a long long description of this table ... it should take from 5 to 10 lines once printed }\\}
\begin{tabular*}{1\textwidth}{@{\extracolsep{\fill}}  c  D{,}{,}{-1} D{,}{,}{-1}  D{,}{,}{-1} D{,}{,}{-1}  }
\toprule
 & \multicolumn{2}{c}{États-Unis} & \multicolumn{2}{c}{Canada} \\
\multirow{2}{*}{Année} & \multicolumn{1}{c}{Consensus} &\multicolumn{1}{c}{Pourcentage} &  \multicolumn{1}{c}{Consensus} &\multicolumn{1}{c}{Pourcentage} \\
\midrule
2007 & 2,31 & 8,8 & 2,25 & 8,2 \\
2008 & 2,25 & 7,0 & 2,18 & 7,5 \\
2009 & 2,32 & 7,8 & 2,26 & 8,8 \\
\midrule
Total & 2,15 & 4,7 & 2,22 & 8,8 \\
\bottomrule
\end{tabular*} 
\end{table} 
\end{center} 

The paragraph after my floating table. Spacing with the previous paragraph should be 10pt (as parskip command) ... But it appears to be 40pt !?!?!?

\end{document}
I tried to put % after all \end command as suggested somewhere in this forum, but it didn't worked. I have the same problem when using the {figure} environment, so I believe it's something I'm not doing correctly with the floating feature of those environment.

I use MiKTeX 2.8 on a Windows 7 PC for those who want to know. (I used to work with LyX but I just didn't like the WYSIWYM concept ... I prefer to work with the raw material)

Thanks,
Last edited by phil_1264 on Sun Apr 25, 2010 4:32 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Abnormal space between two paragraphs

Post by frabjous »

For starters, I'd take out the center environment (which doesn't seem to be doing anything here), and comment out the paragraph breaks before and after the table:

Code: Select all

\documentclass[12pt,oneside]{book}

\usepackage{setspace}  % package pour la taille des interlignes
\usepackage{latexsym}
\usepackage{multirow} % allow multirow
\usepackage{dcolumn} % allow to center a table on the decimal point
\usepackage{booktabs}  % allow professionnal table presentation (toprule midrule bottomrule)
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage{fancyhdr}  % package pour mettre le nom des chapitres en haut de chaque page
\usepackage[francais]{babel}

\textheight=22cm \textwidth=14cm \oddsidemargin=2.25cm \topmargin=-20pt
\parskip=10pt   %Saut entre les paragraphes
\parindent=0pt % Pour enlever toute indentation de début de paragraphe.

\begin{document}
\onehalfspacing  % Interligne 1,5

Some text here to create a paragraph in which I discuss results I have printed in Table 1. 
%
\begin{table}[!tp]\footnotesize
\caption[Short title]{\textbf{Official title} \\{\small Here we have a long long description of this table ... it should take from 5 to 10 lines once printed }\\}
\begin{tabular*}{1\textwidth}{@{\extracolsep{\fill}}  c  D{,}{,}{-1} D{,}{,}{-1}  D{,}{,}{-1} D{,}{,}{-1}  }
\toprule
& \multicolumn{2}{c}{États-Unis} & \multicolumn{2}{c}{Canada} \\
\multirow{2}{*}{Année} & \multicolumn{1}{c}{Consensus} &\multicolumn{1}{c}{Pourcentage} &  \multicolumn{1}{c}{Consensus} &\multicolumn{1}{c}{Pourcentage} \\
\midrule
2007 & 2,31 & 8,8 & 2,25 & 8,2 \\
2008 & 2,25 & 7,0 & 2,18 & 7,5 \\
2009 & 2,32 & 7,8 & 2,26 & 8,8 \\
\midrule
Total & 2,15 & 4,7 & 2,22 & 8,8 \\
\bottomrule
\end{tabular*} 
\end{table} 
%
The paragraph after my floating table. Spacing with the previous paragraph should be 10pt (as parskip command) ... But it appears to be 40pt !?!?!?

\end{document}
phil_1264
Posts: 4
Joined: Sun Apr 25, 2010 3:27 am

Abnormal space between two paragraphs

Post by phil_1264 »

Thanks for the comment frabjous.

Effectively, I forgot to take out the center environment after I decided to get my table full length.

After testing your solution of commenting the paragraph breaks, I found I only need one break as I want to have one paragraph space. The correct code should look like :

Code: Select all

    \documentclass[12pt,oneside]{book}

    \usepackage{setspace}  % package pour la taille des interlignes
    \usepackage{latexsym}
    \usepackage{multirow} % allow multirow
    \usepackage{dcolumn} % allow to center a table on the decimal point
    \usepackage{booktabs}  % allow professionnal table presentation (toprule midrule bottomrule)
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{ae,aecompl}
    \usepackage{fancyhdr}  % package pour mettre le nom des chapitres en haut de chaque page
    \usepackage[francais]{babel}

    \textheight=22cm \textwidth=14cm \oddsidemargin=2.25cm \topmargin=-20pt
    \parskip=10pt   %Saut entre les paragraphes
    \parindent=0pt % Pour enlever toute indentation de début de paragraphe.

    \begin{document}
    \onehalfspacing  % Interligne 1,5

    Some text here to create a paragraph in which I discuss results I have printed in Table 1.
    %
    \begin{table}[!tp]\footnotesize
    \begin{tabular*}
       
          ... the actual table content here

    \end{tabular*}
    \end{table}
    
    The paragraph after my floating table. Spacing with the previous paragraph should be 10pt (as parskip command) ... But it appears to be 40pt !?!?!?

    \end{document}
Thanks,
Post Reply