1

I am having 4 tables in this document that should fit on one page since they are small tables. However, the last table keeps going to the second page though there is enough space on the first page to keep the table. I am also using the \begin{table}[h] for all the tables.first page of the output pdf second page of the output pdf

\documentclass[a4paper,10pt]{article}
\usepackage{paralist}
\usepackage{float}
\topmargin -1.2in
\textheight 11in
\oddsidemargin -0.35in
\evensidemargin -0.35in
\textwidth 7in
\footskip 0.5in

\begin{document} \section*{STUDY OF A TWO-STAGE COMPRESSOR PROCESS PLANT (Part-A)} \textbf{Q-1 What are the amounts of liquid and vapour leaving the process?} \begin{table}[h] \begin{tabular}{|c|c|c|} \hline & Aspen Plus & DWSIM \ \hline Amount of liquid leaving the process & & 6808.21 $kmol/h$ \ \hline Amount of vapour leaving the process & & 37021.8 $kmol/h$ \ \hline \end{tabular} \end{table}

    \noindent \textbf{Q-2 What compressor work is required for each stage?}
        \begin{table}[h]
        \begin{tabular}{|c|c|c|}
            \hline
            & Aspen Plus & DWSIM \\ \hline
            Compressor work for stage-1 & &  32460.46 $kW$ \\ \hline
            Compressor work for stage-2 & & 30898.46 $kW$ \\ \hline
        \end{tabular}
    \end{table}

    \noindent \textbf{Q-3 What are the stream temperatures entering the aftercoolers?}
    \begin{table}[h]
        \begin{tabular}{|c|c|c|}
            \hline
            & Aspen Plus & DWSIM \\ \hline
            Stream temperature entering the aftercooler-1 & & 93.2194 $^\circ C$ \\ \hline
            Stream temperature entering the aftercooler-2 & & 103.751 $^\circ C$ \\ \hline
        \end{tabular}
    \end{table}

    \noindent \textbf{Q-4 What are the aftercooler duties?}
    \begin{table}[h]
        \begin{tabular}{|c|c|c|}
            \hline
            & Aspen Plus & DWSIM \\ \hline
            Afercooler-1 Duty & & 23027.94 kW \\ \hline
            Aftercooler-2 Duty & & 42357.27 kW \\ \hline
        \end{tabular}
    \end{table}

\end{document}

Priyam
  • 49
  • 2
    tl;dr: There's a builtin limit on how many tables TeX will put on a page. You can change the limit, but the real question is why not just get rid of {table} and leave a bare {tabular}. The point of {table} is to allow it to float and to give a place for the caption. Either can be worked around, but you want neither. – Teepeemm Mar 05 '22 at 16:45
  • 2
    [ht!] will ignore the 3 float/page limit. This is one of the few times [!] does anything useful. – John Kormylo Mar 05 '22 at 17:01
  • usong [h] makes the table going to the end of the document more likly as it means not t (so not top of a page) not b (not bottom of a page_ not p (not on a pag of tables) that mans it is not allowed in most places. LaTex usually warns and changs it to ht, but it is sill restrictive – David Carlisle Mar 05 '22 at 18:44
  • Since you don't have a caption, why use table at all? – John Kormylo Mar 05 '22 at 21:39

1 Answers1

1

It seems from the example that you don't need to use the environment table at all.

I suggest further simplification of the code and avoiding repetition by defining a command that will take care of the numbering, layout, and formatting of the question, and keep the question and tabular together on a page break.

Added also the siunitx package which allows LaTeX users to write the units of physical quantities following the conventions of the Système International d’Unités. (To do: align the decimal dot.)

a

This is the complete code. \makequestion is defined as

\makequestion{<question>}{<tabular>}

.

\documentclass[a4paper,10pt]{article}
\usepackage{paralist}
\usepackage{float}
\topmargin -1.2in
\textheight 11.2in
\oddsidemargin -0.35in
\evensidemargin -0.35in
\textwidth 7in
\footskip 0.5in

%*********************************************************** added<<<<<<<<<<<<

\usepackage{siunitx} % Système International d’Unités \usepackage{array}% new columns of the tabular \newcolumntype{L}[1]{>{\small\raggedright\arraybackslash}m{#1}} \newcolumntype{C}[1]{>{\small\centering\arraybackslash}m{#1}}

\newcounter{questions} \newcommand{\makequestion}[2]{% \stepcounter{questions} \noindent\begin{minipage}{0.95\textwidth} {\bfseries Q--\thequestions, #1}\par \vspace{0.5\baselineskip}
{\hspace{6ex} #2}
\vspace{\baselineskip} \end{minipage}\par } %**********************************************************************

\begin{document} \section*{STUDY OF A TWO-STAGE COMPRESSOR PROCESS PLANT \ (Part-A)}

\makequestion{What are the amounts of liquid and vapour leaving the process?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Amount of liquid leaving the process & & 6808.21 \unit{\kilo\mole\per\hour} \ \hline Amount of vapour leaving the process & & 37021.80 \unit{\kilo\mole\per\hour}\ \hline \end{tabular} }

\makequestion{What compressor work is required for each stage?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Compressor work for stage-1 & & 32460.46 \si{kW} \ \hline Compressor work for stage-2 & & 30898.46 \si{kW} \ \hline \end{tabular} }

\makequestion{What are the stream temperatures entering the aftercoolers?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Stream temperature entering the aftercooler-1 & &\SI{93.2194}{\degreeCelsius}\ \hline Stream temperature entering the aftercooler-2 & & \SI{103.751}{\degreeCelsius}\ \hline \end{tabular} }

\makequestion{What are the aftercooler duties?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Afercooler-1 Duty & & 23027.94 \si{kW} \ \hline Aftercooler-2 Duty & & 42357.27 \si{kW} \ \hline \end{tabular} }

\makequestion{What are the amounts of liquid and vapour leaving the process?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Amount of liquid leaving the process & & 6808.21 \unit{\kilo\mole\per\hour} \ \hline Amount of vapour leaving the process & & 37021.80 \unit{\kilo\mole\per\hour}\ \hline \end{tabular} }

\makequestion{What compressor work is required for each stage?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Compressor work for stage-1 & & 32460.46 \si{kW} \ \hline Compressor work for stage-2 & & 30898.46 \si{kW} \ \hline \end{tabular} }

\makequestion{What are the stream temperatures entering the aftercoolers?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Stream temperature entering the aftercooler-1 & &\SI{93.2194}{\degreeCelsius}\ \hline Stream temperature entering the aftercooler-2 & & \SI{103.751}{\degreeCelsius}\ \hline \end{tabular} }

\makequestion{What are the aftercooler duties?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Afercooler-1 Duty & & 23027.94 \si{kW} \ \hline Aftercooler-2 Duty & & 42357.27 \si{kW} \ \hline \end{tabular} }

\makequestion{What are the amounts of liquid and vapour leaving the process?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Amount of liquid leaving the process & & 6808.21 \unit{\kilo\mole\per\hour} \ \hline Amount of vapour leaving the process & & 37021.80 \unit{\kilo\mole\per\hour}\ \hline \end{tabular} }

\makequestion{What compressor work is required for each stage?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Compressor work for stage-1 & & 32460.46 \si{kW} \ \hline Compressor work for stage-2 & & 30898.46 \si{kW} \ \hline \end{tabular} }

\makequestion{What are the stream temperatures entering the aftercoolers?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Stream temperature entering the aftercooler-1 & &\SI{93.2194}{\degreeCelsius}\ \hline Stream temperature entering the aftercooler-2 & & \SI{103.751}{\degreeCelsius}\ \hline \end{tabular} }

\makequestion{What are the aftercooler duties?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Afercooler-1 Duty & & 23027.94 \si{kW} \ \hline Aftercooler-2 Duty & & 42357.27 \si{kW} \ \hline \end{tabular} }

\makequestion{What are the amounts of liquid and vapour leaving the process?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Amount of liquid leaving the process & & 6808.21 \unit{\kilo\mole\per\hour} \ \hline Amount of vapour leaving the process & & 37021.80 \unit{\kilo\mole\per\hour}\ \hline \end{tabular} }

\makequestion{What compressor work is required for each stage?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Compressor work for stage-1 & & 32460.46 \si{kW} \ \hline Compressor work for stage-2 & & 30898.46 \si{kW} \ \hline \end{tabular} }

\makequestion{What are the stream temperatures entering the aftercoolers?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Stream temperature entering the aftercooler-1 & &\SI{93.2194}{\degreeCelsius}\ \hline Stream temperature entering the aftercooler-2 & & \SI{103.751}{\degreeCelsius}\ \hline \end{tabular} }

\makequestion{What are the aftercooler duties?}{% \begin{tabular}{|L{3in}|c|C{1.2in}|}\hline & Aspen Plus & DWSIM \ \hline Afercooler-1 Duty & & 23027.94 \si{kW} \ \hline Aftercooler-2 Duty & & 42357.27 \si{kW} \ \hline \end{tabular} }

\end{document}

If you want/must use tables, use this definition of \makequestion

(It uses \begin{table}[H] to prevent the floating)

    \newcommand{\makequestion}[2]{%
    \stepcounter{questions}
    \noindent\begin{minipage}{0.95\textwidth}
        {\bfseries Q--\thequestions\, #1}\vspace*{-1em}
        \begin{table}[H]\centering#2\end{table}
        \vspace{0.5\baselineskip}
    \end{minipage}\par
}
Simon Dispa
  • 39,141