即使将浮动位置指定为 h 并且第一页有大量空白,表格仍会自动转到第二页

即使将浮动位置指定为 h 并且第一页有大量空白,表格仍会自动转到第二页

本文档中有 4 个表格,由于它们都是小表格,所以应该可以放在一页上。但是,尽管第一页上有足够的空间来保存表格,但最后一个表格仍会转到第二页。我还\begin{table}[h]对所有表格使用了。输出 pdf 的第一页 输出 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}

答案1

从示例中看来,您根本不需要使用环境表。

我建议进一步简化代码并避免重复,通过定义一个命令来处理问题的编号、布局和格式,并将问题和表格放在分页符上。

还添加了siunitx允许 LaTeX 用户按照国际单位制惯例书写物理量单位的软件包。(待办事项:对齐小数点。)

A

这是完整的代码。\makequestion定义为

\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}

如果你想/必须使用表格,请使用以下定义\makequestion

(用于\begin{table}[H]防止漂浮)

    \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
}

相关内容