# 添加对 Latex 风格块和行内数学的支持

**URL:** <https://meta.discourse.org/t/add-support-for-latex-style-blocks-and-inlines-for-math/393638>\
**Category:** Support\
**Tags:** math\
**Created:** [2024 年6 月 8 日 09:20 UTC](https://meta.discourse.org/t/add-support-for-latex-style-blocks-and-inlines-for-math/393638 "2024-06-08T09:20:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![ozkn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ozkn/32/196013_2.png) [@ozkn](https://meta.discourse.org/u/ozkn)\
发布日期： [2024 年6 月 8 日 09:20 UTC](https://meta.discourse.org/t/add-support-for-latex-style-blocks-and-inlines-for-math/393638/1 "2024-06-08T09:20:47Z")

</div>

人工智能以 LaTeX 格式提供答案。我写了一个提示来将这种 LaTeX 格式转换为 MathJax 格式，但该提示并不总是被实现，而是以 LaTeX 格式响应。当我将我的问题写到 OpenAI 社区时，收到了以下建议。

“我决定不值得费力地在系统提示中添加内容，因为我可以在我的端上对结果进行以下操作：

```plaintext
    translateLaTex = (val: string): string => {
        if (val.indexOf("\\\\") == -1) return val;

        return val.replaceAll("\\\\(", "$")//
            .replaceAll("\\\\)", "$")//
            .replaceAll("\\[", "$")//
            .replaceAll("\\]", "$");
    }

```

您可以在下一次更新中应用此解决方案吗？”

---

_[View the full topic](https://meta.discourse.org/t/add-support-for-latex-style-blocks-and-inlines-for-math/393638)._
