Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

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

share|improve this answer
    
yes. That resolves the question. I understand now now that the cases are a better approach than array for this layout. –  joe May 5 '12 at 17:38
add comment

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.$\\
share|improve this answer
    
that worked.how about the bad bod. Overfull \hbox 7.37781pt too wide)? –  joe May 5 '12 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 '12 at 8:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.