-
Notifications
You must be signed in to change notification settings - Fork 114
Description
This is something I've come across while working on #1734. Compiling the following
\documentclass{article}
\begin{filecontents*}[overwrite]{\jobname.latexml}
DefMacro('\dumpArg {}', sub {
my ($gullet, $arg) = @_;
print STDERR "args:\n";
foreach ( @{$arg} ) {
print STDERR $_->getCatcode . ': ' . $_->toString . "\n"; }
return $_[1]; });
1;
\end{filecontents*}
\providecommand{\dumpArg}[1]{#1}
\begin{document}
previous line
\dumpArg{1}
%previous line
\dumpArg{2}
done
\end{document}
with LaTeX yields the pdf "previous line 1 2 done" (and creates the latexml file). Compiling with latexml --nocomments
creates the xml
<p>previous line
1
2
done</p>
and stderr
args:
12: 1
args:
12: 2
Compiling with comments, however, creates the xml
<p><!-- %previous line -->previous line
1
2
done</p>
so that the comment has moved to an unexpected place. Even worse, stderr shows
args:
12: 1
args:
14: %previous line
12: 2
so that the "previous line" comment became the first argument to the subsequent macro.
I'm not sure why this is happening. I don't think it generally affects things, since it appears you have to be accessing the arguments in a non-standard way. But siunitx accesses the arguments in a non-standard way, so I wanted to ask if this is expected and we need to modify siunitx. (And I assume --nocomments
is why we've not noticed this before, since that removes the behavior. Otherwise, t/complex/si.tex
doesn't compile.)