1

So far, this is what I got.

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\usepackage[square]{natbib}
\usepackage{amssymb}
\usepackage{float}
\usepackage{caption}
\usepackage{appendix}
\frenchspacing
 $\begin{array}{  l  l  l  l  l  }
 & Stage & ln\_labor & ln\_hours & p(emp) \\ \hline\hline
\text{Currently living in urban areas}  & 1st & 0.21482 & 0.13242 & 0.19161 \\ 
 & 2nd & -0.09168 & -0.06626 & -0.16811 \\ \hline
\text{Lived in a state capital when aged 15} & 1st & 0.47462 & 0.63929^{*} & 0.95309^{**} \\ 
 & 2nd & 0.04447 & 0.11124 & -0.08064 \\ \hline
\text{Lived in urban area when aged 15} & 1st & 0.65694^{**} & 0.57415^{**} & 0.60316^{*} \\ 
 & 2nd & 0.24461^{**} & 0.15895 & -0.08445 \\ \hline
\text{Currently living in urban areas}  & 1st & 0.01835 & 0.02033 & 0.01678 \\ 
 & 2nd & -1.198 & -0.54056 & -1.7587 \\ \hline
\text{Lived in a state capital when aged 15} & 1st & 0.04432 & 0.0328 & 0.0331 \\ 
 & 2nd & 1.822 & 2.263 & 0.01657 \\ \hline
\text{Lived in urban area when aged 15} & 1st & 0.09357^{**} & 0.08919^{**} & 0.09271^{***} \\ 
 & 2nd & 1.775^{**} & 1.1184 & -0.26679 \\ 
\caption{$*$ for significant at $10\%$, $**$ for significance at $5\%$ and $***$ for significance at $1\%$}

\end{array}
$

And I get this error message:

Package caption Error: \caption outside float.

See the caption package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.15 \caption
             {$*$ for significant at $10\%$, $**$ for significance at $5\%$ ...

So, what do I do?

  • 1
    Off-topic: The caption of a table should normally consist of a brief statement regarding the contents of the table. Using the \caption command to provide auxilliary information -- e.g., to explain what 1, 2, and 3 stars mean -- is rather unusual. For your table, something like \caption{Regression results} (or whatever is most appropriate) would seem to be called for. And, to make sure that people will notice the caption easily, place it above the tabular material. The string "$*$ for significant ... $1\%$" can still be placed below the tabular material. – Mico May 28 '18 at 6:36
4

For example, environment table can be added:

\begin{table}
  \caption{...}
  $\begin{array}{...}
    ...
  \end{array}$
\end{table}
3

First, caption is normally inserted inside a float environment like table and figure. Here, table seems more correct. Second, you used array instead of tabular though the content is mainly text, switch to tabular. Third, to better align numbers use the dcolumn package to align numbers around the decimal point. Finally, using booktabs can greatly improve readability with adding small spaces between different rows, \addlinespace.

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\usepackage[square]{natbib}
\usepackage{amssymb}
\usepackage{float}
\usepackage{booktabs}
\usepackage{dcolumn} 
\frenchspacing

\begin{document}

\begin{table}\centering
\caption{$^*$for significant at 10\%, $^{**}$for significance at 5\% and $^{***}$for significance at $1\%$}\par\medskip
\begin{tabular}{ @{} l l *3{D{.}{.}{6}} }
\toprule
 & Stage & \multicolumn{1}{c}{ln\_labor} & \multicolumn{1}{c}{ln\_hours} & \multicolumn{1}{c}{p(emp)} \\ \midrule
Currently living in urban areas  & 1\textsuperscript{st} & 0.21482 & 0.13242 & 0.19161 \\ 
 & 2\textsuperscript{nd} & -0.09168 & -0.06626 & -0.16811 \\ \addlinespace
Lived in a state capital when aged 15 & 1\textsuperscript{st} & 0.47462 & 0.63929^{*} & 0.95309^{**} \\ 
 & 2\textsuperscript{nd} & 0.04447 & 0.11124 & -0.08064 \\ \addlinespace
Lived in urban area when aged 15 & 1\textsuperscript{st} & 0.65694^{**} & 0.57415^{**} & 0.60316^{*} \\ 
 & 2\textsuperscript{nd} & 0.24461^{**} & 0.15895 & -0.08445 \\ \addlinespace
Currently living in urban areas  & 1\textsuperscript{st} & 0.01835 & 0.02033 & 0.01678 \\ 
 & 2\textsuperscript{nd} & -1.198 & -0.54056 & -1.7587 \\ \addlinespace
Lived in a state capital when aged 15 & 1\textsuperscript{st} & 0.04432 & 0.0328 & 0.0331 \\ 
 & 2\textsuperscript{nd} & 1.822 & 2.263 & 0.01657 \\ \addlinespace
Lived in urban area when aged 15 & 1\textsuperscript{st} & 0.09357^{**} & 0.08919^{**} & 0.09271^{***} \\ 
 & 2\textsuperscript{nd} & 1.775^{**} & 1.1184 & -0.26679 \\ \bottomrule
\end{tabular}
\end{table}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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