3

Code which works in \begin{equation}...\end{equation} within the normal text but not in the table; extended from this thread.

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

gives the errors

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 Answers1

3

You're misusing \left and \right. The definition of \ceil should not have them; they are also redundant around n+1.

Note also that \log\limits is meaningless, because \log never takes limits above and below. By the way, the fact of being in a table is completely irrelevant.

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

Note that the automatic size, obtained by \ceil*, doesn't create bigger delimiters in this case.

enter image description here

Browsing the package manuals is always recommended.

egreg
  • 1,121,712