# Border Matrix in Pluto

**URL:** https://discourse.julialang.org/t/border-matrix-in-pluto/72253
**Category:** General Usage
**Tags:** pluto-and-latex
**Created:** [November 29, 2021, 7:31pm UTC](https://discourse.julialang.org/t/border-matrix-in-pluto/72253 "2021-11-29T19:31:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [November 29, 2021, 7:31pm UTC](https://discourse.julialang.org/t/border-matrix-in-pluto/72253/1 "2021-11-29T19:31:41Z")

</div>

Hi,

I was wondering if it is possible to use a bordermatrix in Pluto? I tried the following without success:

```julia
md"
$M = \bordermatrix{~ & x & y \cr
              A & 1 & 0 \cr
              B & 0 & 1 \cr}$
"

```

---

<div class="post-metadata">

### Author: ![sashmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sashmit/32/18791_2.png) [@sashmit](https://discourse.julialang.org/u/sashmit)
#### Post date: [December 1, 2021, 1:17am UTC](https://discourse.julialang.org/t/border-matrix-in-pluto/72253/2 "2021-12-01T01:17:32Z")

</div>

> [@Christopher\_Fisher](#):
>
> ```julia
> md"
> $M = \bordermatrix{~ & x & y \cr
> A & 1 & 0 \cr
> B & 0 & 1 \cr}$
> "
> 
> ```

this seems to work:

> <https://stackoverflow.com/questions/53888339/alternative-to-bordermatrix-for-mathjax>

```julia

# ╔═╡ 0efec04f-c052-4f59-b41e-8dcc8f48a117
using Latexify

# ╔═╡ 64568856-c30a-40bd-93d6-258a4f3f77fd
L"\begin{align}
  f(x) &= ax^2 + bx + c \\
  &= \begin{array}{c c}
    & \begin{array} {@{} c c c @{}}
      u_1 & \cdots & u_q
    \end{array} \\
    \begin{array}{c}
      e_1 \\ \vdots \\ e_n
    \end{array}\hspace{-1em} &
    \left(
      \begin{array}{@{} c c c @{}}
        u_{11} & \cdots & u_{1q} \\
        \vdots & & \vdots \\
        u_{n1} & \cdots & u_{nq}
      \end{array}
    \right) \\
    \mbox{} % Blank line to match column names so as to align the = vertically
  \end{array} \\[-12pt] % Correction for blank line
  &= ax^2 + bx + c
\end{align}"

```

you should be able to create a function to scaffold a julia type with the latex w/ latexify

another option is to try katex instead of mathjax:

> <https://github.com/disberd/PlutoExtras.jl/blob/master/src/latex_equations.jl>

the advantage of katex is that because it can be limited to one context (like a cell), it is more customizable.

---

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [December 1, 2021, 1:27pm UTC](https://discourse.julialang.org/t/border-matrix-in-pluto/72253/3 "2021-12-01T13:27:39Z")

</div>

Thank you for your answer. Is it possible to do this inside the notebook cell rather than the .jl file? The following did not work:

```julia
md"
L"\begin{align}
  f(x) &= ax^2 + bx + c \\
  &= \begin{array}{c c}
    & \begin{array} {@{} c c c @{}}
      u_1 & \cdots & u_q
    \end{array} \\
    \begin{array}{c}
      e_1 \\ \vdots \\ e_n
    \end{array}\hspace{-1em} &
    \left(
      \begin{array}{@{} c c c @{}}
        u_{11} & \cdots & u_{1q} \\
        \vdots & & \vdots \\
        u_{n1} & \cdots & u_{nq}
      \end{array}
    \right) \\
    \mbox{} % Blank line to match column names so as to align the = vertically
  \end{array} \\[-12pt] % Correction for blank line
  &= ax^2 + bx + c
\end{align}"
"

```

---

<div class="post-metadata">

### Author: ![sashmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sashmit/32/18791_2.png) [@sashmit](https://discourse.julialang.org/u/sashmit)
#### Post date: [December 1, 2021, 3:54pm UTC](https://discourse.julialang.org/t/border-matrix-in-pluto/72253/4 "2021-12-01T15:54:13Z")

</div>

> [@Christopher\_Fisher](#):
>
> Thank you for your answer. Is it possible to do this inside the notebook cell rather than the .jl file? The following did not work:

CommonMark seems to work for me instead of the built in Markdown. It works in many situations where Markdown doesn’t work: [CommonMark Math in Pluto](https://discourse.julialang.org/t/commonmark-math-in-pluto/68104)

I had to remove the comments in the latex since they seemed to break the parser but worked fine after that.

```julia
# ╔═╡ d1657bc0-61e4-4129-9dd5-7bd7e89a3629
using CommonMark

# ╔═╡ f23b0978-7f30-47b1-b6bd-dbb72c25b82f
cm"""
``
\begin{align}
  f(x) &= ax^2 + bx + c \\
  &= \begin{array}{c c}
    & \begin{array} {@{} c c c @{}}
      u_1 & \cdots & u_q
    \end{array} \\
    \begin{array}{c}
      e_1 \\ \vdots \\ e_n
    \end{array}\hspace{-1em} &
    \left(
      \begin{array}{@{} c c c @{}}
        u_{11} & \cdots & u_{1q} \\
        \vdots & & \vdots \\
        u_{n1} & \cdots & u_{nq}
      \end{array}
    \right) \\
    \mbox{} 
  \end{array}
  &= ax^2 + bx + c
\end{align}
``
"""

```

---

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [December 1, 2021, 7:21pm UTC](https://discourse.julialang.org/t/border-matrix-in-pluto/72253/5 "2021-12-01T19:21:14Z")

</div>

Thank you for your help!
