0

Is there a way to add LaTeX packages to jupyter lab? I need "math tools" package for making a matrix look compact since "asmmath" package (which jupyter seems to have) is not adequate for my purposes.

I am trying to write a compact looking inline 4x4 matrix as enormous matrices looks ugly in inline usage.

Writing $\begin{bmatrix} -c^2 & 0 & 0 & 0\\ 0 & \frac{a^2(t)}{1-kr^2} & 0 & 0\\ 0 & 0 & a^2(t)r^2 & 0\\ 0 & 0 & 0 & a^2(t)r^2sin^2\theta \end{bmatrix}$ for 4x4 matrices results in something not appropriate for inline uses due to its size. Normally "asmmath" package has a solution for this as following: $\big[\begin{bmatrix} -c^2 & 0 & 0 & 0\\ 0 & \frac{a^2(t)}{1-kr^2} & 0 & 0\\ 0 & 0 & a^2(t)r^2 & 0\\ 0 & 0 & 0 & a^2(t)r^2sin^2\theta \end{bmatrix}\big)$

But this definition fails for 4x4 matrices. It makes the "[]" smaller but its content overflows to outside.

"mathtools" package offers the exact same definition in a more compact way... and for some reason it works correctly even for 4x4 matrices. The definition from "mathtools" package is given below:

$\begin{bsmallmatrix} -c^2 & 0 & 0 & 0\\ 0 & \frac{a^2(t)}{1-kr^2} & 0 & 0\\ 0 & 0 & a^2(t)r^2 & 0\\ 0 & 0 & 0 & a^2(t)r^2sin^2\theta  \end{bsmallmatrix}$

So that's why I need to find out a way to add "mathtools" LaTeX package to Jupyter Lab.

  • Maybe this is your answer: https://stackoverflow.com/questions/40448200/jupyter-notebook-how-to-usepackage-for-latex – duffymo May 20 '23 at 14:17
  • Thanks for your answer : ) but it seems to be for notebook to latex. Unfortunately, I will be getting pdf via html as it is more practical so it won't work for me. I need to find a way to somehow make it work on notebook level. – Mr. Science May 20 '23 at 14:56
  • My mistake, sorry. I think http://tex.stackexchange.com might be better for your question: https://tex.stackexchange.com/questions/492445/adding-packages-to-jupyter-notebook-specifically-physics-packages – duffymo May 20 '23 at 14:58
  • Thanks for the recommendation : ) Sorry for replying late – Mr. Science May 22 '23 at 15:36

0 Answers0