diff options
author | Karl Berry <karl@freefriends.org> | 2023-08-04 21:15:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-08-04 21:15:09 +0000 |
commit | 53455aabb250c56f4494a5224a89f027b845567e (patch) | |
tree | 36bb381534867ffec2145c619b26b24d83e85fd6 /Master/texmf-dist/tex/latex/setspaceenhanced | |
parent | 349b96d60092d492ff93025b297e130d31f2d4c3 (diff) |
setspaceenhanced (4aug23)
git-svn-id: svn://tug.org/texlive/trunk@67814 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/setspaceenhanced')
-rw-r--r-- | Master/texmf-dist/tex/latex/setspaceenhanced/setspaceenhanced.sty | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/setspaceenhanced/setspaceenhanced.sty b/Master/texmf-dist/tex/latex/setspaceenhanced/setspaceenhanced.sty new file mode 100644 index 00000000000..92575aba2d6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/setspaceenhanced/setspaceenhanced.sty @@ -0,0 +1,133 @@ +%% +%% 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-08-04}{1.0} + {% + 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 \__setspaceenhanced_single_factor_fp \fp_set:Nn \__setspaceenhanced_single_factor_fp { 1.0 } +\fp_new:N \__setspaceenhanced_onehalf_factor_fp \fp_set_eq:NN \__setspaceenhanced_onehalf_factor_fp \c_nan_fp +\fp_new:N \__setspaceenhanced_double_factor_fp \fp_set_eq:NN \__setspaceenhanced_double_factor_fp \c_nan_fp +\fp_new:N \__setspaceenhanced_linespread_fp \fp_set:Nn \__setspaceenhanced_linespread_fp { 1.0 } +\cs_new:Nn \__setspaceenhanced_set_spacing:nn + { + \tl_if_blank:nF { #1 } + { + \fp_set:cn { __setspaceenhanced_#2_factor_fp } { #1 } + } + \fp_if_nan:nTF { \tl_use:c { __setspaceenhanced_#2_factor_fp } } + { + \fp_set_eq:Nc \__setspaceenhanced_fp { c__setspaceenhanced_#2_fp } + \__setspaceenhanced_calc_stretch: + } + { + \fp_set_eq:Nc \__setspaceenhanced_linespread_fp { __setspaceenhanced_#2_factor_fp } + \fp_set_eq:NN \__setspaceenhanced_fp \c_nan_fp + } + \setstretch{ \fp_to_decimal:N \__setspaceenhanced_linespread_fp } + } +\cs_new:Nn \__setspaceenhanced_calc_stretch: + { + \fp_if_nan:nF { \__setspaceenhanced_fp } + { + \fp_set:Nn \__setspaceenhanced_linespread_fp + { + \f@size / \dim_to_fp:n { \f@baselineskip } * \__setspaceenhanced_fp + } + } + } +\hook_gput_code:nnn { selectfont } { setspaceenhanced } + {% + \bool_if:NT \__setspaceenhanced_byselectfont_bool + { + \cs_if_exist:NT \size@update + { + \fp_set:Nn \l_tmpa_fp { \f@linespread } + \fp_compare:nNnT \__setspaceenhanced_linespread_fp = \l_tmpa_fp + { + \__setspaceenhanced_calc_stretch: + \set@fontsize + { + \fp_to_decimal:N \__setspaceenhanced_linespread_fp + } + \f@size \f@baselineskip + } + } + } + } +\renewcommand*{\setstretch}[1]{ + \bool_if:NTF \__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 = \__setspaceenhanced_byselectfont_bool, + byselectfont .default:n = true, + byselectfont .initial:n = false, + fontsize .bool_set:N = \__setspaceenhanced_fontsize_bool, + fontsize .default:n = true, + fontsize .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 \__setspaceenhanced_single_factor_fp { #1 } +} +\newcommand*{\spacesetup}{\SetKeys[setspaceenhanced]} +\endinput +%% +%% End of file `setspaceenhanced.sty'. |