2

I have the following code:

$$A = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} $$ and $$B = \begin{bmatrix} 0 & 0  \\ 0 & 0 \end{bmatrix} $$.

But this is displayed on two lines. How can I make these matrices as well as text appear on the center of the page, all in one line?

0

2 Answers 2

2

Use \text to write text within displayed math. However, you'll have to handle the spacing inside the \text command, since spacing is ignored in math mode. Also, you'd want to move the final period inside the display math, to prevent it from appearing on a new line.

$$A = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\text{ and }
  B = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}.$$

If you want more space between the matrices, try \quad\text{and}\quad.

(Note: you'll get slightly better spacing if you use \[ and \] to begin/end display math instead of $$.)

2
  • Thank you. That was useful. How do I represent a matrix with [ and [ though? It transforms the matrix into the array
    – Naz
    Nov 5, 2015 at 19:55
  • Not “slightly better”: $$ should not be used in LaTeX. Ever.
    – egreg
    Nov 5, 2015 at 23:01
3

You probably want (amsmath package is used):

\[
A = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \text{ and }B = \begin{bmatrix} 0 & 0  \\ 0& 0 \end{bmatrix} 
\]
2
  • You mean \text, rather than text, right? Nov 5, 2015 at 19:50
  • @ArunDebray Certainly. Corrected. Thank you! Nov 5, 2015 at 20:21

You must log in to answer this question.

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