表格和部分放错位置

表格和部分放错位置

这些是我的表格:

 \section{The status of respondents}
    \begin{center}
        \begin{table}
        \begin{tabular}{|l|l|l|l|}
                \hline
            \textbf{Sl.No.} & \textbf{Grouping of Respondents} & \textbf{Respondents} & \textbf{Percentage} \\
            \hline
            1 & Students & 38 & 76\% \\
            \hline
            2 & Employees & 12 & 24\% \\
            \hline
              & \textbf{Total} & 50 & 100\% \\
            \hline          
        \end{tabular}
        \caption{The status of respondents}
        \end{table}     
    \end{center}  

Among the 50 respondents 38 were students and 12 were employees. 
\section{Some section}
\begin{center}
    \begin{table}
    \begin{tabular}{|l|l|l|l|}
        \hline
        \textbf{Sl.No.} & \textbf{Options} & \textbf{Respondents} & \textbf{Percentage} \\
        \hline
        1 & Getting it without making payment & 29 & 58\% \\
        \hline
        2 & Free to use it for any purpose & 10 & 20\% \\
        \hline
        3 & Free to distribute copies & 11 & 22\% \\
        \hline
          & \textbf{Total} & 50 & 100\% \\
        \hline 
    \end{tabular}
    \caption{Opinion about something}
    \end{table}
\end{center}

当我编译成 pdf 时,表格会一起出现,而中间的章节名称和其他文字会在表格后面单独出现。

答案1

不要将表放在中心环境中。

\listfiles
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

\begin{document}

\section{The status of respondents}
\begin{table}[!htb]
\centering
   \begin{tabular}{|l|l|l|l|}\hline
     \textbf{Sl.No.} & \textbf{Grouping of Respondents} & \textbf{Respondents} & \textbf{Percentage} \\
            \hline
            1 & Students & 38 & 76\% \\
            \hline
            2 & Employees & 12 & 24\% \\
            \hline
              & \textbf{Total} & 50 & 100\% \\
            \hline          
        \end{tabular}
        \caption{The status of respondents}
\end{table}     

Among the 50 respondents 38 were students and 12 were employees. 
\section{Some section}
\begin{table}[!htb]
\centering
    \begin{tabular}{|l|l|l|l|}\hline
        \textbf{Sl.No.} & \textbf{Options} & \textbf{Respondents} & \textbf{Percentage} \\
        \hline
        1 & Getting it without making payment & 29 & 58\% \\
        \hline
        2 & Free to use it for any purpose & 10 & 20\% \\
        \hline
        3 & Free to distribute copies & 11 & 22\% \\
        \hline
          & \textbf{Total} & 50 & 100\% \\
        \hline 
    \end{tabular}
    \caption{Opinion about something}
\end{table}

\end{document}

相关内容