Skip to content

Instantly share code, notes, and snippets.

@jesshart
Last active August 6, 2024 07:02
Show Gist options
  • Save jesshart/8dd0fd56feb6afda264a0f7c3683abbf to your computer and use it in GitHub Desktop.
Save jesshart/8dd0fd56feb6afda264a0f7c3683abbf to your computer and use it in GitHub Desktop.
LaTeX matrix in GitHub

This Does Not Work
$\begin{bmatrix}X\Y\end{bmatrix}$

This Does
See how using the math "language" for syntax renders what you want.

This is the code:

```math
\begin{bmatrix}X\\Y\end{bmatrix}
```

This is how it renders:

$$\begin{bmatrix}X\\Y\end{bmatrix}$$
@LdDl
Copy link

LdDl commented Mar 13, 2023

Another workaround to place new lines

$$x_{k} = \begin{bmatrix}
x_{k} \\
x'_{k}
\end{bmatrix} = \begin{bmatrix}
x_{k-1} + x'_{k-1}\Delta t + \frac{x''_{k-1}(\Delta t^2)}{2} \\
x'_{k-1} + x''_{k-1}t
\end{bmatrix} \tag{15}$$
$$x_{k} = \begin{bmatrix} x_{k} \\\ x'_{k} \end{bmatrix} = \begin{bmatrix} x_{k-1} + x'_{k-1}\Delta t + \frac{x''_{k-1}(\Delta t^2)}{2} \\\ x'_{k-1} + x''_{k-1}t \end{bmatrix} \tag{15}$$

@jesshart
Copy link
Author

jesshart commented Aug 5, 2024

@LdDl I do not see your code render properly.

@LdDl
Copy link

LdDl commented Aug 6, 2024

@LdDl I do not see your code render properly.

thanks. I've updated my comment (added math tag). Here is screenshot how I see it:
image

Seems like $$ works in markdown, but not it gist comments section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment