自行对比。
原来的作者设计\hh的时候是没有考虑到这种直接挖空在段首的情况的
\documentclass[a4paper]{ctexart}
\usepackage[showframe]{geometry}
\usepackage{zhlipsum}
\RequirePackage{xcolor}
\NewDocumentCommand\hha{g}%
{\IfNoValueTF{#1}{\,\underline{\hbox to 1cm{}}\,}{\nolinebreak\textcolor[rgb]{1,0,0}{\underline{#1}}}}
\NewDocumentCommand\hhb{g}%
{\IfNoValueTF{#1}{\,\underline{\hbox to 1cm{}}\,}{\textcolor[rgb]{1,0,0}{\underline{#1}}}}
\begin{document}
我的答案是什么呢我的答案是什么呢我的答案是什么呢我的答案是什么呢\hha 你好
我的答案是什么呢我的答案是什么呢我的答案是什么呢我的答案是什么呢\hhb 你好
我的答案是什么呢我的答案是什么呢我的答案是什么呢我的答案是什么呢\hha{我能吞下玻璃而不伤身体}
我的答案是什么呢我的答案是什么呢我的答案是什么呢我的答案是什么呢\hhb{我能吞下玻璃而不伤身体}
%\hha{我能吞下玻璃而不伤身体}我的答案是什么呢我的答案是什么呢我的答案是什么呢我的答案是什么呢%<---报错
\hhb{我能吞下玻璃而不伤身体}我的答案是什么呢我的答案是什么呢我的答案是什么呢我的答案是什么呢
\end{document}





































问 自定义下划线命令来输出填空题答案,当命令前无字符时运行出错