I suppose there is some reason why the command \@ifpackageloaded
is not just called \ifpackageloaded
But with the @ one has some additional work:
\makeatletter
\@ifpackageloaded{geometry}
{ % i the package was loaded
\newcommand*{\qw}{\itshape} % this is enabled, else is not enabled.
}{}
\makeatother
Is it a security feature?
\IfPackageLoadedTF{<package>}{<true code>}{<false code>}
without\makeatletter
(it is equivalent to\@ifpackageloaded
)\makeatletter
????\makeatletter
as@
is allowed automatically.\@ifpackageloaded
in a document preamble, the document is a single entity the package is used or not, no need to test for it. this is not like package A which might need to test for package B being loaded. But your comment about@
only applies to the first case that should never happen.