如何在WordPress中编写数学方程式

Do you want to write math equations in WordPress?

您是否要在WordPress中编写数学方程式?

Writing math equations in WordPress is a bit difficult as the default WordPress editor does not come with full support for mathematical equations.

在WordPress中编写数学方程式有点困难,因为默认的WordPress编辑器并未完全支持数学方程式。

In this article, we will show you how to easily write math equations in WordPress using 3 different methods.

在本文中,我们将向您展示如何使用3种不同的方法在WordPress中轻松编写数学方程式。

Writing math equations in WordPress

为什么用WordPress编写数学方程式比较困难? (Why Writing Math Equations in WordPress is Difficult?)

The way WordPress works is that it dynamically generates your website content and sends HTML output back to the users’ browsers to display it.

WordPress的工作方式是动态生成您的网站内容,并将HTML输出发送回用户的浏览器以显示它。

Writing mathematical and scientific equations in WordPress is difficult due to the lack of support for the characters in HTML.

由于缺乏对HTML字符的支持,因此用WordPress编写数学和科学方程很困难。

Currently, MathML and LaTeX are considered to be the standard for writing mathematical and scientific equations on the web.

当前,MathML和LaTeX被认为是在网络上编写数学和科学方程的标准。

Unfortunately, they are both less than ideal for beginners. They both require you to learn their own syntax which could get complicated for longer and more complex equations.

不幸的是,它们都不适合初学者。 它们都需要您学习自己的语法,对于更长或更复杂的方程式,它们可能会变得复杂。

That being said, let’s take a look at how to write math equations in your WordPress blog.

话虽如此,让我们看看如何在WordPress博客中编写数学方程式。

We’ll start off with an easy solution first before showing how to use MathML or LaTeX in WordPress.

在展示如何在WordPress中使用MathML或LaTeX之前,我们将首先从一个简单的解决方案开始。

方法1.使用Unicode字符在WordPress中编写数学方程式 (Method 1. Writing Math Equations in WordPress using Unicode Characters)

This method is simpler and is recommended for users who don’t need to write math equations frequently. For this method, we’ll be using Unicode characters and inserting them directly in the post editor.

此方法更简单,建议不需要频繁编写数学方程式的用户使用。 对于这种方法,我们将使用Unicode字符并将其直接插入到帖子编辑器中

Unicode is the encoding standard with the aim to provide character encoding support for all languages. It is supported by all website builders, operating systems, and mobile devices.

Unicode是编码标准,旨在为所有语言提供字符编码支持。 所有网站建设者 ,操作系统和移动设备都支持它。

Here is how to add mathematical characters in WordPress using Unicode.

这是使用Unicode在WordPress中添加数学字符的方法。

1. Adding Unicode Mathematical Characters in Mac

1.在Mac中添加Unicode数学字符

On Mac computers, you can add mathematical operators and characters from the toolbar at the top. Simply click on Edit » Emoji & Symbols or press Command + Control + Space keys on your keyboard.

在Mac计算机上,您可以从顶部的工具栏中添加数学运算符和字符。 只需单击编辑»表情符号和符号或按键盘上的Command + Control +空格键。

Character Viewer

This will bring up the ‘Character Viewer’ app in a popup. From here you can select the symbols and characters that you want to insert.

这将在弹出窗口中打开“角色查看器”应用程序。 在这里,您可以选择要插入的符号和字符。

Simply double click on a character to insert it in the WordPress post editor.

只需双击一个字符即可将其插入WordPress帖子编辑器。

You can also format characters in the post editor using the subscript and superscript options in paragraph toolbar.

您也可以使用段落工具栏中的下标和上标选项在帖子编辑器中设置字符格式。

Using subscript and superscript in WordPress paragraph block

2. Adding Unicode Mathematical Characters in Windows

2.在Windows中添加Unicode数学字符

Windows users can use a similar app to insert mathematical operators and special characters in WordPress post editor.

Windows用户可以使用类似的应用程序在WordPress帖子编辑器中插入数学运算符和特殊字符。

Simply open the Character Map app by clicking on Start » Windows Accessories » Character Map. This will bring up the showing commonly used characters on screen.

只需单击开始»Windows附件»字符映射表,即可打开字符映射表应用程序。 这将在屏幕上弹出显示的常用字符。

Character Map app in Windows 10

The Character Map app supports many different encodings including Unicode. You can find math operators by selecting the Unicode Subrange under Group.

字符映射应用程序支持许多不同的编码,包括Unicode。 您可以通过选择“组”下的“ Unicode子范围”来找到数学运算符。

After locating a character, you need to click to select it and then copy it. Now switch back to the WordPress content editor and paste the character.

找到一个字符后,您需要单击以选中它,然后将其复制。 现在切换回WordPress内容编辑器并粘贴字符。

Manually adding special characters and mathematical operators is a hassle, but it works if you’re only adding this once in a while.

手动添加特殊字符和数学运算符很麻烦,但是如果您不时添加一次,则可以使用。

However, if you regularly need to write mathematical equations on your site, then you’ll be better off learning to use either of the two methods described below.

但是,如果您经常需要在自己的站点上编写数学方程式,那么最好学习使用下面介绍的两种方法之一。

2.使用LaTeX在WordPress中编写数学方程式 (2. Writing Math Equations in WordPress using LaTeX)

LaTeX is a typesetting standard designed specifically for writing technical and scientific documentation. It is widely used in academic circles and is considered to be the de facto standard for writing equations and other scientific documents.

LaTeX是排版标准,专门用于编写技术和科学文档。 它在学术界被广泛使用,被认为是编写方程式和其他科学文献的事实上的标准。

The official LaTeX website has detailed documentation and links to the tutorials and guide that will help you learn how to use it.

LaTeX官方网站上有详细的文档,以及指向教程和指南的链接,可帮助您学习使用方法。

We’ll focus on how to bring LaTeX typesetting to your WordPress website.

我们将重点介绍如何将LaTeX排版带入您的WordPress网站。

First, you need to install and activate the WP QuickLaTeX plugin. For more details, see our step by step guide on how to install a WordPress plugin.

首先,您需要安装并激活WP QuickLaTeX插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to edit the post or page where you want to insert a math equation. On the post edit screen, click on the add new block button (+) and insert the shortcode block to your content.

激活后,您需要编辑要在其中插入数学方程式的帖子或页面。 在帖子编辑屏幕上,单击添加新块按钮(+),然后将简码块插入到您的内容中。

Shortcode block

Inside the shortcode, you need to add the shortcode [latexpage] followed by your LaTeX code.

在简码内部,您需要添加简码[latexpage]后跟您的LaTeX代码。

Adding a LaTeX command in a shortcode block

You can now save your post and preview it to see your math equation with formatting.

现在,您可以保存您的帖子并进行预览,以查看带有格式设置的数学方程式。

A math equation displayed in WordPress using LaTeX

An easier way to generate the code that you need to paste is by using an offline LaTeX app for your operating system or a web-based LaTeX environment like Overleaf.

生成需要粘贴的代码的一种更简便的方法是使用适用于您的操作系统的脱机LaTeX应用程序或基于Web的LaTeX环境(如Overleaf)

Overleaf

You can then copy and paste your equations in the shortcode block in WordPress.

然后,您可以将方程式复制并粘贴到WordPress的shortcode块中。

3.使用MathML在WordPress中编写数学方程式 (3. Writing Math Equations in WordPress using MathML)

MathML is a markup language designed to easily publish mathematical equations on the web. It uses a semantic XML markup similar to HTML.

MathML是一种标记语言,旨在轻松在网络上发布数学方程式。 它使用类似于HTML的语义XML标记。

WordPress doesn’t support MathML out of the box, and if you added the MathML code in the post editor, then it will not render correctly.

WordPress不支持开箱即用的MathML,如果您在帖子编辑器中添加了MathML代码,则它将无法正确呈现。

Luckily, there is a plugin that solves that problem.

幸运的是,有一个插件可以解决该问题。

Simply install and activate the MathML Block plugin. For more details, see our step by step guide on how to install a WordPress plugin.

只需安装并激活MathML Block插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, simply edit the post or page where you wan to add the math equation. On the post edit screen, click on the add new block button (+) and add the Custom HTML block to your content.

激活后,只需编辑您想要添加数学方程式的帖子或页面即可。 在帖子编辑屏幕上,单击添加新块按钮(+),然后将自定义HTML块添加到您的内容中。

Adding custom HTML block in WordPress

You can now paste your MathML code inside the custom HTML block.

现在,您可以将MathML代码粘贴到自定义HTML块中。

Adding MathML code in WordPress

After that, you can save your post or page and view it in a new tab to see MathML beautifully transformed on your website.

之后,您可以保存您的帖子或页面,并在新选项卡中查看它,以查看MathML在您的网站上进行了精美的转换。

MathML preview

MathML Block uses the MathJax JavaScript engine to convert your markup into readable math equations. It also supports LaTeX commands.

MathML Block使用MathJax JavaScript引擎将标记转换为可读的数学方程式。 它还支持LaTeX命令。

To add your LaTeX code, simply add the MathML block to your content editor.

要添加LaTeX代码,只需将MathML块添加到内容编辑器中。

Adding MathML block

In the MathML block’s text area, you can paste your LaTeX code like this:

在MathML块的文本区域中,您可以像这样粘贴LaTeX代码:

\[ your equation goes here\]

\[ your equation goes here\]

You can now save and preview your post to see it beautifully displayed in your blog post or page.

现在,您可以保存和预览您的帖子,以将其精美地显示在博客帖子或页面中。

LaTeX in MathML Block

We hope this article helped you learn how to add math equations in WordPress. You may also want to see our ultimate list of the most useful WordPress widgets and the must have WordPress plugins recommended by our experts.

我们希望本文能帮助您学习如何在WordPress中添加数学方程式。 您可能还想查看我们最有用的WordPress小部件的最终列表,以及必须由我们的专家推荐的WordPress插件

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/beginners-guide/how-to-write-math-equations-in-wordpress/

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:编程工作室 设计师:CSDN官方博客 返回首页
评论
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值