6

I see some tables with a horizontal line placed at the middle of a cell, for terms not available or not applicable. For example, how shall I replace the "N.A." below with such a line?

\begin{table}[htbp]
\centering
\caption{Caption}
\begin{tabular}{ccc}
\hline
Auctions of & P\_value &  $\widehat{\theta}$ \\
\midrule
2  & 0.375 & $\underset{(0.230)}{0.354}$ \\
3  & 0.002 & N.A. \\
\bottomrule
\end{tabular}
\end{table}
Masroor
  • 17,842
Jie Wei
  • 889
  • Is \--- enough? Or maybe \-- or even \verb+-+. – Sigur May 16 '14 at 23:33
  • @Sigur \--- and \--? Did you mean --- and --? – egreg May 17 '14 at 08:09
  • @egreg, I always had used that. What is the difference? Non breakable? – Sigur May 17 '14 at 15:56
  • @Sigur \- gives a discretionary hyphen, so \--- is a discretionary hyphen followed by an en-dash. – egreg May 17 '14 at 16:56
  • @egreg, but with no space between them? So is not possible to see the difference between --- and \---? – Sigur May 17 '14 at 17:02
  • 1
    @Sigur I don't understand what you're saying; \- is a control symbol, so it's already a complete control sequence name; \--- is three tokens: \-, - and -; unless you change the definition of \-, \- is a discretionary hyphen and, at typesetting time, -- is converted to an en-dash. – egreg May 17 '14 at 17:06
  • @egreg, after testing your codes I understood. foo-foo\-foo--foo---foo foo-foo\-foo\--foo---foo foo-foo\-foo\--foo\---foo – Sigur May 17 '14 at 17:15
  • @JieWei, please, see on the comments above that the right one is without back slash. ---. – Sigur May 17 '14 at 18:13

1 Answers1

12

I suggest defining a command \NA that holds an em-dash ---:

enter image description here

\documentclass{article}
\usepackage{booktabs,amsmath}
\newcommand{\NA}{---}
\begin{document}

\begin{tabular}{ccc}
  \toprule
  Auctions of & \detokenize{P_value} &  $\widehat{\theta}$ \\
  \midrule
  2  & 0.375 & $\underset{(0.230)}{0.354}$ \\
  3  & 0.002 & \NA \\
  \bottomrule
\end{tabular}

\end{document}

This way, if you don't like it later (in life), just change the definition to something more suitable (perhaps an en-dash --).

Werner
  • 603,163