0

I have the following code:

\subsection{AAA}
This data was taken from RStudio's fclust packedge.

\begin{table}[]
\centering
\caption{Butterfly data - 3 clusters}

\begin{tabular}{
>{\columncolor[HTML]{EFEFEF}}l 
>{\columncolor[HTML]{EFEFEF}}l 
>{\columncolor[HTML]{EFEFEF}}l l
>{\columncolor[HTML]{EFEFEF}}l 
>{\columncolor[HTML]{EFEFEF}}l 
>{\columncolor[HTML]{EFEFEF}}l l
>{\columncolor[HTML]{EFEFEF}}l 
>{\columncolor[HTML]{EFEFEF}}l 
>{\columncolor[HTML]{EFEFEF}}l }
&\textbf{Python}  &        &  &      &  \textbf{R}   &      &  &        & \textbf{Spark}    &          \\
0.4374 & 0.2407 & 0.3217 &  & 0.44 & 0.24 & 0.32 &  & 0.3403 & 0.34034 & 0.319318 \\
0.1433 & 0.1004 & 0.7561 &  & 0.14 & 0.1  & 0.75 &  & 0.2194 & 0.21345 & 0.567114 \\
0.0292 & 0.0286 & 0.9421 &  & 0.03 & 0.03 & 0.94 &  & 0.0861 & 0.08277 & 0.831062 \\
0.1056 & 0.1462 & 0.7481 &  & 0.1  & 0.14 & 0.75 &  & 0.2194 & 0.21345 & 0.567114 \\
0.0570 & 0.0418 & 0.9011 &  & 0.06 & 0.04 & 0.9  &  & 0.1490 & 0.14206 & 0.708855 \\
0.0006 & 0.0006 & 0.9986 &  & 0    & 0    & 1    &  & 0.0010 & 9.51E-0 & 0.998038 \\
0.0461 & 0.0595 & 0.8942 &  & 0.04 & 0.06 & 0.9  &  & 0.1490 & 0.14206 & 0.708855 \\
0.0989 & 0.0943 & 0.8066 &  & 0.1  & 0.1  & 0.81 &  & 0.3724 & 0.32940 & 0.298178 \\
0.3253 & 0.2986 & 0.3759 &  & 0.31 & 0.31 & 0.38 &  & 0.1877 & 0.81202 & 1.93E-04 \\
0.4813 & 0.4052 & 0.1133 &  & 0.44 & 0.44 & 0.11 &  & 0.4457 & 0.50064 & 0.053554 \\
0.9905 & 0.0072 & 0.0022 &  & 0.98 & 0.01 & 0    &  & 0.4257 & 0.44637 & 0.127889 \\
0.5361 & 0.4188 & 0.0449 &  & 0.48 & 0.48 & 0.05 &  & 0.4313 & 4.57E-0 & 0.111201 \\
0.0246 & 0.9688 & 0.0065 &  & 0.01 & 0.98 & 0    &  & 0.4257 & 0.44637 & 0.127889 \\
0.8283 & 0.1217 & 0.0498 &  & 0.84 & 0.12 & 0.05 &  & 0.4032 & 0.41446 & 0.182285 \\
0.5068 & 0.4434 & 0.0496 &  & 0.48 & 0.48 & 0.05 &  & 0.4155 & 0.43226 & 0.152180 \\
0.1149 & 0.8418 & 0.0431 &  & 0.12 & 0.84 & 0.05 &  & 0.4032 & 0.41446 & 0.182285 \\
0.2429 & 0.4453 & 0.3116 &  & 0.24 & 0.44 & 0.32 &  & 0.3403 & 0.34034 & 0.319318
\end{tabular}
\end{table}

\subsection{BBB}

but when I generate the code, I see:

AAA

BBB

table

How to make the order to be as the one in the code:

AAA

table

BBB

  • 1
    Just drop this dreadful table stuff and use \captionof{table}{Your caption} (requires caption package) -- this will prevent this floating which causes in many cases more problems than really needed – user31729 Apr 9 '16 at 14:30
3

You can use the float package with the placement specifier [H] to force the table into the position you want:

\documentclass[]{article}
\usepackage{float}

\begin{document}

\subsection{AAA}
This data was taken from RStudio's fclust packedge.

\begin{table}[H]
\centering
\caption{Butterfly data - 3 clusters}

\begin{tabular}{ccccccccccc}
&\textbf{Python}  &        &  &      &  \textbf{R}   &      &  &        & \textbf{Spark}    &          \\
0.4374 & 0.2407 & 0.3217 &  & 0.44 & 0.24 & 0.32 &  & 0.3403 & 0.34034 & 0.319318 \\
0.1433 & 0.1004 & 0.7561 &  & 0.14 & 0.1  & 0.75 &  & 0.2194 & 0.21345 & 0.567114 \\
0.0292 & 0.0286 & 0.9421 &  & 0.03 & 0.03 & 0.94 &  & 0.0861 & 0.08277 & 0.831062 \\
0.1056 & 0.1462 & 0.7481 &  & 0.1  & 0.14 & 0.75 &  & 0.2194 & 0.21345 & 0.567114 \\
0.0570 & 0.0418 & 0.9011 &  & 0.06 & 0.04 & 0.9  &  & 0.1490 & 0.14206 & 0.708855 \\
0.0006 & 0.0006 & 0.9986 &  & 0    & 0    & 1    &  & 0.0010 & 9.51E-0 & 0.998038 \\
0.0461 & 0.0595 & 0.8942 &  & 0.04 & 0.06 & 0.9  &  & 0.1490 & 0.14206 & 0.708855 \\
0.0989 & 0.0943 & 0.8066 &  & 0.1  & 0.1  & 0.81 &  & 0.3724 & 0.32940 & 0.298178 \\
0.3253 & 0.2986 & 0.3759 &  & 0.31 & 0.31 & 0.38 &  & 0.1877 & 0.81202 & 1.93E-04 \\
0.4813 & 0.4052 & 0.1133 &  & 0.44 & 0.44 & 0.11 &  & 0.4457 & 0.50064 & 0.053554 \\
0.9905 & 0.0072 & 0.0022 &  & 0.98 & 0.01 & 0    &  & 0.4257 & 0.44637 & 0.127889 \\
0.5361 & 0.4188 & 0.0449 &  & 0.48 & 0.48 & 0.05 &  & 0.4313 & 4.57E-0 & 0.111201 \\
0.0246 & 0.9688 & 0.0065 &  & 0.01 & 0.98 & 0    &  & 0.4257 & 0.44637 & 0.127889 \\
0.8283 & 0.1217 & 0.0498 &  & 0.84 & 0.12 & 0.05 &  & 0.4032 & 0.41446 & 0.182285 \\
0.5068 & 0.4434 & 0.0496 &  & 0.48 & 0.48 & 0.05 &  & 0.4155 & 0.43226 & 0.152180 \\
0.1149 & 0.8418 & 0.0431 &  & 0.12 & 0.84 & 0.05 &  & 0.4032 & 0.41446 & 0.182285 \\
0.2429 & 0.4453 & 0.3116 &  & 0.24 & 0.44 & 0.32 &  & 0.3403 & 0.34034 & 0.319318
\end{tabular}
\end{table}

\subsection{BBB}
\end{document}

which produces this:

also I think you probably mean "RStudio's fclust package" not "packedge" :).

  • worked perfectly, thats a lot – Alex L Apr 9 '16 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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