- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试下载 node.js Mathjax 库并运行 GitHub 页面上提供的示例:https://github.com/mathjax/MathJax-node
我遵循的步骤:
第 1 步: mkdir mydemo
第 2 步: cd mydemo
第 3 步: npm install mathjax-node
第 4 步:从 GitHub 网站废弃示例 javascript 代码
// I place this in file ".\lib\main.js
// a simple TeX-input example
var mjAPI = require("mathjax-node");
mjAPI.config({
MathJax: {
// traditional MathJax configuration
}
});
mjAPI.start();
var yourMath = 'E = mc^2';
mjAPI.typeset({
math: yourMath,
format: "TeX", // or "inline-TeX", "MathML"
mml:true, // or svg:true, or html:true
}, function (data) {
if (!data.errors) {console.log(data.mml)}
});
第 5 步:我设置“.\index.html”来加载 mathjax 的 Javascript 演示代码。
<html>
<head>
<script src="./lib/main.js></script>
</head>
<body></body>
</html>
第 6 步:我将 index.html 加载到 Chrome Web 浏览器中。什么都没发生。 :-(
诚然,我对 javascript 和 Node.js 的了解有点糟糕。但是,我做错了什么?为什么我在网络浏览器窗口中看不到“e=mc^2”的 mathjax 排版?
更新
好的,我纠正了。它在命令行中工作如下:
C:\mydemo> node .\lib\main.js
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" alttext="E = mc^2">
<mi>E</mi>
<mo>=</mo>
<mi>m</mi>
<msup>
<mi>c</mi>
<mn>2</mn>
</msup>
</math>
我的问题是如何让这个 javascript 设置在 Web 浏览器中显示为可以放在我的网站上的 Web 应用程序?而不是使用“node”命令从 Windows 命令行运行它?
然后还有另一个问题,如果我将 Node 脚本生成的 mathml 代码废弃到 html 文档中,它仍然没有使用正确的类型设置来显示“e=mc^2”。示例:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" alttext="E = mc^2">
<mi>E</mi>
<mo>=</mo>
<mi>m</mi>
<msup>
<mi>c</mi>
<mn>2</mn>
</msup>
</math>
</body>
</html>
看到格式很丑......它甚至没有将“2”变成上标或其他 latex 好的排版......
最佳答案
更简单...将其保存在 mathjax 中:
第 1 步:
mkdir demo1
cd demo1
第 2 步:将 mathjax javascript 库的本地副本下载到 demo1 目录
npm i mathjax
第 3 步:
在demo1目录下创建index.html文件:
<!DOCTYPE html>
<html>
<head>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
});
</script>
<script type="text/javascript" src="./node_modules/mathjax/MathJax.js?config=TeX-AMS_HTML-full"></script>
</head>
<body>
<p>
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
</p>
</body>
</html>
关于node.js - 使用 mathjax 和 node.js 在网络浏览器中显示 latex 数学方程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55973971/
有没有办法让某些文本仅在 [draft] 选项处于事件状态时显示。 例如,当草稿选项处于事件状态时,我希望在我的标题和摘要之间出现一些文字:“草稿:未经许可不得引用”或诸如此类。 最佳答案 通常这是用
我有一个小问题,我想将 LaTeX 文档的 svn diff 插入到 另一个 LaTeX 文档,目标是显示自修订版 XXX 以来发生的变化。 但是,由于差异包含大量 LaTeX 命令,我无法将其直接包
如何用它们的定义替换所有出现的用户定义的 latex 宏? 例如,给定这个文件 旧的.tex \newcommand{\blah}[2]{#1 \to #2} ... foo \blah{egg}{s
是否可以在 LaTeX 的一个环境 block 中使用多个命令?我试过类似的东西,但没有用...... \begin{sffamily,emph} I'm sans serif and ita
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 8 年前。 Improve
我想将每个项目彼此更靠近,即减少行距,但我没有找到任何有用的东西。 \begin{itemize} \item Processor: Intel Core \textsuperscr
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 9年前关闭。 Improve this que
我试图在 LaTeX 文档中插入四个数字,但如果我使用 subfigure 命令,我的两个数字保留在第一行,另外两个转到第二行。像这样: 我尝试的另一个解决方案是使用 minipage 命令,但 mi
我将做大量的讲义,然后将它们编译成 LaTeX,这样我就可以拥有出色的文档供将来查看。我正在尝试组织事物,以便我可以拥有一堆包含讲座笔记的小文档,然后在学期结束时将它们编译成包含所有内容的大文档。我过
我有几个引理,其中指定了常量 $C_1$、$C_2$ 等以供以后引用。当然,当我稍后在中间插入一个新的常量定义时,这很烦人。我想要的是一个宏,它可以让我为常量分配标签并为我处理编号。我在想一些事情 %
我想制作一个包含两个目录的 LaTeX 文档,例如: Contents overview 1 - Introduction 2 - Solution Detailed contents 1 - Int
我正在使用 Latex 输入一堆数字 \begin{figure}[h] \centering \subfloat 等等。 如何让 subfloat 数字转到下一页?我的意思是,我输入了大
我在 \documentclass{article}在 latex 。我如何将顾问的名字放在第一页上?我在 latex 中看到过类似 \principaladvisor{} 的例子。但这似乎是通过论文
我目前卡住了,有两个单独的词汇表:main & acronyms . Acronyms词汇表在文本中首次使用时打印脚注,但 main词汇表没有。除了 acronyms 之外,还有什么方法可以制作任何其
如何在 Latex 中定义标签和对自定义环境的相应引用? 例子: \newcounter{fpcounter} \newenvironment{fp}[2] { \stepcounter{fpcoun
我希望doxygen文档生成器根本不生成任何LaTeX文件。 HTML对我来说足够了。是否可以配置doxygen.ini来这样做? 最佳答案 如果使用doxygen.ini是doxygen的配置文件,
我有一个关于 Latex 表的简单对齐问题。在 它看起来如下: \begin{center} \begin{tabular}{| c | l | l | } \hline \tt {
我对 LaTeX 中的定理编号有疑问。我可以按小节编号,例如 Theorem 1.2.1 对于第一节第二小节中的第一个定理。但我需要它给我看 只有小节和定理的编号,而不是节编号,如下所示: Theor
在标题部分中,我引用了文档的各个部分: \section {标题\cite {abc},\cite {def}} 文本 我也在使用目录功能,但是Latex必须首先查看标题(针对目录)中的引文,并为它们
我正在写一个程序(用C语言编写,但我想那不太重要),它与LaTeX中的一些记录 Material 有关。我希望纪录片 Material 包含原始代码中的代码片段。 为了包括源代码并使其保持最新,我在文
我是一名优秀的程序员,十分优秀!