3
$\begingroup$

I have this matrix:

$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} $

and I want to show a new user how to type this, by adding \$ \$:

\$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \$,

which doesn't make what's inside the brackets text.

How do you fix this?

$\endgroup$
8
$\begingroup$

If you want some part of text not to be rendered, simply include it in backticks, like this:

`$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} $`.

You will get: $ \begin{pmatrix} a & b \\ c & d \end{pmatrix} $.

So you could leave a comment like:

To write down a matrix you can use the syntax $ \begin{pmatrix} a & b \\ c & d \end{pmatrix} $ - like here $ \begin{pmatrix} a & b \\ c & d \end{pmatrix} $.

Double dollars are not a way to achieve this - they are used for centered formulas. Writing $$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} $$ gives you this: $$ \begin{pmatrix} a & b \\ c & d \end{pmatrix}$$

And - as you checked yourself - \$ ... \$ does not work in this way either. You probably used this because you are used to this from LaTeX. (Still you can use \$ inside math mode - as in $\$$ which renders as $\$$ - but that's not what you need here.)

$\endgroup$
  • $\begingroup$ I didn't realise you needed ` instead of \ before the dollar signs. Thanks for helping! $\endgroup$ – Toby Mak Oct 14 '18 at 2:00

You must log in to answer this question.

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