MathJax
MathJax copied to clipboard
bordermatrix in MathJaX
It would be nice to have the option to use bordermatrix in MathJaX. Like below.
@ #
Cf. #1127
@DayuanJiang, I ended up just nesting a whole bunch of matrices:
$$\begin{matrix}
& \begin{matrix}A&C&G&T\end{matrix} \\\\
\begin{matrix}A\\\\C\\\\G\\\\T\end{matrix} &
\begin{pmatrix}1&2&3&4\\\\3&4&5&6\\\\3&4&5&6\\\\3&4&5&6\end{pmatrix}\\\\
\end{matrix}$$
which yields:
It's not perfect but hopefully close enough..
@ArtPoon
Too many backslashes hahaha
Anyway, thanks for the solution.
@DayuanJiang, you may already know this but the extra backslashes are a workaround for displaying MathJax in HTML (see http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents).
extra backslashes are a workaround for displaying MathJax in HTML
I'm guessing you mean markdown (though some markdown processors have specialized TeX handling and do not require escaping).
For HTML, you'd primarily need to escape &, <, >
.
Yes I'm using revealJS with Markdown. I was going to elaborate but then figured it was too much info :)
As a reference I have this macro:
bordermatrix: ['\\newcommand\\bordermatrix[3]{ \\begin{matrix} & \\begin{matrix}#1\\end{matrix} \\\\ \\begin{matrix}#2\\end{matrix} \\hspace{-1em} & #3 \\end{matrix}}', 3]
Usage \bordermatrix{top labels}{left labels}{content}
:
\bordermatrix{A&C&G&T}{A\\C\\G\\T}{
\begin{pmatrix}1&2&3&4\\3&4&5&6\\3&4&5&6\\3&4&5&6\end{pmatrix}
}
This is the best for me:
\begin{matrix}
& \\
K_1 = \cfrac{EI_b}{L^3_b} \cdot
\left ( \vphantom{ \begin{matrix} 12 \\ 12 \\ 12 \\ 12 \end{matrix} } \right .
\end{matrix}
\hspace{-1.2em}
\begin{matrix}
y_1 & \theta_1 & y_2 & \theta_2 \\ \hline
12 & 6b & -12 & 6b \\
6b & 4b^2 & -6b & 2b^2 \\
-12 & -6b^2 & 12 & -6b \\
6b & 2b^2 & -6b & 4b^2
\end{matrix}
\hspace{-0.2em}
\begin{matrix}
& \\
\left . \vphantom{ \begin{matrix} 12 \\ 12 \\ 12 \\ 12 \end{matrix} } \right )
\begin{matrix}
y_1 \\ \theta_1 \\ y_2 \\ \theta_2
\end{matrix}
\end{matrix}
Result: