You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决Pandoc无法将特定LaTeX公式转换为Docx的问题

问题解决:LaTeX方程组转Docx时Pandoc转换失败

问题详情

  • 原LaTeX公式(可在MathType、MathJax正常渲染):
$\left\{ {\begin{array}{*{20}{l}} {(m + 2)x = 1}\\ {3x - (m - 3){y^{\left| m \right| - 2}} + 4 = 0} \end{array}} \right.$
  • Pandoc转换时的报错警告:
Could not convert TeX math \left\{ {\begin{array}{*{20}{l}} {(m + 2)x = 1}\\ {3x - (m - 3){y^{\left| m \right| - 2}} + 4 = 0} \end{array}} \right., rendering as TeX: t\{ {\begin{array}{*{20}{l}} {(m + 2)x = ^ unexpected "*" expecting white space, letter, "|" or "}"

原因分析

Pandoc使用的TeX解析器不支持*{20}{l}这种非标准列格式语法——这是MathType等工具扩展的写法,用于指定列宽度,但标准LaTeX和Pandoc的解析器无法识别该语法。

解决方法

将非标准的*{20}{l}替换为标准LaTeX列格式语法即可:

  1. 若仅需左对齐(原写法的核心需求),直接用l:
$\left\{ {\begin{array}{l} {(m + 2)x = 1}\\ {3x - (m - 3){y^{\left| m \right| - 2}} + 4 = 0} \end{array}} \right.$
  1. 若需要固定列宽度,使用标准的p{宽度值}格式(示例为20em宽度):
$\left\{ {\begin{array}{p{20em}} {(m + 2)x = 1}\\ {3x - (m - 3){y^{\left| m \right| - 2}} + 4 = 0} \end{array}} \right.$

修改后的公式可被Pandoc正常转换为Docx,同时在MathType、MathJax中依然能正常渲染。

内容的提问来源于stack exchange,提问作者accbear

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 04:38:17