2

while I am using RevTex 4.2, I keep getting "Missing $ inserted " error message after I created a table, which has two $\pm$ notes. I used $$ for \pm, but I do not understand why I keep getting the message. Can you help me?

\documentclass[%
 preprint,
 doublecolumn,
 amsmath,amssymb,
 aps,
prc,

]{revtex4-2}
\usepackage{anyfontsize}
\usepackage{float}
\usepackage{mathtools, nccmath}
\usepackage{graphicx}% Include figure files
\usepackage{tabularx}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
%\usepackage{hyperref}% add hypertext capabilities
\usepackage[mathlines]{lineno}% Enable numbering of text and display math
\usepackage{amsmath}
\linenumbers\relax % Commence numbering lines
%\usepackage{latexsym}
%\usepackage[showframe,%Uncomment any one of the following lines to test 
%%scale=0.7, marginratio={1:1, 2:3}, ignoreall,% default settings
%%text={7in,10in},centering,
%%margin=1.5in,
%%total={6.5in,8.75in}, top=1.2in, left=0.9in, includefoot,
%%height=10in,a5paper,hmargin={3cm,0.8in},
%]{geometry}

\begin{document}
\begin{table}
\caption{}
\begin{ruledtabular}
\begin{tabular}{lcdr} 
\textrm{$\theta$}& \textrm{C$\pm \sigma C$ }&\textrm{ Time}\\
\colrule

 $1$ & $1\pm 1$ &$1\pm$ \\
 $1$ & $1\pm 1$ &$1\pm$ \\

\end{tabular}
\end{ruledtabular}
\end{table}

\end{document}

Thank you in advance

2
  • 1
    Welcome! The error comes from the d column, which you do not use here. Replace \begin{tabular}{lcdr} by \begin{tabular}{lcr}.
    – user194703
    Commented Dec 6, 2019 at 4:50
  • \documentclass[% preprint, amsmath,amssymb, aps, prc]{revtex4-2} \usepackage{amsmath} \begin{document} \begin{table} \caption{Three columns.} \begin{ruledtabular} \begin{tabular}{lcr} $\theta$& \textrm{C}$\pm \sigma C$ &\textrm{Time}\\ \colrule $1$ & $1\pm 1$ &$1\pm$ \\ $1$ & $1\pm 1$ &$1\pm$ \\ \end{tabular} \end{ruledtabular} \end{table} \end{document}.
    – user194703
    Commented Dec 6, 2019 at 5:14

1 Answer 1

1

You are using a d-column (defined by revtex4-2 as being a particular D-column) that requires some form of decimal representation. More importantly, D-columns always sets its cell content in math mode. From the dcolumn package documentation:

It should be noted that dcolumn always uses math mode for the digits as well as the separator.

So, avoid using math mode in the column entries. Here is a toned-down version of your code, even though it doesn't really use the functionality of a D-column:

enter image description here

\documentclass{revtex4-2}

\usepackage{dcolumn}% Align table columns on decimal point

\begin{document}

\begin{table}
  \caption{Some table}
  \begin{ruledtabular}
    \begin{tabular}{ l c d }
      $\theta$ & $C \pm \sigma C$ & Time \\
      \colrule
       $1$ & $1\pm 1$ & 1 \pm 2 \\
       $1$ & $1\pm 1$ & 1 \pm 3
    \end{tabular}
  \end{ruledtabular}
\end{table}

\end{document}
5
  • This information is already in the comments above. But without typesetting Time in math mode.
    – user194703
    Commented Dec 6, 2019 at 6:01
  • @Schrödinger'scat On the other hand: Werner presented a real MWE as solution.
    – Jan
    Commented Dec 6, 2019 at 6:59
  • @Jan There is a real MWE in the comments.
    – user194703
    Commented Dec 6, 2019 at 7:01
  • @Schrödinger'scat: Your comment suggests avoiding the d-column.
    – Werner
    Commented Dec 6, 2019 at 17:59
  • Yes. This is appropriate if there are no decimal points in that column.
    – user194703
    Commented Dec 6, 2019 at 18:04

You must log in to answer this question.

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