etoolbox icon indicating copy to clipboard operation
etoolbox copied to clipboard

options processing + ifbool not working?

Open devangel77b opened this issue 5 years ago • 6 comments

Not sure if this is a bug; has anyone else seen problems when using booltrue+DeclareOption, and ifbool... seeing that the booleans are not being set? I have not yet been able to tell if it is an issue with options or with booleans in etoolbox; when done on their own in a simple article with no options etoolbox booleans seem to work correctly, but when done within options declared in a package they seem not to be set.

devangel77b avatar Nov 01 '20 20:11 devangel77b

Please can you post an example?

josephwright avatar Nov 01 '20 20:11 josephwright

\documentclass{article}

\usepackage[option1]{mwe}

\begin{document}
\checkMweOptions
\end{document}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mwe}[mwe testing for bug in etoolbox with DeclareOption]

\RequirePackage{etoolbox}
\newbool{booloption0}
\newbool{booloption1}
\newbool{booloption2}
\DeclareOption{option0}{\booltrue{booloption0}}
\DeclareOption{option1}{\booltrue{booloption1}}
\DeclareOption{option2}{\booltrue{booloption2}}
\ExecuteOptions{}
\ProcessOptions\relax

\newcommand{\checkMweOptions}{
\ifbool{booloption0}{option0}{notoption0}
\ifbool{booloption1}{option1}{notoption1}
\ifbool{booloption2}{option2}{notoption2}
}

devangel77b avatar Nov 01 '20 23:11 devangel77b

Hmmm now the MWE is working. It's something with my installation or a side effect with something else I am using in my actual files. Sorry to have bothered you.

devangel77b avatar Nov 01 '20 23:11 devangel77b

Is there any known reason I wouldhave to also do \documentclass[option1]{article} to get the booleans to be set correctly during options processing?

devangel77b avatar Nov 01 '20 23:11 devangel77b

I'm not sure what you mean

josephwright avatar Nov 02 '20 10:11 josephwright

@devangel77b article is one of the standard classes, hence normally you cannot add new class options to it. Instead, you can define your own document class based on article.

muzimuzhi avatar Nov 02 '20 12:11 muzimuzhi