Fri, 17 Sep 2010 20:03:04 +0200
|
On Fri, Sep 17, 2010 at 06:24:00PM +0100, Joseph Wright wrote:
> I've had a bug for siunitx about option parsing, which seems to be a
> kernel issue. There is a difference in handling between
>
> \usepackage[%
> output-decimal-marker ={,}
> ]{siunitx}
>
> and
>
> \usepackage[%
> output-decimal-marker = {,}
> ]{siunitx}
>
> with the later (with an extra space) failing. Is this a kernel bug
> or a 'feature' of LaTeX2e?
LaTeX2e uses \zap@space to remove the spaces in the option lists.
As a side effect \zap@space also removes the braces around the
comma, because the group is followed immediately after a space:
\zap@space #1 #2->#1\ifx #2\@empty \else \expandafter \zap@space \fi #2
#1<-output-decimal-marker
#2<-=
\zap@space #1 #2->#1\ifx #2\@empty \else \expandafter \zap@space \fi #2
#1<-=
#2<-,
\zap@space #1 #2->#1\ifx #2\@empty \else \expandafter \zap@space \fi #2
#1<-,
#2<-\@empty
Then the comma becomes part of the syntax and is interpreted as
option separator.
For curiosity I have again compared the two packages kvoptions-patch
and xkvltxp:
\documentclass{article}
\usepackage{kvoptions-patch}
%\usepackage{xkvltxp}
\usepackage[
output-decimal-marker = {,}
]{a}
\begin{document}
\end{document}
and a.sty:
\ProvidesPackage{a}
\DeclareOption*{\typeout{[\CurrentOption]}}
\ProcessOptions\relax
\endinput
Result:
* xkvltxp:
[ output-decimal-marker = {,} ]
It doesn't remove spaces.
* kvoptions-patch:
[output-decimal-marker={,}]
It removes the spaces before, after and around the equals sign.
Both left the braces intact.
Yours sincerely
Heiko <[log in to unmask]>
|
|
|