TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 5 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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