%%
%% This is file `lwarp-chemfig.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lwarp.dtx  (with options: `chemfig')
%% This is a generated file.
%% Copyright 2016-2020 Brian Dunn
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.

\LWR@ProvidesPackagePass{chemfig}[2020/03/05]


\catcode`\_=11

\@ifpackagelater{chemfig}{2020/03/05}
{
    \xpretocmd\charge{\begin{lateximage}[-chemfig-~\PackageDiagramAltText]}
        {}{\LWR@patcherror{chemfig}{charge}}
    \xpretocmd\Charge{\begin{lateximage}[-chemfig-~\PackageDiagramAltText]}
        {}{\LWR@patcherror{chemfig}{Charge}}
    \xapptocmd\charge_c{\end{lateximage}}
        {}{\LWR@patcherror{chemfig}{charge_c}}
}{}

\@ifpackagelater{chemfig}{2019/04/18}%
{% 2019/04/18 or newer

    \LetLtxMacro\LWR@chemfig@origchemfig\chemfig

    \renewcommand*{\chemfig}[2][]{%
        \begin{lateximage}[-chemfig-~\PackageDiagramAltText]%
        \LWR@chemfig@origchemfig[#1]{#2}%
        \end{lateximage}%
    }

    \GlobalLetLtxMacro\LWR@chemfig@origCF_lewisc\CF_lewisc
    \gdef\CF_lewisc#1,#2\_nil{%
    \begin{lateximage}[-chemfig-~\PackageDiagramAltText]%
    \LWR@chemfig@origCF_lewisc#1,#2\_nil
    \end{lateximage}
    }

    \gpreto{\schemestart}{%
        \begin{lateximage}[-chemfig-~\PackageDiagramAltText]%
    }
    \gappto{\CF_schemestop}{\end{lateximage}}

}% 2019/04/18 or newer
{% older than 2019/04/18

    \LetLtxMacro\LWR@chemfig@origchemfig\chemfig

    \DeclareDocumentCommand\chemfig{s O{} O{} m}{%
        \begin{lateximage}[-chemfig-~\PackageDiagramAltText]%
        \IfBooleanTF{#1}{%
            \LWR@chemfig@origchemfig*[#2][#3]{#4}%
        }{%
            \LWR@chemfig@origchemfig[#2][#3]{#4}%
        }
        \end{lateximage}%
    }

    \LetLtxMacro\LWR@chemfig@origCF@lewis@b\CF@lewis@b

    \def\CF@lewis@b#1#2{%
    \begin{lateximage}[-chemfig-~\PackageDiagramAltText]%
    \LWR@chemfig@origCF@lewis@b{#1}{#2}%
    \end{lateximage}%
    }

    \preto{\schemestart}{%
        \begin{lateximage}[-chemfig-~\PackageDiagramAltText]%
    }
    \appto{\CF@schemestop}{\end{lateximage}}

}% older than 2019/04/18

\catcode`\_=8%

\LetLtxMacro\LWR@chemfig@origchemleft\chemleft

\def\chemleft#1#2\chemright#3{%
\begin{lateximage}[-chemfig-~\PackageDiagramAltText]%
\LWR@chemfig@origchemleft#1#2\chemright#3%
\end{lateximage}%
}

\LetLtxMacro\LWR@chemfig@origchemup\chemup

\def\chemup#1#2\chemdown#3{%
\begin{lateximage}[-chemfig-~\PackageDiagramAltText]%
\LWR@chemfig@origchemup#1#2\chemdown#3%
\end{lateximage}%
}

\endinput
%%
%% End of file `lwarp-chemfig.sty'.
