%%
%% This is file `setspaceenhanced.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% setspaceenhanced.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from setspaceenhanced.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file setspaceenhanced.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\ProvidesExplPackage{setspaceenhanced}
  {2023-10-09}{1.02}
  {%
    improved setspace package%
  }
\ifnum 0=\ifcsname IfFormatAtLeastTF\endcsname
    \IfFormatAtLeastTF{2022-06-01}{1}{0}
  \else
    0
  \fi\relax
  \PackageError{setspaceenhanced}{LaTeX~kernel~too~old}{
    The~package~needs~at~least~LaTeX~2022-06-01.\MessageBreak
    This~error~is~fatal.~Loading~will~be~aborted
  }
  \endinput
\fi
\RequirePackage{setspace}
\fp_const:Nn \c__setspaceenhanced_single_fp  { 1.2 }
\fp_const:Nn \c__setspaceenhanced_onehalf_fp { 1.5 }
\fp_const:Nn \c__setspaceenhanced_double_fp  { 2.0 }
\fp_new:N \g__setspaceenhanced_single_factor_fp
\fp_set:Nn \g__setspaceenhanced_single_factor_fp { 1.0 }
\fp_new:N \g__setspaceenhanced_onehalf_factor_fp
\fp_set_eq:NN \g__setspaceenhanced_onehalf_factor_fp \c_nan_fp
\fp_new:N \g__setspaceenhanced_double_factor_fp
\fp_set_eq:NN \g__setspaceenhanced_double_factor_fp \c_nan_fp
\fp_new:N \g__setspaceenhanced_linespread_fp
\fp_set:Nn \g__setspaceenhanced_linespread_fp { 1.0 }
\fp_new:N \g__setspaceenhanced_fp
\cs_new:Nn \__setspaceenhanced_set_spacing:nn
  {
    \tl_if_blank:nF { #1 }
      {
        \fp_set:cn { g__setspaceenhanced_#2_factor_fp } { #1 }
      }
    \fp_if_nan:nTF { \tl_use:c { g__setspaceenhanced_#2_factor_fp } }
      {
        \fp_set_eq:Nc \g__setspaceenhanced_fp { c__setspaceenhanced_#2_fp }
        \__setspaceenhanced_calc_stretch:
      }
      {
        \fp_set_eq:Nc \g__setspaceenhanced_linespread_fp { g__setspaceenhanced_#2_factor_fp }
        \fp_set_eq:NN \g__setspaceenhanced_fp \c_nan_fp
      }
      \setstretch{ \fp_to_decimal:N \g__setspaceenhanced_linespread_fp }
  }
\cs_new:Nn \__setspaceenhanced_calc_stretch:
  {
    \fp_if_nan:nF { \g__setspaceenhanced_fp }
      {
        \fp_set:Nn \g__setspaceenhanced_linespread_fp
          {
            \f@size / \dim_to_fp:n { \f@baselineskip } * \g__setspaceenhanced_fp
          }
      }
  }
\hook_gput_code:nnn { selectfont } { setspaceenhanced }
  {%
    \bool_if:NT \g__setspaceenhanced_byselectfont_bool
      {
        \cs_if_exist:NT \size@update
          {
            \fp_set:Nn \l_tmpa_fp { \f@linespread }
            \fp_compare:nNnT \g__setspaceenhanced_linespread_fp = \l_tmpa_fp
              {
                \__setspaceenhanced_calc_stretch:
                \set@fontsize
                  {
                    \fp_to_decimal:N \g__setspaceenhanced_linespread_fp
                  }
                  \f@size \f@baselineskip
              }
          }
      }
  }
\renewcommand*{\setstretch}[1]{
  \bool_if:NTF \g__setspaceenhanced_fontsize_bool
    {
      \linespread{#1}\selectfont
    }
    {
      \def\baselinestretch{#1}%
      \@currsize
    }
}
\DeclareKeys{%
  singlespacing  .code        = \__setspaceenhanced_set_spacing:nn {#1} {single},
  singlespacing  .usage       = general,
  onehalfspacing .code        = \__setspaceenhanced_set_spacing:nn {#1} {onehalf},
  onehalfspacing .usage       = general,
  doublespacing  .code        = \__setspaceenhanced_set_spacing:nn {#1} {double},
  doublespacing  .usage       = general,
  byselectfont   .bool_set:N  = \g__setspaceenhanced_byselectfont_bool,
  byselectfont   .default:n   = true,
  byselectfont   .initial:n   = false,
  keepfontsize   .bool_set:N  = \g__setspaceenhanced_fontsize_bool,
  keepfontsize   .default:n   = true,
  keepfontsize   .initial:n   = false,
}
\ProcessKeyOptions\relax
\renewcommand*{\singlespacing}{
  \__setspaceenhanced_set_spacing:nn {} {single}
}
\renewcommand*{\onehalfspacing}{
  \__setspaceenhanced_set_spacing:nn {} {onehalf}
}
\renewcommand*{\doublespacing}{
  \__setspaceenhanced_set_spacing:nn {} {double}
}
\renewcommand*{\SetSinglespace}[1]{
  \fp_set:Nn \g__setspaceenhanced_single_factor_fp { #1 }
}
\newcommand*{\spacesetup}{\SetKeys[setspaceenhanced]}
\endinput
%%
%% End of file `setspaceenhanced.sty'.
