Is there a simple way to allow spaces in the options of a package using pgfopts to process them, which is local to that package i.e. I don't have to include some package in the main document before \documentclass. What I'm trying to do is pass font names to fontspec inside the package using pgfopts.


Basically, the answer here is 'no'. Space-stripping from class (and package) options is carried out by the LaTeX2e kernel before anything is passed to pgfopts or any other keyval-processing package. The two patches which exist for this (xkvltxp and kvoptions-patch) both have to be loaded before any options they 'protect' are used, which means before \documentclass for class options.

You can protect options from space stripping using braces, for example

\documentclass[foo={bar baz}]{mycls}

but this can cause issues as the kernel may choke on these when doing 'duplicate removal'. So in general it's best not to use options containing spaces when loading a package or class: set the options afterwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.