diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/passopt/passopt.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/passopt/passopt.sty | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/passopt/passopt.sty b/Master/texmf-dist/tex/latex/passopt/passopt.sty new file mode 100644 index 00000000000..d74c698d27a --- /dev/null +++ b/Master/texmf-dist/tex/latex/passopt/passopt.sty @@ -0,0 +1,56 @@ +% +% ***************** THE PASSOPT PACKAGE ***************** +% +% Copyright (C) 2024 by Qu Yi <toquyi@163.com> +% +% This work may be distributed and/or modified under the +% conditions of the CC-BY 4.0 License. +% The latest version of this license is in +% https://creativecommons.org/licenses/by/4.0/legalcode +\NeedsTeXFormat{LaTeX2e}[2021/11/15] +\ProvidesExplPackage{passopt}{2024/07/17}{1.01a} + {Passing options to packages or classes} + +\cs_generate_variant:Nn \tl_if_blank:nTF { v } +\cs_new_protected:Npn \po_add_before_hook:nnn #1#2 + { \hook_gput_code:nnn { #1/#2/before } { passopt } } +\cs_new_protected:Npn \po_set_options_list:nnnnn #1#2#3#4#5 + { + \po_add_before_hook:nnn {#1} {#5} + { + \cs_set:cpx { @raw@opt@#5.#2 } + { + \IfBooleanTF{#3} + {\exp_not:o {#4}} + { + \tl_if_blank:vTF { @raw@opt@#5.#2 } + { \exp_not:o {#4} } + { \exp_not:v { @raw@opt@#5.#2 },\exp_not:o {#4} } + } + } + \exp_args:Nc \protected@edef { opt@#5.#2 } + { + \exp_last_unbraced:Nv + \zap@space { @raw@opt@#5.#2 }~\@empty + } + } + } +\cs_new_protected:Npn \po_clear_options_list:nnn #1#2#3 + { + \po_add_before_hook:nnn {#1} {#3} + { + \tl_clear:c { @raw@opt@#3.#2 } + \tl_clear:c { opt@#3.#2 } + } + } +\NewDocumentCommand{\SetOptionsToPackage}{smm} + {\po_set_options_list:nnnnn { package } { sty } {#1} {#2} {#3}} +\NewDocumentCommand{\SetOptionsToClass}{smm} + {\po_set_options_list:nnnnn { class } { cls } {#1} {#2} {#3}} +\cs_new_protected:Npn \ClearPackageOptions #1 + { \po_clear_options_list:nnn { package } { sty } {#1} } +\cs_new_protected:Npn \ClearClassOptions #1 + { \po_clear_options_list:nnn { class } { cls } {#1} } +\endinput +% +% End of file `passopt.sty'.
\ No newline at end of file |