this post was submitted on 11 Jan 2025
5 points (100.0% liked)

TeX typesetting

157 readers
1 users here now

A place to share ideas, resources, tips, and hacks for Donald Knuths typesetting software TeX. All variants and formats like OpTeX, LaTeX and ConTeXt are welcome.

founded 2 years ago
MODERATORS
 

It would sometimes be useful to write conditional code that depends on boolean values defined in a parent package. E.g. the \pdfcomment package has the boolean “final”, which disables all PDF annotations in the document (\usepackage[final]{pdfcomment}). There is some other logic in my document that should also be disabled when that boolean is true. I tried simply using:

\ifpc@gopt@final\else%
…code that should not run when final is true…
\fi

pdflatex gives: “Undefined control sequence”

More generally, many draft options are often useful for controlling logic within the document for which a parent uses a draft option. Also when defining a custom letterhead in the scrlttr2 class there are booleans for many items that may or may not be wanted in the letterhead.

Has anyone managed to read a parent boolean?

(update) This thread gives useful options for many situations. But it does not completely answer the question because there are non-draft related booleans.

SOLVED

The \ifpc@gopt@final is reachable but only inside a \makeatletter stanza. Thus:

\makeatletter
\ifpc@gopt@final\else%
…code that should not run when final is true…
\fi
\makeatother
no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here