Skip to content

bordermatrix in MathJaX #2031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DayuanJiang opened this issue Jul 16, 2018 · 8 comments
Open

bordermatrix in MathJaX #2031

DayuanJiang opened this issue Jul 16, 2018 · 8 comments

Comments

@DayuanJiang
Copy link

It would be nice to have the option to use bordermatrix in MathJaX. Like below.

img @ #

@pkra
Copy link
Contributor

pkra commented Jul 16, 2018

Cf. #1127

@ArtPoon
Copy link

ArtPoon commented Feb 8, 2019

@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:
bordermatrix

It's not perfect but hopefully close enough..

@DayuanJiang
Copy link
Author

DayuanJiang commented Feb 8, 2019

@ArtPoon
Too many backslashes hahaha
Anyway, thanks for the solution.

@ArtPoon
Copy link

ArtPoon commented Feb 8, 2019

@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).

@pkra
Copy link
Contributor

pkra commented Feb 8, 2019

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 &, <, >.

@ArtPoon
Copy link

ArtPoon commented Feb 8, 2019

Yes I'm using revealJS with Markdown. I was going to elaborate but then figured it was too much info :)

@mauriciopoppe
Copy link

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}
}

@sindzicat
Copy link

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:
image

@dpvc dpvc removed the Duplicate label Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants