# Passing (just) other options, when using pgfopts

I want to use pgfopts (and therefore pgfkeys) when customizing a class with new options, keeping the old ones, and using some of them.

Here is a simplified example with a class "exa" which extends "article" with a new option, and also sets option "a5paper".

\begin{filecontents}{exa.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{exa}[2014/03/19 exa]
% As "article" with "a5paper" set, and an extra option "lastword".
\RequirePackage{pgfopts}
\pgfkeys{
/exa/.cd,
lastword/.code=\AtEndDocument{\par The last word is #1.}
}
\ProcessPgfOptions{/exa}
\PassOptionsToClass{a5paper}{article}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\end{filecontents}

\documentclass[lastword=bar,twocolumn]{exa}

\usepackage{blindtext}
\begin{document}
\blindtext
\end{document}


The three options work as intended here; "a5paper" set by the class, "twocolumn" sent to "article", and the new option "lastword". But it gives a warning about unused global option ["lastword=bar]".

How can take away all options ProcessPgfOptions took care of, so that only the rest is sent on to "article"?

• On my machine with updated TeXLive 2013 it is working nicely. – Claudio Fiandrino Mar 19 '14 at 14:18
• Welcome to TeX.SX! If @ClaudioFiandrino is right about the issue, you might want to look at How do I update my TeX distribution? – Adam Liter Mar 19 '14 at 14:33
• Do you really mean you don't get that warning? (I also use TeXLive 2013.) That would surprise me, because I don't think it's strange I got that warning. – pst Mar 19 '14 at 17:17

You're mixing the two methods for setting options, which results in the warning.

\begin{filecontents}{exa.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{exa}[2014/03/19 exa]
% As "article" with "a5paper" set, and an extra option "lastword".
\RequirePackage{pgfopts}

%%% initialize the options
\def\exa@classoptions{a5paper}

\pgfkeys{
/exa/.cd,
lastword/.code=\AtEndDocument{\par The last word is #1.},
%%% unknown keys are assumed to be options to be passed to the class
.unknown/.code={\edef\exa@classoptions{\exa@classoptions,\pgfkeyscurrentname}}
}
\ProcessPgfOptions{/exa}