letsgoexploring
letsgoexploring

Reputation: 83

Issue with LaTeX and Markdown Tables in Jupyter Notebook

I am using Jupyter Notebook 6.2.0 and having an issue with LaTeX in Markdown tables. When I create a table that contains math typeset in LaTeX, the Notebook (sometimes!) renders the table so that the table spans the entire width of the Notebook. I attach a screenshot of a minimal example.

enter image description here

In the first example, the top row is a simple x in math model. The top row of the table is left-justified and the next row is right-justified creating a table that spans the Notebook and table elements that don’t align.

In the second example, without x in math mode, the table renders as expected.

This behavior is new; affecting tables that I’ve created that previously rendered properly. The problem isn't consistent either. Some tables with LaTeX that I've made do in fact render properly.

I would appreciate advice for a work-around or where to post this issue so that it can be resolved.

Thanks!

Upvotes: 2

Views: 2901

Answers (3)

Hang Wong
Hang Wong

Reputation: 21

One possible way to workaround is to add one row with empty latex display mode.

| $x$  |
| ---  |
| 0    |
| $$$$ |

Upvotes: 2

mosc9575
mosc9575

Reputation: 6337

It makes a difference if you use one or two $-signs.

This will not expand, because it will activate the display mode for math, which is always centered

|$$x$$|
|-|
|0|

while this will activate the inline code.

|$x$|
|-|
|0|

Example Output

how latex is rendered

Upvotes: 3

ddejohn
ddejohn

Reputation: 8962

For a workaround, use display mode for the math:

| $$x$$ |
| :---- |
| 0     |

Upvotes: 2

Related Questions