1

I've been using LaTeX for 7 years and I can't figure this one out.

This compiles:

\begin{tabular}{ |c|c| }
 \hline
 [TCTA]10 & 2637 \\
 \hline
\end{tabular}
\end{center}

This also compiles (I can put any character there on the first slot of the second table line, including a space character like \;, and it will still work):

\begin{center}
\begin{tabular}{ |c|c| }
 \hline
 [TCTA]10 & 2637 \\
 A [TCTA]8 TCTG [TCTA]1 & 2093 \\
 \hline
\end{tabular}
\end{center}

But this does not compile:

\begin{center}
\begin{tabular}{ |c|c| }
 \hline
 [TCTA]10 & 2637 \\
 [TCTA]8 TCTG [TCTA]1 & 2093 \\
 \hline
\end{tabular}
\end{center}

The error I get is something I can't make sense of, and Google hasn't helped:

"Missing number, treated as zero." It says a number should have been at the end of the second line. "Illegal unit of measure (pt inserted).... Dimensions can be in units of em, ex, in, ..., bp, or sp; but yours is a new one!"

The only other answer I could find that relates to this had to do with a \textwidth command, which I'm not using.

A list of packages I have included:

\usepackage{amsmath,amssymb,amsthm,amsfonts,bm,centernot,graphicx,mathrsfs,mathtools,physics,setspace,subcaption,titlesec,wrapfig}
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[normalem]{ulem}

1 Answers1

2

Thank you so much, Bernard and frougon!

This works:

[TCTA]10 & 2637 \\
{[TCTA]}8 TCTG [TCTA]1 & 2093 \\

This also works:

[TCTA]10 & 2637 \\\relax
[TCTA]8 TCTG [TCTA]1 & 2093 \\ %\relax on last line will throw error

And this works, too:

[TCTA]10 & 2637 \\
\lbrack TCTA]8 TCTG [TCTA]1 & 2093 \\
  • 1
    To explain a bit what is happening, \\ takes an optional argument: \\[some length] will adjust the vertical spacing by that amount. When TeX sees \\ followed by (ignoring whitespace) [, it thinks you're doing the optional argument. The ways that work are ways to tell TeX that you're not using the optional argument (another possibility is \\{}). – Teepeemm Mar 28 '20 at 02:32
  • I can't upvote comments yet but thank you so much for the explanation! – ichthyophile Mar 30 '20 at 12:21