Peter Flynn
2011-01-21 20:33:42 UTC
I have a lot of Type 1 sans-serif fonts installed, and I have added a
[scaled] option to their .sty/.fd files following the pattern of
helvet.sty. This has been working fine.
But I often use several of these packages in sample documents, and I
don't want them all to reset \sfdefault because they would conflict.
So I tried to add an option [default], meaning if I write
\usepackage{helvet} it will load the settings but NOT make it the
\sfdefault unless I write \usepackage[default]{helvet}:
\DeclareOption{default}{\renewcommand{\sfdefault}{phv}}
\ProcessOptions
and commented out \renewcommand{\sfdefault}{phv} at the end of the file.
However, with this MWE
\documentclass{article}
\usepackage[scaled=0.8,default]{helvet}
\begin{document}
CMR and \sffamily Helvetica
\end{document}
I get
*and* KV in the same file.
OK, I thought, let's see if I can add the [default] option via KV, so I
commented out the \DeclareOptions and \ProcessOptions above, and wrote:
\***@key{Def}{default}[yes]{\renewcommand{\sfdefault}{phv}}
up with scaled, and
\ProcessOptionsWithKV{Def}
///Peter
[scaled] option to their .sty/.fd files following the pattern of
helvet.sty. This has been working fine.
But I often use several of these packages in sample documents, and I
don't want them all to reset \sfdefault because they would conflict.
So I tried to add an option [default], meaning if I write
\usepackage{helvet} it will load the settings but NOT make it the
\sfdefault unless I write \usepackage[default]{helvet}:
\DeclareOption{default}{\renewcommand{\sfdefault}{phv}}
\ProcessOptions
and commented out \renewcommand{\sfdefault}{phv} at the end of the file.
However, with this MWE
\documentclass{article}
\usepackage[scaled=0.8,default]{helvet}
\begin{document}
CMR and \sffamily Helvetica
\end{document}
I get
! Package keyval Error: default undefined.
See the keyval package documentation for explanation.
Type H <return> for immediate help.
...
l.53 \ProcessOptionsWithKV{Hel}
! LaTeX Error: Unknown option `scaled=0.8' for package `helvet'.
from which I deduce that you can't use both standard options handlingSee the keyval package documentation for explanation.
Type H <return> for immediate help.
...
l.53 \ProcessOptionsWithKV{Hel}
! LaTeX Error: Unknown option `scaled=0.8' for package `helvet'.
*and* KV in the same file.
OK, I thought, let's see if I can add the [default] option via KV, so I
commented out the \DeclareOptions and \ProcessOptions above, and wrote:
\***@key{Def}{default}[yes]{\renewcommand{\sfdefault}{phv}}
up with scaled, and
\ProcessOptionsWithKV{Def}
! Package keyval Error: default undefined.
See the keyval package documentation for explanation.
Type H <return> for immediate help.
...
l.53 \ProcessOptionsWithKV{Hel}
! Package keyval Error: scaled undefined.
I have clearly misunderstood KV here, but I can't see where.See the keyval package documentation for explanation.
Type H <return> for immediate help.
...
l.53 \ProcessOptionsWithKV{Hel}
! Package keyval Error: scaled undefined.
///Peter