I am trying to understand Jekyll.
I'm using Kramdown as the markdown processor.
There is a bizzarre difference in the way mathjax is processed in title and content.
Say I want to write
In the front matters of a post I have to write something like this:
title: \(\sqrt x\)
Text in the frontmatter (metadata) is not parsed as Markdown. In fact, Jekyll strips the frontmatter from the document before passing it to Kramdown. Kramdown never even sees the frontmatter. Therefore your "title" is passed through as-is, no escaping needed. If it helps, the frontmatter is not part of Markdown. It is an add-on that is Jekyll specific.
In contrast, within the Markdown text, the mathjax needs to be escaped. Some mathjax syntax conflicts with Markdown syntax, so the parser needs to be told what is mathjax and what is not. That is accomplished by surrounding the mathjax with the proper deliminators. The Markdown parser then strips the escape characters from the content, but otherwise leaves the content unchanged.