问题描述
- 将ACM latex模板中的XML代码按说明替换为:
%% The code below is generated by the tool at http://dl.acm.org/ccs.cfm.
%% Please copy and paste the code instead of the example below.
%%
\begin{CCSXML}
<ccs2012>
<concept>
<concept_id>XXXXX</concept_id>
<concept_desc>XXXXX</concept_desc>
<concept_significance>500</concept_significance>
</concept>
<concept>
<concept_id>XXXXX</concept_id>
<concept_desc>XXXXX</concept_desc>
<concept_significance>500</concept_significance>
</concept>
</ccs2012>
\end{CCSXML}
\ccsdesc[500]{Human-centered computing~Ubiquitous and mobile computing systems and tools}
\ccsdesc[500]{Computing methodologies~Machine learning approaches}
- 编译报错:
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(d:/texlive/2022/texmf-dist/tex/latex/upquote/upquote.sty)
Excluding 'CCSXML' comment.)
Runaway argument?
! File ended while scanning use of \next.
<inserted text>
\par
<*> sample-sigconf.tex
?
! Emergency stop.
<inserted text>
\par
<*> sample-sigconf.tex
问题解决
- 经尝试,删掉
\end{CCSXML}
前的空格后,成功编译:
\begin{CCSXML}
<ccs2012>
<concept>
<concept_id>10003120.10003138.10003140</concept_id>
<concept_desc>Human-centered computing~Ubiquitous and mobile computing systems and tools</concept_desc>
<concept_significance>500</concept_significance>
</concept>
<concept>
<concept_id>10010147.10010257.10010293</concept_id>
<concept_desc>Computing methodologies~Machine learning approaches</concept_desc>
<concept_significance>500</concept_significance>
</concept>
</ccs2012>
\end{CCSXML}
原因分析
- acmart模板对\end{CCSXML}前的空格敏感。这种敏感性主要是由于\excludecomment{CCSXML}宏的实现:
- 下面是acmart.cls中的相关代码
\RequirePackage{comment}
\excludecomment{CCSXML}
- 可见:
-
acmart模板使用了comment宏包,该宏包提供了\excludecomment命令,可以在编译时忽略特定环境中的内容。
-
然而,comment宏包对于\begin{…}和\end{…}之间的内容的处理方式是基于逐行文本匹配的。换句话说,它会在文档中查找以\end{CCSXML}开头的行来确定环境的结束。如果在\end{CCSXML}之前存在空格,宏包将无法识别这一行作为CCSXML环境的结束。这就是为什么将\end{CCSXML}前的空格去掉后,编译将不再报错。
-
具体见comment package的文档:https://mirror-hk.koddos.net/CTAN/macros/latex/contrib/comment/comment.pdf 第一页:
-