在普通文本中有效\begin{equation}...\end{equation}
但在表格中无效的代码;从此扩展而来线。
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter\ceil{\left\lceil}{\right\rceil}
\DeclarePairedDelimiter\floor{\left\lfloor}{\right\rfloor}
\begin{document}
\begin{table}
\center
\begin{tabular}{ | l | l | }
\hline
Best case height of B-tree & $\ceil{ \log\limits_{m} \left( n+1 \right) }$ \\ \hline
\end{tabular}
\end{table}
\end{document}
给出错误
Overfull \hbox (35.21378pt too wide) in paragraph at lines 578--579
[]
<use "settings.jpg" > [10] [11] [12]
! Extra }, or forgotten \right.
\MT_delim_ceil_nostar_wrapper:nnn ...mathopen {#1}
#2\mathclose {#3}
l.614 \ceil{ \log\limits_{m} \left( n+1 \right) }
?
! Missing } inserted.
<inserted text>
}
l.614 \ceil{ \log\limits_{m} \left( n+1 \right) }
?
! Extra }, or forgotten \right.
\MT_delim_floor_nostar_wrapper:nnn ...athopen {#1}
#2\mathclose {#3}
l.621 ...ts_{d} \left( \frac{ n+1 }{ 2 } \right) }
.
?
! Missing } inserted.
<inserted text>
}
l.621 ...ts_{d} \left( \frac{ n+1 }{ 2 } \right) }
.
?
! Extra }, or forgotten \right.
\MT_delim_ceil_nostar_wrapper:nnn ...mathopen {#1}
#2\mathclose {#3}
l.636 ...eil{ \log\limits_{m} \left( n+1 \right) }
$ \\ \hline
?
! Missing } inserted.
<inserted text>
}
l.636 ...eil{ \log\limits_{m} \left( n+1 \right) }
$ \\ \hline
?
)
Runaway argument?
{ \log \limits _{d} \left ( \frac { n+1 }{ 2 }$ \\ \hline Insertion i\ETC.
! File ended while scanning use of \\MT_delim_floor_nostar:.
<inserted text>
\par
<*> answer.tex
答案1
您误用了\left
和\right
。 的定义\ceil
不应该有它们;它们在 周围也是多余的n+1
。
还要注意,这\log\limits
是没有意义的,因为\log
永远不会取上下限。顺便说一句,在表格中的事实完全无关紧要。
\documentclass{article}
\usepackage{mathtools,booktabs}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\begin{document}
\begin{table}
\center
\begin{tabular}{ll}
Best case height of B-tree & $\ceil{\log_{m} (n+1)}$ \\
\addlinespace
Best case height of B-tree & $\ceil[\big]{\log_{m} (n+1)}$ \\
\addlinespace
Best case height of B-tree & $\ceil[\Big]{\log_{m} (n+1)}$ \\
\addlinespace
Best case height of B-tree & $\ceil*{\log_{m} (n+1)}$
\end{tabular}
\end{table}
\end{document}
请注意,在这种情况下,通过获得的自动大小\ceil*
不会创建更大的分隔符。
始终建议浏览包装手册。