1

I am new to TEX world . I am now working on thesis in TEX . I have the following code to show a table .

                              \begin{center}
                              \begin{tabular}{ | l | c |  r | l | c | r|  l | c |  }
                                \hline
                                    \textbf{Basic} & \textbf{x_1} & \textbf{x_2} & \textbf{x_3} & \textbf{s_1}  & \textbf{s_2}  & \textbf{s_3} &    \textbf{b} \\ \hline
                                    s1 &    2 & 1 & 0 & 1 & 0 & 0 & 10 \\ \hline
                                    s2 & 1 & 2  & -2 &  0 & 1 & 0 & 20 \\ \hline
                                    s3 & 0 & 1 & 2 & 0 & 0 & 1 & 5 \\ \hline
                                    Z & -2 & 1 & -2 & 0 & 0 & 0 & 0 \\ \hline
                                \hline
                              \end{tabular}
                            \end{center}

But TexMaker IDE shows the following error .

! Missing $ inserted.<inserted text>$ \textbf{Basic} & \textbf{x_1}

A snapshot of my error is provided below : enter image description here

Here is my code :

enter image description here

Where is the error ?

Christopher Marlowe
  • 319
  • 2
  • 5
  • 11
  • 2
    subscripts need math mode so \textbf{$x_1$} but then you need math bold fonts. – percusse Jun 18 '14 at 11:24
  • 2
    _ is a math-char. I would suggest you to do: $\mathbf{x_1}$ for the xs. It however, requires amsmath. Also all numbers should be typeset in $$ to get mathematical fonts, see http://tex.stackexchange.com/questions/185193/what-is-the-necessity-of-around-numbers – nickpapior Jun 18 '14 at 11:25
  • You also can use \textsubscript from the subscript package (in the LaTeX bundle fragments). – Bernard Jun 18 '14 at 11:55
  • @DavidCarlisle I didn't say it wasn't ;) I also always have it! But if the OP didn't want to use it, for whatever reason... :) I can now see that however was a bad wording, English is not my primary language. I'll note that wording. – nickpapior Jun 18 '14 at 14:03

1 Answers1

2

Subscript needs the math mode. To change all your

x_index

to

$x_index$

will help you.

Typo
  • 191