如何在reStructuredText(reST)中编写乘法符号? [英] How do I write the Multiplication Sign in reStructuredText (reST)?

查看:111
本文介绍了如何在reStructuredText(reST)中编写乘法符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写reST文档,这些文档将使用Sphinx呈现为HTML和PDF.我的源文件是UTF-8,并且希望我的HTML显示为UTF-8.

I'm writing reST documents that will be rendered to HTML and PDF using Sphinx. My source files are UTF-8, and expect my HTML to be displayed as UTF-8.

编写乘法符号的最佳实践是什么?

What's the best practice for writing the multiplication sign?

即:×,而不是x.

我知道我可以将其作为Unicode字符插入.如果我正在编写LaTeX,我会使用\times.在HTML中,有×.当我使用Sphinx渲染所有内容时,简单的Unicode是否可以在转换过程中正常生存?即使我渲染为其他更奇特的格式?

I know I can insert it as a Unicode character. If I were writing LaTeX, I'd use \times. In HTML there's ×. Is the simple Unicode going to properly survive the conversion process when I render everything with Sphinx? Even if I render to other more exotic formats?

我只想仔细检查一遍,这不会使事情绊倒.

I just want to double-check that this isn't going to trip things up somewhere.

推荐答案

事实证明Sphinx文档包含了答案,但我读得还不够多:

It turns out that the Sphinx documentation contains the answer, I just didn't read quite far enough:

因为最简单的方法 特殊字符,例如破折号或 REST中的版权标志是直接 将它们写为Unicode字符,一个 必须指定一种编码.狮身人面像 假设要在其中编码源文件 默认为UTF-8;你可以改变这个 带有source_encoding配置值.

Since the easiest way to include special characters like em dashes or copyright signs in reST is to directly write them as Unicode characters, one has to specify an encoding. Sphinx assumes source files to be encoded in UTF-8 by default; you can change this with the source_encoding config value.

https://www.sphinx -doc.org/en/master/usage/restructuredtext/basics.html#source-encoding

修改: 只是在这里进行跟进:虽然乘法符号工作得很好,但是LaTeX(因此也就是PDF)渲染中使用的默认字体缺少许多其他看似标准的unicode符号(小于或等于,大于或等于).

Just to follow up here: while the multiplication sign works just fine, many other seemingly standard unicode symbols (less than or equal to, and greater than or equal to) are missing from the default font used in LaTeX (and thus PDF) rendering.

这篇关于如何在reStructuredText(reST)中编写乘法符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆