Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have trouble arranging the floats on the pages. See for example the screenshot below:

Why is it happening like this? there is only this much text in this particular subsection, so why doesn't latex put the table behind the text and start the next subsection?

screenshot

table is not restricted to any width.

\begin{table}
\caption{Effect of biofilm density on the drag and oscillation behavior. The
para\-meters used in the simulation are: $L/d=4.5$,  $U_{0}=\SI{0.4}{\meter\per\second}$ 
($Re_{D}=133$).\label{tab:Effect-of-biofilm-density}}
\begin{tabular*}{0.8\textwidth}{@{\extracolsep{\fill}}cccc>{\centering}p{0.15\textwidth}}
\toprule 
Density (\si{\kilogram\per\cubic\meter}) & $C_{D}$ (-) & Oscillation Frequency (\si{\hertz}) & Amplitude (\si{\micro\meter}) & Strouhal Number (-)\tabularnewline
\midrule 
\num{950} & \num{1.2838} & 199.6 & 169 & 0.1662\tabularnewline
\num{1000} & \num{1.2913} & 199.0 & 181 & 0.1658\tabularnewline
\num{1100} & \num{1.2950} & 196.9 & 177 & 0.1639\tabularnewline
\num{1200} & \num{1.2988} & 195.2 & 182 & 0.1625\tabularnewline
\bottomrule
\end{tabular*}
\end{table}

Here is my preambles:

\usepackage{mathptmx}
\renewcommand*{\rmdefault}{ppl}
\renewcommand*{\sfdefault}{ppl}
\newcommand\hmmax{0} % default 3


%\usepackage{floatrow} 
\usepackage{xcolor}
\definecolor{darkred}{rgb}{0.667,0.118,0.004}
\definecolor{codebg}{rgb}{0.95,0.95,0.95}
\definecolor{lgreen}{HTML}{b8b60b}

\usepackage[tocgraduated]{tocstyle} 
\usetocstyle{nopagecolumn} 


\usepackage{prettyref}
\newrefformat{eq}{Equation~\textup{(\ref{#1})}}
\newrefformat{chap}{Chapter~\ref{#1}}
\newrefformat{sec}{Section~\ref{#1}}
\newrefformat{sub}{Section~\ref{#1}}
\newrefformat{tab}{Table~\ref{#1}}
\newrefformat{fig}{Figure~\ref{#1}}


% schönerer Blocksatz!!
\usepackage{microtype}


\@ifpackageloaded{nomencl}{
\renewcommand{\nomname}{List of Notations}
\renewcommand*{\pagedeclaration}[1]{\unskip\dotfill\hyperpage{#1}}
}{}

%\setlength{\nomitemsep}{-\parsep}


%todo notes
\usepackage[colorinlistoftodos]{todonotes}
\newcommand{\todog}[1]{\todo[color=lgreen]{#1}}
\newcommand{\todor}[1]{\todo[color=red!40]{#1}}
\newcommand{\todob}[1]{\todo[color=blue!40]{#1}}
%/todo notes

\usepackage[]{titlesec}
\titleformat{\chapter}[display]{\scshape\small}{\filleft\rmfamily\fontsize{72pt}{10pt}\selectfont\textcolor{darkred}\thechapter}{1ex}{\rmfamily\Huge\itshape\filleft}[\vspace{2ex}]


\usepackage{booktabs}

%mass transfer paper
\usepackage{siunitx} 
\sisetup{inter-unit-product={}\cdot{},number-unit-product = \;}
%end mass transfer paper


%show vectors in bold
\usepackage{bm}
\DeclareRobustCommand\vec[1]{%
  \ifcat\noexpand#1\relax
    \expandafter\bm
  \else
    \expandafter\mathbf
  \fi{#1}}
%end renew commands


\usepackage[indention={.5cm},font={small,rm},format={plain},labelfont={rm,bf,up},textfont={rm,up}]{caption}

%-------center everything----------[
\usepackage{ifthen}

\renewenvironment{figure}[1][]{%
 \ifthenelse{\equal{#1}{}}{%
   \@float{figure}
 }{%
   \@float{figure}[#1]%
 }%
 \centering
}{%
 \end@float
}


\renewenvironment{table}[1][]{%
 \ifthenelse{\equal{#1}{}}{%
   \@float{table}
 }{%
   \@float{table}[#1]%
 }%
 \centering
}{%
 \end@float
}
%]----------centering-------------
\@ifpackageloaded{nomencl}{
\renewcommand{\nomname}{List of Symbols}
\renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{A}}{\item[\textbf{Roman Symbols}]}{%
\ifthenelse{\equal{#1}{G}}{\item[\textbf{Greek Symbols}]}{%
\ifthenelse{\equal{#1}{C}}{\item[\textbf{Abbreviations}]}{%
\ifthenelse{\equal{#1}{S}}{\item[\textbf{Subscripts}]}{%
\ifthenelse{\equal{#1}{T}}{\item[\textbf{Superscripts}]}{
\ifthenelse{\equal{#1}{Z}}{\item[\textbf{Mathematical Symbols}]}
{}
}% matches mathematical symbols
}% matches Subscripts
}% matches Superscripts
}% matches Abbreviations
}% matches Greek Symbols
}% matches Roman Symbols
}{}


% for correct jump positions whe clicking on a link to a float
%\usepackage[figure]{hypcap}

\definecolor{chaptercolor}{rgb}{.176,0,.367}

\addtokomafont{chapter}{\color{darkred}}
\addtokomafont{part}{\color{darkred}}
\addtokomafont{section}{\rmfamily\itshape}
\addtokomafont{subsection}{\rmfamily\itshape}
\addtokomafont{paragraph}{\normalfont\upshape\rmfamily\itshape}





\renewcommand*{\addparttocentry}[2]{%
  \addcontentsline{toc}{part}{\partname\nobreakspace \protect\numberline{#1}#2}%
}


\usepackage{verbatim} % Mostly for the comment environment.
\newenvironment{mylisting}
{\begin{list}{}{\setlength{\leftmargin}{1em}}\item\scriptsize\bfseries}
{\end{list}}
\newenvironment{mytinylisting}
{\begin{list}{}{\setlength{\leftmargin}{1em}}\item\tiny\bfseries}
{\end{list}}


\usepackage{bigints}
\usepackage[font=small]{idxlayout}


%ornament
\usepackage{fourier-orns}
\newcommand*\myhrulefill{%
   \leavevmode\leaders\hrule depth-2pt height 2.4pt\hfill\kern0pt}
\newcommand\niceending[1]{%
  \begin{center}%
    \LARGE -------------------- \hspace{0.2cm} #1 \hspace{0.2cm} --------------------%
  \end{center}}
\newcommand*\nicesectionending{\niceending{\decofourright\decofourleft}}
\newcommand*\nicesubsectionending{\niceending{\aldinesmall}}
%/ornament


\usepackage{tikz}

\newenvironment{elaboration}{%
    \par
    \begin{tikzpicture}
    \node[rectangle,minimum width=0.9\textwidth] (m)
    \bgroup\begin{minipage}{0.85\textwidth}%
}{%
    \end{minipage}\egroup;
    \draw[dashed] (m.south west) rectangle (m.north east);
    \end{tikzpicture}
}


\usepackage[section]{placeins}

\clubpenalty = 10000
\widowpenalty = 10000

and here is the minimal working example:

%% LyX 2.0.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,oneside,english,titlepage, a4paper, fontsize=12pt]{scrbook}
\usepackage{mathpazo}
\usepackage{helvet}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=3.5cm,lmargin=2.5cm,rmargin=2.5cm}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\usepackage{color}
\usepackage{babel}
\usepackage{array}
\usepackage{booktabs}
\usepackage{setspace}
\onehalfspacing


\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\input{preambles/common.sty}
\usepackage{blindtext}

\makeatother

\begin{document}

\section{This is a title}

\blindtext

\begin{table}
\caption{Effect of biofilm density on the drag and oscillation behavior. The
para\-meters used in the simulation are: $L/d=4.5$,  $U_{0}=\SI{0.4}{\meter\per\second}$ 
($Re_{D}=133$).\label{tab:Effect-of-biofilm-density-1}}
\begin{tabular*}{0.8\textwidth}{@{\extracolsep{\fill}}cccc>{\centering}p{0.15\textwidth}}
\toprule 
Density (\si{\kilogram\per\cubic\meter}) & $C_{D}$ (-) & Oscillation Frequency (\si{\hertz}) & Amplitude (\si{\micro\meter}) & Strouhal Number (-)\tabularnewline
\midrule 
\num{950} & \num{1.2838} & 199.6 & 169 & 0.1662\tabularnewline
\num{1000} & \num{1.2913} & 199.0 & 181 & 0.1658\tabularnewline
\num{1100} & \num{1.2950} & 196.9 & 177 & 0.1639\tabularnewline
\num{1200} & \num{1.2988} & 195.2 & 182 & 0.1625\tabularnewline
\bottomrule
\end{tabular*}
\end{table}



\section{This is another title}

\blindtext
\end{document}
share|improve this question
    
We need to see a minimal working example (MWE) that illustrates your problem in order to help you. LyX should be able to export the LaTeX code. Do you use a manual page break here? –  Martin Scharrer Jul 29 '11 at 10:09
    
there you go. many thanks in advance. –  Danial Tz Jul 29 '11 at 10:50
    
Your example (without the \input{preambles/common.sty} and with siunitx) puts the table at the to of the page. So it doesn't demonstrate the problem. –  Ulrike Fischer Jul 29 '11 at 11:14
    
so, which part is causing this behavior? –  Danial Tz Jul 29 '11 at 11:31
1  
@Danial: it would be great if you would explain that solution by writing an answer to your own question. You could also accept this answer afterwards. –  Stefan Kottwitz Jul 29 '11 at 15:11
show 2 more comments

2 Answers

With your minimal example, the following is apparent: You allow LaTeX to use the default float placement by not specifying anything. Consequently, \begin{table}...\end{table} defaults to \begin{table}[tbp]...\end{table}. Some more information on this may be found here.

Using this a base, the only options are at the top [t] or bottom [b] of the page, or on a page of its own [p]. The choices between each of these are governed by the following lengths/counters:

  • \topfraction (maximum fraction of floats at top; default is 0.699)
  • \topnumber (number of top floats allowed; default is 2)
  • \textfraction (default is 0.199)
  • \bottomfraction (maximum fraction of floats at bottom; default is 0.300)
  • \bottomnumber (number of bottom floats allowed; default is 1)
  • \totalnumber (number of floats allowed per page; default is 3)

The \...number definitions are counters, and therefore changed by means of \setcounter. The \...fraction definitions need to be changed using \renewcommand. From the layouts package documentation, the following graphic shows the relationship between these parameters:

Page layout with floats

These limits may have been exceeded for placing the float at the top [t], resulting in it being placed at the bottom [b] (since there's plenty of room). Adding the here [h] specifier as the primary preference should overcome this:

\begin{table}[htb]
  ...
\end{table}
share|improve this answer
add comment

change the line

\begin{table}

to

\begin{table}[h]

Solves your problem. But your example is not really a MWE and therefore it is very difficult to tell what's the problem. Below is the results I got from copying your code and use the [h] specifier.

answer

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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