3

I am getting a four (4) errors and 1 Bad Box with the code below. However, the output is the way I need in the PDF. Any ideas why I am getting the errors? And if so, how I can fix it.

The error is Missing $ inserted in this code:

$y_{f}$ & $=$ & \left\{\begin{array}{rl}    1, &\mbox{ if Supplier located at site $f$ is open} \\0, &\mbox{ otherwise} \end{array} \right.\

\usepackage{mathtools}  
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tabulary}
\usepackage{booktabs}

\begin{table}[htbp]\caption{Table of Notation My Research}
\vspace{-1.5em}
\begin{center}
     \begin{tabular}{r c p{10cm} }
\toprule
$R_{i}$ & $\triangleq$ & Revenue at store $i$\\
$i$ & $\triangleq$ & index value for store locations\\
${T}_{c}$ & $\triangleq$ & A very long description of this specific variable and is needed in the research and looks good when wrapped and aligned to the left.\\
$TC$ & $\triangleq$ & Total overall cost(\$)\\  
\multicolumn{3}{c}{}\\
\multicolumn{3}{c}{\underline{Decision Variables}}\\
$y_{f}$ & $=$ & \left\{\begin{array}{rl}    1, &\mbox{ if Supplier located at site $f$ is open} \\
0, &\mbox{ otherwise} \end{array} \right.\\
\bottomrule
    \end{tabular}
\end{center}
    \label{tab:TableOfNotationForMyResearch}
\end{table}

2 Answers 2

9

If you try to compile this MWE you should notice that you do not have more the bad box. In my solution I did not adopted the mbox to write the text and in the second example, instead of using the array environment I used cases (this allows you to see the difference).

\documentclass[a4paper,11pt]{article}
\usepackage{mathtools}  
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tabulary}
\usepackage{booktabs}

\begin{document}
\begin{table}[htbp]\caption{Table of Notation My Research}
\begin{center}% used the environment to augment the vertical space
% between the caption and the table
\begin{tabular}{r c p{10cm} }
\toprule
$R_{i}$ & $\triangleq$ & Revenue at store $i$\\
$i$ & $\triangleq$ & index value for store locations\\
${T}_{c}$ & $\triangleq$ & A very long description of this specific variable and is needed in the research and looks good when wrapped and aligned to the left.\\
$TC$ & $\triangleq$ & Total overall cost(\$)\\  
\multicolumn{3}{c}{}\\
\multicolumn{3}{c}{\underline{Decision Variables}}\\
\multicolumn{3}{c}{}\\
$y_f$ & $=$ & \(\left\{\begin{array}{rl}
1,  & \text{if Supplier located at site $f$ is open} \\
0,  & \text{otherwise} \end{array} \right.\)\\
\bottomrule
\end{tabular}
\end{center}
\label{tab:TableOfNotationForMyResearch}
\end{table}
\end{document}

This gives you as result:

enter image description here

If you want to have the caption much more near the table use:

\documentclass[a4paper,11pt]{article}
\usepackage{mathtools}  
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tabulary}
\usepackage{booktabs}

\begin{document}
\begin{table}[htbp]\caption{Table of Notation My Research}
\centering % to have the caption near the table
\begin{tabular}{r c p{10cm} }
\toprule
$R_{i}$ & $\triangleq$ & Revenue at store $i$\\
$i$ & $\triangleq$ & index value for store locations\\
${T}_{c}$ & $\triangleq$ & A very long description of this specific variable and is needed in the research and looks good when wrapped and aligned to the left.\\
$TC$ & $\triangleq$ & Total overall cost(\$)\\  
\multicolumn{3}{c}{}\\
\multicolumn{3}{c}{\underline{Decision Variables}}\\
\multicolumn{3}{c}{}\\
$y_f$ & $=$ & \(\begin{cases}
1,  & \text{if Supplier located at site $f$ is open} \\
0,  & \text{otherwise} \end{cases}\)\\
\bottomrule
\end{tabular}
\label{tab:TableOfNotationForMyResearch}
\end{table}
\end{document}

that gives you:

enter image description here

1
  • yes. That resolves the question. I understand now now that the cases are a better approach than array for this layout.
    – joe
    May 5, 2012 at 17:38
2

The error message tells you that you're using math constructs outside a math environment. In your case it's \left\{ ... \right. Wrap it with $...$ or \(...\) and the error should go away:

$y_{f}$ & $=$ & $\left\{
  \begin{array}{rl}    
     1, &\mbox{ if Supplier located at site $f$ is open} \\
     0, &\mbox{ otherwise} 
  \end{array} \right.$\
2
  • that worked.how about the bad bod. Overfull \hbox 7.37781pt too wide)?
    – joe
    May 5, 2012 at 8:24
  • I can't reproduce the overfull boxes from your code excerpt. It would help if you could edit your question and provide a complete compilable LaTeX document that shows the issue.
    – Martin
    May 5, 2012 at 8:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .