0

Kindly please help me soon, I must submit my paper as soon as possible and still there is a problem and white space and though I used htp for table, my table come between the text! also, I've searched a lot and still have this problem, after a long table there is a white space that the section can be in that space. My LaTeX code is as below:

\documentclass{cta-author}
\usepackage{natbib}
\usepackage{longtable}
\usepackage{lineno,hyperref}
\usepackage{lineno}
\usepackage{parskip}
\usepackage[utf8]{inputenc}
\usepackage{framed} % Framing content
\usepackage{multicol} % Multiple columns environment

\usepackage{textcomp}
\usepackage[T1]{fontenc}
\usepackage{resizegather}
\usepackage{booktabs}
\usepackage{bm}
\usepackage[font=small,skip=0pt]{caption}
\usepackage{setspace}

\begin{document}
{text}
\subsection{text}
\begin{table}[!t]
\caption{text1}
\label{table1}
\centering
\resizebox{0.48\textwidth}{!}{%
    %{\small \begin{center}
    \begin{tabular}{|l|}
        %\begin{longtable}{l}
        %       \centering
        \toprule\toprule
{text}
        \bottomrule\bottomrule
        \end{tabular}
}
\end{table}
\begin{table}[h]
        \caption*{\raggedright Continuation of Table \ref{table1}:}
    \label{table2}
    \centering
    \resizebox{0.48\textwidth}{!}{%
        \begin{tabular}{|l|}
            \toprule\toprule
{text3}
        \end{tabular}}
    \vspace{-5pt}
    \end{table}
\section{Simulation Results}
\label{section 2}
{text}
\\
\raggedbottom
    \begin{table}[htp]
        \caption{Simulation}
        \label{Table4}
        \centering
    \begin{spacing}{1.5}
            \small\addtolength{\tabcolsep}{-15pt}
            \begin{tabular}{l c}
                \toprule\toprule
{text5}
                \bottomrule\bottomrule
            \end{tabular}
        \end{spacing}
    \vspace{-10mm}
    \end{table}
{text}
\end{document}
sanaz
  • 1
  • Welcome to TeX.SE. What happens if you remove the \vfill instruction before \section{Simulation Results}? Please also do reveal which document class you employ and what happens if you move \raggedbottom to the preamble, so that the directives applies to the entire document? – Mico Oct 28 '19 at 09:21
  • 1
    without an example document it is very hard to say anything, but the \\ after the section text is wrong and presumably generates warnings. – David Carlisle Oct 28 '19 at 09:22
  • Incidentally, in many (most?) most document classes the default value of \tabcolsep is 6pt; setting it to -9pt (via the instruction \addtolength{\tabcolsep}{-15pt}) is likely to create major typographic malfunctions. – Mico Oct 28 '19 at 09:26
  • Thank you for your response, \documentclass{cta-author} its my document class, I did this and moved \vfill before \section{Simulation Results}, but nothing happened. – sanaz Oct 28 '19 at 09:31
  • what do you mean by preamble? – sanaz Oct 28 '19 at 09:31
  • My document and table is too long, for this reason I put {text} instead – sanaz Oct 28 '19 at 09:31
  • But you are asking about why latex placed a float at some position, but not told us how big your float is or what size your page is or what other text you want to fit on the page, so there is virtually no help that can be given other than very general advice. Note that by using [h] you are explicitly banning the default [t] position so not allowing the table to be placed at the top of a page with text below. – David Carlisle Oct 28 '19 at 09:38
  • I put whole document here to see this blank space: – sanaz Oct 28 '19 at 09:40
  • I di not see where you edited the question to add an example document? Before doing that please make the example as small as possible, remove any packages not needed for the example and remove as much text as you can while showing the problem. – David Carlisle Oct 28 '19 at 09:42
  • I did it and delete unnecessary parts – sanaz Oct 28 '19 at 09:56
  • well no, do you really need siunitx and graphicx and multicol (or any of those packages) for this example ? Remember you are asking people to trace tex's behaviour and including all that slows down the task and makes tracing a lot harder. Also cta-author.cls is not in the standard distributions, and you have provided no link to it, so can not run your example. Can you demonstrate the problem using article or give a link to the class. – David Carlisle Oct 28 '19 at 10:39
  • If I try your example document with [twocolumn]{article} it gives the error ! Misplaced \noalign. \bottomrule ->\noalign and no output. – David Carlisle Oct 28 '19 at 10:42
  • yes, you are right, I've edited packages. But I must use this package for my paper and it is limited to this document class – sanaz Oct 28 '19 at 10:48
  • @sanaz sure you need to use that class for your document, but the purpose of posting an example is so that people can offer you help. Posting a document that they can not run just makes it impossible to help you. I don't have the class but I would assume that if you try the document as you have posted above then you get the same error about misplaced bottom rule as there is no \\ before it. If you can not demonstrate the problem with an error-free article class document, at least give a link to this class and provide an example document that shows the space problem with no errors. – David Carlisle Oct 28 '19 at 11:15

2 Answers2

1

Removing \vfill should do the trick as Mico said.

Also, you might be interested in this question and its answer.

Here is the full (corrected) MWE assuming article document class.

\documentclass{article}

\usepackage{graphicx}
\usepackage{booktabs}

\begin{document}
\begin{table}[h]%[!htbp]%[tp]
\caption*{\raggedright Table 1}
\label{table3new}
\centering
\resizebox{0.48\textwidth}{!}{%
    \begin{tabular}{|l|}
        \toprule\toprule
            {text}\\
                \bottomrule\bottomrule
    \end{tabular}}
\vspace{-5pt}
\end{table}
%\vfill
\section{Simulation Results}    
\label{section Five}
{text}.\\
\raggedbottom

\begin{table}[h]%[!htbp]%[tp]
\caption*{\raggedright Table 2}
\label{table3new}
\centering
\resizebox{0.48\textwidth}{!}{%
    \begin{tabular}{|l|}
        \toprule\toprule
            {text}\\
                \bottomrule\bottomrule
    \end{tabular}}
\vspace{-5pt}
\end{table}

{text again}
\end{document}

enter image description here

jchd
  • 533
  • The question states the the OP is using two column, and this document produces Underfull \hbox (badness 10000) in paragraph at lines 22--24 which should never be generated by an answer (even though the bad \\ code was copied from the question) – David Carlisle Oct 28 '19 at 09:34
  • also [h] (athough it avoids warnings in this small example) is usually unsuitable. In most case LaTeX will warn about it and change it to [ht] but [htp] is usually preferable. – David Carlisle Oct 28 '19 at 09:35
  • thanks, but still I have this problem, I attach my whole document here to show you my problem – sanaz Oct 28 '19 at 09:37
0

Use \vspace*{-\baselineskip} after the image or table.

As to make it global (I.e., after each image or table), I do not know how except via using custom style.

E.g.,

\newenvironment{rLongtable}{
  \vspace*{-\baselineskip}
  \begin{longtable}
}
{
  \end{longtable}
  \vspace*{-1.7\baselineskip}
}