7

I try to follow this scheme :

If not DeclareOption

but have an error of this type :

I get an error when using `\ExecuteOptions` together with `\usepackage{geometry}`

but I don't understand how to fix it.

Here is my MWE :

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[marginparsep=3pt, top=2cm, bottom=1.5cm, left=1.5cm, right=1.5cm]{geometry}

\newif\ifMyFancy

\DeclareOption{fancy}{\MyFancytrue}
\DeclareOption{nofancy}{\MyFancyfalse}

\ExecuteOptions{fancy}

\ProcessOptions\relax

\ifMyFancy
    \usepackage{fancyhdr}
    \pagestyle{fancy}
\fi

and

\documentclass[12pt,a4paper]{article}
\usepackage{bob}

\fancyhead[L]{\textbf{6}}
\fancyhead[R]{27 mai 2015}
\fancyhead[C]{\textbf{Devoir commun}}
\fancyfoot[C]{}

\begin{document}
essai
\end{document}
1
  • Is the first snippet supposed to be bob.sty?
    – Johannes_B
    May 7, 2015 at 8:40

1 Answer 1

7

The problem seems very similar to SF298 package giving undefined control sequence error and seems due to the same problem: both geometry and totpages do some tricks with \ExecuteOptions which end up with \CurrentOption defined as \@nil.

As soon as you load any other package after geometry this problem vanishes, but it's clearly a bug.

Minimal example:

\documentclass[a4paper]{article}
\usepackage[margin=2cm]{geometry}
\show\CurrentOption

which shows, on the terminal,

> \CurrentOption=macro:
->\@nil .

Workaround: add \def\CurrentOption{} after loading geometry or move the call to geometry before calling fontenc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .