Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why I have additional $$ characters before and after rendered LaTex equations? #818

Open
3 tasks done
LYK-love opened this issue Jul 3, 2024 · 2 comments
Open
3 tasks done
Labels
Bug Something isn't working

Comments

@LYK-love
Copy link

LYK-love commented Jul 3, 2024

Issue Checklist

Expected behavior

For markdown codes like

The gradient-ascent algorithm maximizing $J(\theta)$ is
$$
\begin{aligned}
\theta_{t+1} 

&= \theta_t+\alpha \color{orange}{\nabla_\theta J (\theta_t )} \\
&= \theta_t+\alpha \color{orange}{\mathbb{E}_{S \sim \eta, A \sim \pi(S, \theta)} [\nabla_{\theta} \ln \pi (A \mid S, \theta_t) q_{\pi}(S, A) ]}
\end{aligned}
$$



The stochastic gradient-ascent algorithm is
$$
\theta_{t+1}=\theta_t+\alpha \color{pink}{\nabla_\theta \ln \pi\left(a_t \mid s_t, \theta_t\right) q_\pi\left(s_t, a_t\right)}
$$
We can see "actor" and "critic" from this algorithm

It is expected to render two LaTex equation blokcks,
image
NOTE: This image is from my markdown editor Typora, which renders perfectly, instead of from a deployed site with Hexo Next.

Actual behavior

image

However, in the deployed site (either locally or on the Internet) I have these two additional $$s around my blocks sometimes. This means that my render engine, hexo-renderer-pandoc, may work incorrectly?

Steps to reproduce the behavior

The gradient-ascent algorithm maximizing $J(\theta)$ is
$$
\begin{aligned}
\theta_{t+1} 

&= \theta_t+\alpha \color{orange}{\nabla_\theta J (\theta_t )} \\
&= \theta_t+\alpha \color{orange}{\mathbb{E}_{S \sim \eta, A \sim \pi(S, \theta)} [\nabla_{\theta} \ln \pi (A \mid S, \theta_t) q_{\pi}(S, A) ]}
\end{aligned}
$$



The stochastic gradient-ascent algorithm is
$$
\theta_{t+1}=\theta_t+\alpha \color{pink}{\nabla_\theta \ln \pi\left(a_t \mid s_t, \theta_t\right) q_\pi\left(s_t, a_t\right)}
$$
We can see "actor" and "critic" from this algorithm

Node.js and NPM Information

v22.3.0
10.8.1

Package dependencies Information

Hexo Configuration

...

# Writing
new_post_name: :title.md # File name of new posts
default_layout: draft
titlecase: false # Transform title into titlecase
external_link:
  enable: true # Open external links in new tab
  field: site # Apply to the whole site
  exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
syntax_highlighter: highlight.js
highlight:
  line_number: true
  auto_detect: false
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  preprocess: true
  line_number: true
  tab_replace: ''

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## updated_option supports 'mtime', 'date', 'empty'
updated_option: 'mtime'

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
  type: git
  repo:
    github: [email protected]:LYK-love/LYK-love.github.io.git
  branch: master

search:
  path: search.xml
  field: post
  content: true
  format: html

  
filter_optimize:
  enable: true
  # remove the surrounding comments in each of the bundled files
  remove_comments: false
  css:
    # minify all css files
    minify: true
    # bundle loaded css files into one
    bundle: true
    # use a script block to load css elements dynamically
    delivery: true
    # make specific css content inline into the html page
    #   - only support the full path
    #   - default is ['css/main.css']
    inlines:
    excludes:
  js:
    # minify all js files
    minify: true
    # bundle loaded js files into one
    bundle: true
    excludes:
  # set the priority of this plugin,
  # lower means it will be executed first, default of Hexo is 10
  priority: 12

sitemap:
  path: sitemap.xml

## Config of hexo-renderer-markdown-it
## Deprecated since I use hexo-renderer-pandoc instead.
# markdown:
#   preset: 'default' # 渲染器默认预设 # "commonmark": 使用严格 CommandMark 规定. # "default": 默认配置, 类似于 GFM # "zero": 禁用所有预设.
#   render:
#     html: true
#     xhtmlOut: false # 将 HTML 内容渲染为 XHTML 的形式 (XHTML 语法非常严格, 比如原 HTML 中的 <br> 标签必须要使用 <br/> 这样的形式进行 "自闭和") 可能会出现兼容性问题.
#     langPrefix: 'language-'
#     breaks: true # true 则将所有换行渲染为 <br> 标签 # 这种行为不属于 CommandMark 和 GFM.
#     linkify: true # true 则自动解析链接并添加为 <a> 标签, false 则将链接渲染为文本.
#     typographer: false # 默认 true # 自动转义各种排版用字符, 如 ©. 这甚至会转义掉LaTex中的字符, 所以不能开启
#     quotes: '“”‘’' # 当 typographer 定义为 true 时的自动转换引号的行为, quotes: '“”‘’' 则表示将 "123" '123'转换为 “123” ‘123’
#   enable_rules:
#   disable_rules:
#   plugins:
#   anchors:
#     level: 1 # 开始创建锚点的等级, 默认为2,表示从 H2 开始创建一直到 H6(最后).
#     collisionSuffix: '' # 如果遇到重复的锚点 ID 为其添加数字编号时在这个数字后添加的后缀.
#     permalink: true #  默认为false, 需要更改为true, 来创建一个除标题外带有固定地址的的锚点标签.
#     permalinkClass: 'header-anchor'
#     permalinkSide: 'left' # 设定为 right 则会在标题后添加固定链接.
#     permalinkSymbol: '' # 更改为空字符串
#     case: 0 # 转换锚点 ID 中的字母为大写或小写 # "0" 不转换, "1" 为小写, "2" 为大写. “不转换”是为了方便手写Anchor
#     separator: '-' # 用于替换空格的符号. # 默认为 "-"

NexT Configuration

scheme: Mist

Other Information

No response

@LYK-love LYK-love added the Bug Something isn't working label Jul 3, 2024
@sghuang19
Copy link
Member

sghuang19 commented Aug 15, 2024

@LYK-love Could you share which math engine are you using? It should be in the something like this under _config.next.yml:

math:
  every_page: false
  mathjax:
    enable: true
    tags: none
  katex:
    enable: false
    copy_tex: false

Also please share your markdown key in _config.yml, like this:

markdown:
  render:
    breaks: false
  plugins:

@LYK-love
Copy link
Author

@LYK-love Could you share which math engine are you using? It should be in the something like this under _config.next.yml:

math:
  every_page: false
  mathjax:
    enable: true
    tags: none
  katex:
    enable: false
    copy_tex: false

Also please share your markdown key in _config.yml, like this:

markdown:
  render:
    breaks: false
  plugins:

Sure, my math renderer is hexo-renderer-pandoc and I use mathjax.

math:
  # Default (false) will load mathjax / katex script on demand.
  # That is it only render those page which has `mathjax: true` in front-matter.
  # If you set it to true, it will load mathjax / katex script EVERY PAGE.
  every_page: false

  mathjax:
    enable: true
    # Available values: none | ams | all
    tags: ams

  katex:
    enable: false
    # See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex
    copy_tex: false
$ npm list

[email protected] /Users/lyk/Documents/LYK-love.github.io
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

I don't have markdown key in _config.yml. I think it's for hexo-renderer-markdown-it, while I use hexo-renderer-pandoc instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants