<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%
%% hideanswer.sty
%%
%% Copyright (C) 2022--2024 Yukoh KUSAKABE (screen-name)
%%   https://www.metaphysica.info/
%%   https://x.com/metaphysicainfo
%%
%% This package released under
%% [the MIT license](https://ctan.org/license/mit).
%%
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hideanswer}[2024/11/23 v1.2]
%
%% for \color
\RequirePackage{color}
%
%% for \includegraphics
\RequirePackage{graphicx}
%
% for \NewDocumentEnvironment
\RequirePackage{xparse}
%
%% \if@hdans@hideswitch
\newif\if@hdans@hideswitch
\@hdans@hideswitchfalse
%
%% \sethideanswer
%% \unsethideanswer
\DeclareRobustCommand{\sethideanswer}{\@hdans@hideswitchtrue}
\DeclareRobustCommand{\unsethideanswer}{\@hdans@hideswitchfalse}
%
%% \hideanswer{&lt;text&gt;}
%% \hideanswer*{&lt;text&gt;}
\DeclareRobustCommand{\hideanswer}{\@ifstar{\@hdans@hideanswer@star}{\@hdans@hideanswerh@nostar}}
\DeclareRobustCommand{\@hdans@hideanswer@star}[1]{\if@hdans@hideswitch\else\color{white}\fi{#1}\if@hdans@hideswitch\else\color{black}\fi}
\DeclareRobustCommand{\@hdans@hideanswerh@nostar}[1]{\if@hdans@hideswitch\color{white}\else\fi{#1}\if@hdans@hideswitch\color{black}\else\fi}
%
%% \begin{hideanswerdiv}
%% \begin{hideanswerdiv*}
\newenvironment{hideanswerdiv}%
{\if@hdans@hideswitch\color{white}\else\fi}%
{\if@hdans@hideswitch\color{black}\else\fi}
\newenvironment{hideanswerdiv*}%
{\if@hdans@hideswitch\else\color{white}\fi}%
{\if@hdans@hideswitch\else\color{black}\fi}
%
%% \smashanswer{&lt;text&gt;}
%% \smashanswer*{&lt;text&gt;}
\DeclareRobustCommand{\smashanswer}{\@ifstar{\@hdans@smashanswer@star}{\@hdans@smashanswer@nostar}}
\DeclareRobustCommand{\@hdans@smashanswer@star}[1]{\if@hdans@hideswitch{#1}\else\fi}
\DeclareRobustCommand{\@hdans@smashanswer@nostar}[1]{\if@hdans@hideswitch\else{#1}\fi}
%
%% \begin{smashanswerdiv}
%% \begin{smashanswerdiv*}
\NewDocumentEnvironment{smashanswerdiv}{+b}
{\if@hdans@hideswitch\else #1\fi}{}
\NewDocumentEnvironment{smashanswerdiv*}{+b}
{\if@hdans@hideswitch #1\else\fi}{}
%
%% \hidegraphics[&lt;includegraphics&gt;]{&lt;includegraphics&gt;}
%% \hidegraphics*[&lt;includegraphics&gt;]{&lt;includegraphics&gt;}
\DeclareRobustCommand{\hidegraphics}{\@ifstar{\@hdans@hidegraphics@star}{\@hdans@hidegraphics@nostar}}
\DeclareRobustCommand{\@hdans@hidegraphics@star}[2][]{\if@hdans@hideswitch\includegraphics[#1]{#2}\else\phantom{\includegraphics[#1]{#2}}\fi}
\DeclareRobustCommand{\@hdans@hidegraphics@nostar}[2][]{\if@hdans@hideswitch\phantom{\includegraphics[#1]{#2}}\else\includegraphics[#1]{#2}\fi}
%
%% \smashgraphics[&lt;includegraphics&gt;]{&lt;includegraphics&gt;}
%% \smashgraphics*[&lt;includegraphics&gt;]{&lt;includegraphics&gt;}
\DeclareRobustCommand{\smashgraphics}{\@ifstar{\@hdans@smashgraphics@star}{\@hdans@smashgraphics@nostar}}
\DeclareRobustCommand{\@hdans@smashgraphics@star}[2][]{\if@hdans@hideswitch\includegraphics[#1]{#2}\else\fi}
\DeclareRobustCommand{\@hdans@smashgraphics@nostar}[2][]{\if@hdans@hideswitch\else\includegraphics[#1]{#2}\fi}
%
%% \switchanswer{&lt;text when sethide&gt;}{&lt;text when unsethide&gt;}
%% \switchanswer*{&lt;text when unsethide&gt;}{&lt;text when sethide&gt;}
\DeclareRobustCommand{\switchanswer}{\@ifstar{\@hdans@switchanswer@star}{\@hdans@switchanswerh@nostar}}
\DeclareRobustCommand{\@hdans@switchanswer@star}[2]{\if@hdans@hideswitch{#1}\else{#2}\fi}
\DeclareRobustCommand{\@hdans@switchanswerh@nostar}[2]{\if@hdans@hideswitch{#2}\else{#1}\fi}
%
%% EOF</pre></body></html>