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

使用exam类的LaTeX文档转Markdown:fillin与parts环境适配问题

解决exam类LaTeX转Markdown的两个问题

1. 修复\fillin格式错乱问题

原伪定义对\fillin的参数处理有误,导致长度参数[3cm]被当成普通文本残留输出。修改\fillin的定义,明确接收两个可选参数,只保留答案部分并忽略长度参数:

\renewcommand\fillin[2][{}]{\textbf{#1}}

修改后\fillin[blanks][3cm]会被正确转换为**blanks**,不会再出现3cm\]这类多余内容。

2. 移除parts环境生成的:::

要让pandoc忽略\begin{parts}和\end{parts},直接重定义parts环境为空即可:

\renewenvironment{parts}{}{}

如果需要保留part的列表结构,可同时将\part定义为列表项:

\renewcommand{\part}[1][]{\item}

完整修正后的伪定义代码

% 忽略parts环境
\renewenvironment{parts}{}{}
% 将part转换为列表项(不需要列表可改为\renewcommand{\part}[1][]{})
\renewcommand{\part}[1][]{\item}
% 处理选择题复选框
\newenvironment{checkboxes}{\begin{itemize}}{\end{itemize}}
\renewcommand{\CorrectChoice}{\item ☒ }
\renewcommand{\choice}{\item ☐ }
% 正确处理fillin填空
\renewcommand\fillin[2][{}]{\textbf{#1}}

测试效果

用修正后的伪定义处理示例LaTeX文档,生成的Markdown输出为:

Exercise 1
- This fills in the **blanks**

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.10 14:30:44