0

I have the following code:

\begin{center}
    \textbf{W}  =  the player with the white dice win the game, \\ % Line 1
    \textbf{B_{i1}}  =  the red die shows i, where  i  =  1,2,3,4,5,6 % Line 2
\end{center}

When I remove \textbf{} from line 2 the code exits successfully other it gives the following error:

Missing $ inserted. \textbf{B_i}
Extra }, or forgotten $. \textbf{B_i}
Command \end{center} invalid in math mode. \end{center}
Something's wrong--perhaps a missing \item. \end{center}
Something's wrong--perhaps a missing \item. \end{center}
Missing $ inserted. \end{center}
Missing } inserted. \end{center}

I have looked here and here but couldn't find them helpful.

Anyone, please help. Thanks in advance

5
  • B_{i1} needs math mode, hence the error
    – daleif
    Nov 17, 2020 at 12:05
  • 1
    \textbf is working, the underscore _ is the problem as it needs math mode.
    – campa
    Nov 17, 2020 at 12:05
  • @campa in this way $\textbf{B_i}$ it again shows an error. But when I use it in the following way \textbf{$B_i$} the boldface is lost. :(
    – Kumar
    Nov 17, 2020 at 12:09
  • 2
    \textbf switches to text, so you can't use _ within its argument. Maybe you want $\mathbf{B}_{i}$ but the intended output is not quite clear.
    – campa
    Nov 17, 2020 at 12:11
  • Thank you very much @campa
    – Kumar
    Nov 17, 2020 at 12:12

1 Answer 1

3

I guess you are looking for something like this:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\[
\begin{split}
\mathbf{W}     &= \text{the player with the white dice wins the game,} \\ % Line 1
\mathbf{B}_{i} &= \text{the red die shows $i$, where $i =  1,\dotsc,6$.} % Line 2
\end{split}
\]

\end{document}

enter image description here

I use an unnumbered displayed equation \[...\] instead of a center environment, and align the equal signs.

\textbf is a macro which makes boldface text: if you write \textbf{B_i} you get an error because the underscore is allowed only in math mode; if you write \textbf{$B_i$} you get no error but the math is of course not bold.

You must log in to answer this question.

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