Floating table for new page

Asked

Viewed 770 times

1

Hello,

I am trying to adjust a table so that it stays on the same page of the section that was created to compose it, however, as much as it is an empty page section with only this table, it automatically moves to a new page leaving the previous one blank.

\documentclass[a4paper,12pt,oneside,onecolumn,final,fleqn]{repUERJ}                           
\usepackage{graphicx}       
\usepackage{subfig}
\usepackage{multirow}
\usepackage{amsmath,amssymb}  
\usepackage[alf]{abntex2cite} 
\usepackage[font=default,frame=no]{repUERJformat}                                             
\usepackage[maxfloats=25]{morefloats}
\usepackage{array}
\setlength\extrarowheight{2pt}
\usepackage[section]{placeins}
\usepackage{placeins}`

My table:

\begin{table}[h] {12cm}
    \centering
    \caption{Variáveis e Fontes dos Dados}
    \label{Variáveis e Fontes dos Dados}
    \begin{tabular}{cc}
        \textbf{Variável}                                                                                                                                               & \textbf{Fonte} \\ \hline
        \multicolumn{1}{c|}{I  }                                                                                                             & SEV           \\ \hline
        \multicolumn{1}{c|}{P }                                                                                                                              & IBGE           \\ \hline
        \multicolumn{1}{c|}{A}                                                                                                                         & IBGE           \\ \hline
        \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}T = Intensidade Energética\\ O\end{tabular}} & IBGE e BEN     \\ \hline
    \end{tabular}
\end{table}

I’ve tried too many variants of package options float, such as the [H], but it did not change that question.

NOTE: I am using the repUerj template available here

  • if it is essential to try \begin{table}[h!]

1 answer

0

Try eliminating the second load of placeins in

\usepackage[section]{placeins}
\usepackage{placeins}

Maybe that erased the option section of the first call. If it doesn’t work, try to force before the section with ' Floatbarrier'

\begin{table}
....
\end{table}

Algum texto finalizando a seção.

\FloatBarrier

\section{próxima seção}

But I recommend using this kind of thing only at the end. Let the table and figures float in the drafts. Normally Latex finds a better position than I imagine. Only in very short texts do I need to force the position of the figure.

If none of this still works, you do not need to let the table float. Remove the tabular from within table and use \captionof.

\begin{minipage}{\textwidth}
  \centering
  \captionof{table}{Variáveis e Fontes dos Dados}
  \label{Variáveis e Fontes dos Dados}
  \begin{tabular}{cc}
    \multicolumn{1}{c|}{I} & SEV \\ \hline
    \multicolumn{1}{c|}{P} & IBGE \\ \hline
    \multicolumn{1}{c|}{A} & IBGE \\ \hline
    \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}T = Intensidade Energética
                        \\ O\end{tabular}} & IBGE e BEN \\ \hline
    \end{tabular}
\end{minipage}
  • Thank you for your reply Marcos. I have tried your suggestion, but it remains the same. The table goes on to the other page leaving the previous one blank. Know something else I can try?

  • The only thing I can imagine right now is: use part of the text and table with problem in a separate file, without using the repUERJ. Maybe it’s something internal in that package that’s conflicting with the placeins.

  • You can also try charging placeins before \usepackage[font=default,frame=no]{repUERJformat}.

  • I also think it might be something with the package in question, because in other packages, I always managed to organize tables and images only with the float. I found interesting your suggestion to use part of the text and table in a separate file. Do you have any material that explains how to accomplish this?

  • In those hours I use brute force, really. Troca ' documentclass[a4paper,12pt,oneside,onecolumn,final,fleqn]{repUERJ}' by ' documentclass[a4paper]{report}' and I call pdflatex. But since you must have so much that depends on the repUERJshould generate a lot of error. That’s why I suggested copying some of the text. I’m sorry, nothing too clever. I hope you’re using version control like git. It helps reverse experiences like this if they go wrong.

  • Thank you very much for your attention, Marcos.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.