Problems with katex

I’m using $f(x)$ and $(x_n)_{n}$ and $(y_n)_{n}$ in my markdown file. After jekyll clean && jekyll serve, the result is


If I remove the curly braces, everything is fine. What’s the problem?

I’ve not used katex, so not sure. If you searched for jekyll katex to see if there are any blog posts about how it works? I found a few.

Maybe you need to wrap it in {% raw %} {% endraw %} so jekyll doesn’t process the curly brackets as liquid?

I had tried this method. However, it didn’t work.

Sorry, I am unfamiliar with this functionality, but it would be good to see what you expected vs. the output you received.

This is my expectation:

Demo markdown file for the problem:

---
layout: post
title: title
category: 
description: 
math: true
---
{% raw %}
$f(x)$ and $(x_n)_{n}$ and $(y_n)_{n}$
{% endraw %}

When using kramdown:

Using inline math is also easy: just surround your math content with two dollar signs, like with a math block.

So try $$…$$ instead of $…$.