Log in Sign up

Mysterious latex problems?

I am working on a post with some latex equations. They look great and everything, but when there is a latex error of some kind it fails silently, and prevents changes from reflecting in my post.

Tracing down an error is a lot of work, but I isolated a few of them, and now that I've traced the problems, I am completely baffled. Very mundane things like adding () around something can cause it to fail, and I can't figure out why.

For example I have a line

$$A_{ij}$$ contains $$(X_{i,c}W_{c,0})X$$.

which apparently works fine because the page renders, but if I change it to

$$A_{ij}$$ contains $$(X_{i,c}W_{c,0})(X)$$.

then all changes I make to the document are blocked, and aren't reflected until I remove the surrounding () from X.

Another problematic snippet is

The resulting attention matrix is
$$
A = XW^Q W^K^\intercal X^\intercal
$$

Which renders the middle W^K correctly, but everything else is left as plain text..

Then if I include the subsequent paragraph, again, changes are blocked.

While this is easy to lay out, it is very difficult to interpret. The meaning of each barcode depends entirely on which other barcodes are present, so the meaning of $$W^Q$$ and $$W^K$$ can't be nailed down without context.

But if I remove it I can make changes again (but the proceeding equation still renders wrong)

I can't reproduce any of these issues with my own local latex environments, and I've tried all kinds of variations to figure out what is wrong.

Does anyone know what is going on?


5 months ago, 2 replies   bug   math   Edit question

Blot uses KaTeK behind the scenes, so if the equation triggers an error with that library it will likely tank the build process for the entire post.

This is not ideal. I will make sure that a single bad equation will not prevent the entire post from updating.

Would it be useful to replace the 'broken equation' in the output page with the error message?

It's a tricky UX problem, I've tried to avoid showing error messages to your readers so I'll need to give this some thought. Hopefully you can see the trade-off I'm working with

I'll follow up here once I've collected my thoughts on this – please send us an email if you'd like to be notified of any changes

Answered a year ago · Edit answer

I ran into this as well.

Regarding UI: I would render the original (unformatted) string with the $$ delimeters rather than show an error message. I think it will be clear to the author that there is a problem (specifically that the LaTex is not being rendered) and I think it will not puzzle the reader with esoteric errors.

Answered 5 months ago · Edit answer