[Tex/LaTex] Array Problems Math mode

amsmatharraysmath-mode

\documentclass[12pt,a4paper,notitlepage]{report}
\usepackage{amsmath}
\usepackage{array}
\usepackage{multirow}

\begin{document}

\[
\begin{array}{llll} \hline
& \multirow{2}{*}{\tilde{b}\leq b^{NG}} & \multicolumn{2}{c}{\tilde{b}>b^{NG}} \\ \cline{3-4}
& & b^{G} \leq \tilde{b} & b^{G}>\tilde{b} \\ \hline
b^{UL} & b^{NG} & \tilde{b} & b^{G} \\ \hline
\end{array}
\]

\end{document}

This is the error I get:

Package amsmath Error: \tilde allowed only in math mode.ng text

It tried at changing \tilde{b} to $\tilde{b}$ but it gave the same error.
I do not understand why this is not working as I created a math environment for the array by using \[ and \].

Best Answer

The argument to \multirow is always typeset in text mode, unlike the argument of \multicolumn that knows to distinguish between being called by array or tabular.

I suggest using the rules of booktabs.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array,booktabs}
\usepackage{multirow}

\begin{document}

\[
\begin{array}{llll}
\toprule[\lightrulewidth]
& \multirow{2}{*}{$\tilde{b}\leq b^{NG}$} & \multicolumn{2}{c}{\tilde{b}>b^{NG}} \\
\cmidrule[\lightrulewidth]{3-4}
& & b^{G} \leq \tilde{b} & b^{G}>\tilde{b} \\
\midrule
b^{UL} & b^{NG} & \tilde{b} & b^{G} \\
\bottomrule[\lightrulewidth]
\end{array}
\]

\end{document}

enter image description here

Of course, avoiding multirow is even better:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array,booktabs}

\begin{document}

\[
\begin{array}{llll}
\toprule[\lightrulewidth]
& \tilde{b}\leq b^{NG} & \multicolumn{2}{c}{\tilde{b}>b^{NG}} \\
\cmidrule[\lightrulewidth]{3-4}
& & b^{G} \leq \tilde{b} & b^{G}>\tilde{b} \\
\midrule
b^{UL} & b^{NG} & \tilde{b} & b^{G} \\
\bottomrule[\lightrulewidth]
\end{array}
\]

\end{document}

enter image description here

Related Question