%%
%% This is file `handstroke.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% handstroke.dtx  (with options: `package')
%% (The MIT License)
%% 
%% Copyright (c) 2021-2026 Yegor Bugayenko
%% 
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the 'Software'), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%% 
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%% 
%% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.



\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{handstroke}
[2026-07-12 08.41.18 Hand-Written Underline]









\RequirePackage{pgfopts}
\pgfkeys{
  /handstroke/.cd,
  colored/.store in=\handstroke@colored,
  color/.store in=\handstroke@color,
  color/.default=orange,
  color,
  synonym/.store in=\handstroke@synonym,
}
\ProcessPgfPackageOptions{/handstroke}

\makeatletter
\ifdefined\handstroke@colored
  \RequirePackage{xcolor}
\fi
\makeatother

\RequirePackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}

\makeatletter
\pgfkeys{
  /handstroke/stroke/.cd,
  color/.store in=\handstroke@ink,
}
\newcommand\handstroke[2][]{%
  \ifdefined\handstroke@colored%
    \let\handstroke@ink\handstroke@color%
  \else\def\handstroke@ink{gray!80}\fi%
  \pgfkeys{/handstroke/stroke/.cd, #1}%
  \tikz[baseline=(text.base)] {
    \node[inner sep=0em, outer sep=0em] (text) {#2};
    \begin{scope}
      \path[use as bounding box]
        (text.east) rectangle (text.west);
      \draw[decorate,
        decoration={random steps,
          amplitude=0.05em, segment length=0.3em},
        line join=round,
        line cap=round,
        line width=.08em,
        draw=\handstroke@ink]
        ($(text.west) + (-0.2em, -.46em)$)
        rectangle
        ($(text.east) + (+0.2em, -.46em)$);
    \end{scope}
  }%
}
\makeatother

\makeatletter
\ifdefined\handstroke@synonym
  \expandafter\let\csname\handstroke@synonym\endcsname\handstroke
\fi
\makeatother

\endinput
%%
%% End of file `handstroke.sty'.
