I am loading the gitver
package based on the expl3
solution accepted for my question here.
However, I need to use some commands depending on whether the package has actually been loaded. For instance, using a combination of hyperxmp
, hyperref
and gitver
, one can provide an option pdfversionid = \gitVer
to the hypersetup
command (see code below).
The question is, how do I conditionally detect the presence of a package loaded (gitver
in my example) and set up this conditional compilation?
Minimal conceptual example:
\documentclass{article}
\usepackage{expl3}
\csname sys_if_shell_unrestricted:T\endcsname{\usepackage{gitver}}
\usepackage{hyperxmp}
\usepackage{hyperref}
% this commented paragraph is conceptual & needs fixing through a solution from this forum
% \hypersetup{%
% pdfversionid = {detect if gitver has been loaded & set to \gitVer if so; otherwise set to empty {}}
% }%
\begin{document}
Hello world!
% The following again describes my intended requirements in words
% detect if gitver has been loaded & print \versionBox{} if so; otherwise print "gitver not loaded"
\end{document}