# Array Problems Math 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$.

• Welcome to TeX.SX! The argument to \multirow is typeset in text mode. It's only \multicolumn that adjusts to math mode in array and text mode in tabular. Mar 3 '16 at 13:29
• thanks a lot egreg for the fast answer. that is the fix :) Mar 3 '16 at 13:56

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}


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}


• thx egreg. this looks even better in spacing and you can manually set the thickness of the horizontal lines! Awesome! Mar 4 '16 at 9:45