表格不完整

表格不完整

我在 tex studio 中创建了一个长表,但它没有完成,即它试图将自己放入一个页面中,然后将自己转储到该页面中。实际上它应该继续在下一页中,但它没有创建完整的表格。

我还添加了我的代码和表格以供参考。

\documentclass[]{article}
\usepackage{enumitem}
\usepackage{booktabs}
\usepackage{array}

\usepackage[demo]{graphicx} % to add pictures
\usepackage{caption}%to use caption under picture
\usepackage{float}%picture was going to next page
\usepackage{enumitem}
\begin{document}
    \begin{table}[H]
        \centering 
        \begin{tabular}{  >{\raggedright}m{7cm} | m{3cm} | m{3cm}  }      % centered columns (3 columns) 
            \toprule                                %inserts double horizontal lines 
            Description  & Cost per 5 pack & Sensor \\  % inserts table heading 
            \midrule\addlinespace[1.5ex]
            \begin{itemize}
                \item For fair weather application
                \item Operational temperature: 0${}^\circ$C to 65${}^\circ$C
                \item Real time automatic calibration of voltage,humidity and ambient noise
                \item Max range: 7 m (300cm) at 5V
                \item 6 m (600cm) at 3.3 V
                \item Min range: 0.2 m (20cm)
            \end{itemize}

            & \$ 174.75 & MB1240 \includegraphics[height=1.2in]{Figure/fig28} \\ \hline

            \begin{itemize}
                \item   IP67 rated for rain and inclement weather application
                \item   Operational temperature: -40${}^\circ$C to 65${}^\circ$C
                \item   Real time automatic calibration and noise rejection
                \item   Max range: 7 m (300cm) at 5V
                \item   6 m (600cm) at 3.3 V
                \item   Min range: 0.2 m (20cm)
            \end{itemize}

            & \$ 474.75 & MB7060 \includegraphics[height=1.2in]{Figure/fig29} \\ \hline

            \begin{itemize}
                \item   IP67 rated in an extra light and compact form factor
                \item   Weight: 18 gm
                \item   Operational temperature: -40${}^\circ$C to 65${}^\circ$C
                \item   Real time automatic calibration and noise rejection
                \item   Max range: 7 m (300cm) at 5V
                \item   6 m (600cm) at 3.3 V
                \item   Min range: 0.2 m (20cm)
            \end{itemize} 
            & \$ Not Available 
            & MB7267 \includegraphics[height=1.2in]{Figure/fig30} \\
             \hline


            \begin{itemize}
                \item   With I2C interface for fair weather application
                \item   I2C bus communication allows rapid control of multiple sensors with only two wires
                \item   Operational temperature: 0oC to 65oC
                \item   Real time automatic calibration and noise rejection
                \item   Max range: 7 m
                \item   Min range: 0.2 m (20cm)

            \end{itemize}
            & \$ 174.75
            & MB1242 \includegraphics[height=1.2in]{Figure/fig28} \\ \hline

            \begin{itemize}
                \item   With I2C interface for inclement weather application
                \item   I2C bus communication allows rapid control of multiple sensors with only two wires
                \item   Operational temperature: -40${}^\circ$C to 65${}^\circ$C
                \item   Real time automatic calibration and noise rejection
                \item   Max range: 7 m
                \item   Min range: 0.2 m (20cm) 
            \end{itemize}


            & \$ 474.75 
            & MB7040 \includegraphics[height=1.2in]{Figure/fig29} \\ 

            \bottomrule
        \end{tabular}
        \caption{**********Yet to decide**********}
        \label{tab:ultraCost}
    \end{table}

\end{document}

答案1

嗯,你的代码有两个问题。

首先:您需要环境longtable来让表格跨越多页。其次:您的表格太宽了。我猜您忘记了纸张边距(在下面的 MWE 中,我添加了包showframe来可视化打字区域和边距)。

我现在使用包和环境更改了您的代码longtable(请查看注释)。表格的开头应该有表头。请在控制台/终端窗口中longtable输入包的文档。texdoc longtable

我更改了表格列的宽度,使表格只写入边距的一小部分。根据需要更改值...

MWE(几乎没有漂亮的打印):

\documentclass[]{article}
\usepackage{enumitem}
\usepackage{booktabs}
\usepackage{longtable,showframe} % <====================================
\usepackage{array}

\usepackage[demo]{graphicx} % to add pictures
\usepackage{caption}%to use caption under picture
\usepackage{float}%picture was going to next page
\usepackage{enumitem}
\begin{document}
%\begin{tabular}{>{\raggedright}m{7cm}|m{3cm}|m{3cm}}      % centered columns (3 columns) 
\begin{longtable}{>{\raggedright}p{6cm}|p{1.5cm}|p{3cm}}
  \caption{**********Yet to decide**********}
  \label{tab:ultraCost}                     \\ 
  \toprule
  Description  & Cost per 5 pack & Sensor          \\ 
  \midrule
\endfirsthead  % end first head
  \caption*{Yet to decide~-- continued}       \\ 
  \toprule
  Description  & Cost per 5 pack & Sensor          \\ 
  \midrule
\endhead % End head
  \midrule
  \multicolumn{3}{c}{continued on next page \dots} \\ 
\endfoot % End foot
  \bottomrule
\endlastfoot % End last foot

\addlinespace[1.5ex]
\begin{itemize}
  \item For fair weather application
  \item Operational temperature: 0${}^\circ$C to 65${}^\circ$C
  \item Real time automatic calibration of voltage,humidity and ambient noise
  \item Max range: 7 m (300cm) at 5V
  \item 6 m (600cm) at 3.3 V
  \item Min range: 0.2 m (20cm)
\end{itemize}
  & \$ 174.75 & MB1240 \includegraphics[height=1.2in]{Figure/fig28} \\

\begin{itemize}
  \item IP67 rated for rain and inclement weather application
  \item Operational temperature: -40${}^\circ$C to 65${}^\circ$C
  \item Real time automatic calibration and noise rejection
  \item Max range: 7 m (300cm) at 5V
  \item 6 m (600cm) at 3.3 V
  \item Min range: 0.2 m (20cm)
\end{itemize}
  & \$ 474.75 & MB7060 \includegraphics[height=1.2in]{Figure/fig29} \\

            \begin{itemize}
                \item   IP67 rated in an extra light and compact form factor
                \item   Weight: 18 gm
                \item   Operational temperature: -40${}^\circ$C to 65${}^\circ$C
                \item   Real time automatic calibration and noise rejection
                \item   Max range: 7 m (300cm) at 5V
                \item   6 m (600cm) at 3.3 V
                \item   Min range: 0.2 m (20cm)
            \end{itemize} 
            & \$ Not Available 
            & MB7267 \includegraphics[height=1.2in]{Figure/fig30} \\
             \hline


            \begin{itemize}
                \item   With I2C interface for fair weather application
                \item   I2C bus communication allows rapid control of multiple sensors with only two wires
                \item   Operational temperature: 0oC to 65oC
                \item   Real time automatic calibration and noise rejection
                \item   Max range: 7 m
                \item   Min range: 0.2 m (20cm)

            \end{itemize}
            & \$ 174.75
            & MB1242 \includegraphics[height=1.2in]{Figure/fig28} \\ \hline

\begin{itemize}
  \item With I2C interface for inclement weather application
  \item I2C bus communication allows rapid control of multiple sensors with only two wires
  \item Operational temperature: -40${}^\circ$C to 65${}^\circ$C
  \item Real time automatic calibration and noise rejection
  \item Max range: 7 m
  \item Min range: 0.2 m (20cm) 
\end{itemize}
  & \$ 474.75 
  & MB7040 \includegraphics[height=1.2in]{Figure/fig29} \\ 
\end{longtable}
\end{document}

结果:

生成第一页

答案2

作为对其他答案的补充:您的表格可以通过以下方式改进:

  • enumitem封装使用能力
  • 根据文本宽度重新定义列
  • 用于siunitx表中的所有单位
  • 删除垂直线结束增加行之间的垂直空间\addlinespace
  • 将文本区域增加到使用geomtry包确定的默认大小

尽管采取了所有这些措施,表格仍然太宽。要使其适合文本宽度,您有两个选择:(i)增加文本宽度(如果可能)或(ii)减小图像尺寸(而不是确定宽度,而是确定图像的宽度includegraphics[width=\linewidth]{...}:)

\documentclass[]{article}
\usepackage{array,booktabs}
\usepackage{longtable}

\usepackage[showframe]{geometry}% <-- default text area is now greater 
\usepackage{siunitx}            % <-- for units in text/table

\usepackage[demo]{graphicx} % to add pictures
\usepackage{caption}%to use caption under picture
%\usepackage{float}%picture was going to next page
\usepackage{enumitem}

\begin{document}
\setlist[itemize]{nosep, topsep=0pt, partopsep =0pt, leftmargin=*, 
                  before=\vspace{-\baselineskip},
                  after =\vspace{-\baselineskip}
                  }
\setlength\tabcolsep{4pt}
\begin{longtable}{%
    >{\raggedright}p{\dimexpr 5\linewidth/9-2\tabcolsep\relax}
    >{\raggedright}p{\dimexpr 1\linewidth/9-2\tabcolsep\relax}
                   p{\dimexpr 3\linewidth/9-2\tabcolsep\relax}
                  }
  \caption{**********Yet to decide**********}
  \label{tab:ultraCost}                             \\
  \toprule
  Description  & Cost per 5 pack & Sensor          \\
  \midrule
\endfirsthead  % end first head
  \caption*{Yet to decide -- continued}             \\
  \toprule
  Description  & Cost per 5 pack & Sensor           \\
  \midrule
\endhead % End head
  \midrule
  \multicolumn{3}{c}{continued on next page \dots}  \\
\endfoot % End foot
  \bottomrule
\endlastfoot % End last foot

\addlinespace[1.5ex]
\begin{itemize}
  \item For fair weather application
  \item Operational temperature: \SIrange{0}{65}{\celsius}
  \item Real time automatic calibration of voltage, humidity and ambient noise
  \item Max range: \SI{7}{m} (\SI{300}{cm}) at \SI{5}{V}
  \item \SI{6}{m} (\SI{600}{cm}) at \SI{3.3}{V}
  \item Min range: \SI{0.2}{m} (\SI{20}{cm})
\end{itemize}
  & \$ 174.75   & MB1240 \includegraphics[height=1.2in]{Figure/fig28}     \\
  \addlinespace
%
\begin{itemize}
    \item For fair weather application
    \item Operational temperature: \SIrange{0}{65}{\celsius}
    \item Real time automatic calibration of voltage, humidity and ambient noise
    \item Max range: \SI{7}{m} (\SI{300}{cm}) at \SI{5}{V}
    \item \SI{6}{m} (\SI{600}{cm}) at \SI{3.3}{V}
    \item Min range: \SI{0.2}{m} (\SI{20}{cm})
\end{itemize}
    & \$ 474.75   & MB7060 \includegraphics[height=1.2in]{Figure/fig29}       \\
  \addlinespace
%
\begin{itemize}
    \item For fair weather application
    \item Operational temperature: \SIrange{0}{65}{\celsius}
    \item Real time automatic calibration of voltage, humidity and ambient noise
    \item Max range: \SI{7}{m} (\SI{300}{cm}) at \SI{5}{V}
    \item \SI{6}{m} (\SI{600}{cm}) at \SI{3.3}{V}
    \item Min range: \SI{0.2}{m} (\SI{20}{cm})
\end{itemize}
    & \$ Not Available
                & MB7267 \includegraphics[height=1.2in]{Figure/fig30}       \\
  \addlinespace
%
\begin{itemize}
    \item   With I2C interface for fair weather application
    \item   I2C bus communication allows rapid control of multiple sensors with only two wires
    \item   Operational temperature: \SIrange{0}{65}{\celsius}
    \item   Real time automatic calibration and noise rejection
    \item Max range: \SI{7}{m} (\SI{300}{cm}) at \SI{5}{V}
    \item Min range: \SI{0.2}{m} (\SI{20}{cm})
\end{itemize}
    & \$ 174.75 & MB1242 \includegraphics[height=1.2in]{Figure/fig28}       \\ 
  \addlinespace
%
\begin{itemize}
    \item With I2C interface for inclement weather application
    \item I2C bus communication allows rapid control of multiple sensors with only two wires
    \item Operational temperature: \SIrange{-50}{65}{\celsius}
    \item Real time automatic calibration and noise rejection
    \item Max range: \SI{7}{m} (\SI{300}{cm}) at \SI{5}{V}
    \item Min range: \SI{0.2}{m} (\SI{20}{cm})
\end{itemize}
    & \$ 474.75 & MB7040 \includegraphics[height=1.2in]{Figure/fig29}       \\
\end{longtable}
\end{document}

根据上述 MWE,表格的第一行是:

在此处输入图片描述

并将图像尺寸减小到列中的可用空间:

在此处输入图片描述

相关内容