表格和文本中出现过满 \hbox 错误,不确定是什么问题,有什么帮助吗?

表格和文本中出现过满 \hbox 错误,不确定是什么问题,有什么帮助吗?

我对我的表格使用了下面的代码,内容不太长,我不确定为什么会收到这个错误消息,尽管编译看起来不错......

\documentclass[a4paper, 11pt, oneside]{Thesis}  
% Include any extra LaTeX packages required
\usepackage[square, numbers, comma, sort&compress]{natbib}  % Use the "Natbib" style for the references in the Bibliography
\usepackage{verbatim}  
\usepackage{vector}  
\hypersetup{urlcolor=blue, colorlinks=true}  
    \begin{table}[h!]
    \caption{Optimized cycling conditions.\label{Optimized cycling conditions.}}
    \centering
    \begin{tabular}{|c c c c|} 
     \hline
     \large{\textbf{Step}} & \large{\textbf{Time}} & \large{\textbf{Temperature}} & \large{\textbf{Comment}}  \\ [0.5ex] 
     \hline\hline
     Initial heat activation & 5 min & 95°C & Activates DNA polymerase  \\ 
     \hline
     3 step cycling: total 35 cycles     & 15s &95°C & Denaturing    \\ 
     \hline
      & 15s & 60°C &Annealing \\
     \hline
      & 10s & 72°C &Extension \\
     \hline
       & 2 min & 72°C & Final extension \\
     \hline
     & $\infty$ & 72°C& holding \\
     \hline
     \end{tabular}
    \end{table}

对于我收到类似错误消息的文本,我使用的文本如下所示-

The following day, XX was performed to check the identity of ABC. Firstly, the XX to digest the  were selected from SMC web tool \texttt{(https://www.promega.com.au/resources/tools/retool/)} (For IFN$\beta$, XbaI+ Hind III; for NF-$\kappa$B, Bgl II+ Xho I). The XX and their references are below-

答案1

由于您声称表格对于页面来说并不算太宽,但您仍然会收到框溢出警告:如果您\usepackage{showframe} \renewcommand*\ShowFrameColor{\color{red}}在文档的序言中添加内容,则会收到一组红线,指示文本区域和边距。从以下屏幕截图中可以看出,您的表格确实太宽了。此外,url 突出到边距中,导致您观察到警告消息。

在此处输入图片描述

这是代码版本,我在其中更改了表格的布局,以确保其适合可用空间。对于 URL,我改用了\urlot \texttt

在此处输入图片描述

这是一个可编译的 MWE,假设使用以下模板:https://www.overleaf.com/latex/templates/monash-thesis-template-latex/fcjzjygysncw

\documentclass[a4paper, 11pt, oneside]{Thesis}  
% Include any extra LaTeX packages required
\usepackage[square, numbers, comma, sort&compress]{natbib}  % Use the "Natbib" style for the references in the Bibliography
\usepackage{verbatim}  
\usepackage{vector}  
\hypersetup{urlcolor=blue, colorlinks=true}

\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\begin{document}



\mainmatter  
\pagestyle{fancy} 

\begin{table}[htbp]
\caption{Optimized cycling conditions.\label{Optimized cycling conditions.}}
\centering
\begin{tabular}{llcl} 
 \toprule
 Step & Time & Temperature & Comment  \\ 
 \midrule
 Initial heat activation          & \qty{5}{\min} & \qty{95}{\celsius} & Activates DNA polymerase  \\ \addlinespace 
 3 step cycling: total 35 cycles  & \qty{15}{\s}  & \qty{95}{\celsius} & Denaturing                \\ \addlinespace 
                                  & \qty{15}{\s}  & \qty{60}{\celsius} & Annealing                 \\ \addlinespace 
                                  & \qty{10}{\s}  & \qty{72}{\celsius} & Extension                 \\ \addlinespace 
                                  & \qty{2}{\min} & \qty{72}{\celsius} & Final extension           \\ \addlinespace 
                                  & $\infty$      & \qty{72}{\celsius} & holding                   \\
 \bottomrule
 \end{tabular}
\end{table}

The following day, XX was performed to check the identity of ABC. Firstly, the XX to digest the  were selected from SMC web tool \url{(https://www.promega.com.au/resources/tools/retool/)} (For IFN$\beta$, XbaI+ Hind III; for NF-$\kappa$B, Bgl II+ Xho I). The XX and their references are below-

\end{document}

答案2

更有帮助的是最小工作示例我们可以复制、粘贴和编译,而无需下载非标准类或包。

您的表格警告来自第一行。查看如何在表格单元格中包含多行。您的文本警告(可能)来自使用\texttt排版 url。由于您的类无论如何都会加载 hyperref,因此只需使用\url。(“可能”是因为如果不知道输入的确切文本,几乎不可能诊断出过满的水平框,并且“XX”不是您文档中的内容。)

答案3

好吧,你可以忽略这个错误,除非它真的超出了页面范围。我经常遇到这种情况,但当编译正常时,我就忽略它。除非它影响编译本身,否则你不必担心。此外,当你发布问题时,有一个编写代码的选项,这样看起来会好得多。

相关内容