markdown - Preventing pandoc from adding a space after comma used as a decimal separator in math mode - Stack Overflow

I am using pandoc to convert markdown files containing TeX bits to html.Because the text is in Italian

I am using pandoc to convert markdown files containing TeX bits to html.

Because the text is in Italian, I want to use comma as a decimal separator. However, pandoc keeps adding a space after the comma. Here is a simple example:

echo '0,5 $0,5$' | pandoc

it gives:

<p>0,5 <span class="math inline">0, 5</span></p>

Notice the space is not added when the number is not in math mode.

What I want is something similar to what is achieved by LaTeX package icomma, or some other workaround to prevent the insertion of the space. Any advice?

I am using pandoc to convert markdown files containing TeX bits to html.

Because the text is in Italian, I want to use comma as a decimal separator. However, pandoc keeps adding a space after the comma. Here is a simple example:

echo '0,5 $0,5$' | pandoc

it gives:

<p>0,5 <span class="math inline">0, 5</span></p>

Notice the space is not added when the number is not in math mode.

What I want is something similar to what is achieved by LaTeX package icomma, or some other workaround to prevent the insertion of the space. Any advice?

Share Improve this question asked Mar 20 at 14:58 Massimo2013Massimo2013 5931 gold badge5 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

TeX math mode does not treat a comma like an ordinary character, but you can circumvent that by putting the comma in {}. However, that only works if you use MathJax for rendering:

echo 0,5 vs. $0,5$ vs. $0{,}5$ | pandoc --mathjax -s

outputs an HTML document equivalent to the following snippet:

<script src="https://cdn.jsdelivr/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
<p>0,5 vs. <span class="math inline">\(0,5\)</span> vs. <span
class="math inline">\(0{,}5\)</span></p>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744401335a4572402.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信