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 ?

  • 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 tex.stackexchange.com/questions/185193/… – zeroth 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. – zeroth Jun 18 '14 at 14:03
2

Subscript needs the math mode. To change all your

x_index

to

$x_index$

will help you.

| improve this answer | |

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.