texlive[71775] Master: passopt (11jul24)

commits+karl at tug.org commits+karl at tug.org
Thu Jul 11 21:57:52 CEST 2024


Revision: 71775
          https://tug.org/svn/texlive?view=revision&revision=71775
Author:   karl
Date:     2024-07-11 21:57:52 +0200 (Thu, 11 Jul 2024)
Log Message:
-----------
passopt (11jul24)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/passopt/
    trunk/Master/texmf-dist/doc/latex/passopt/README.md
    trunk/Master/texmf-dist/doc/latex/passopt/passopt.pdf
    trunk/Master/texmf-dist/doc/latex/passopt/passopt.tex
    trunk/Master/texmf-dist/tex/latex/passopt/
    trunk/Master/texmf-dist/tex/latex/passopt/passopt.sty
    trunk/Master/tlpkg/tlpsrc/passopt.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/passopt/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/passopt/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/passopt/README.md	2024-07-11 19:57:52 UTC (rev 71775)
@@ -0,0 +1,15 @@
+# The `passopt` package
+Passing options to packages or classes (v1.00a)
+
+## Abstract
+`passopt` allow reset the global options of a loaded macro package or document class, or to change the position of the pre-passed options in the list to the right.
+
+## License
+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
+
+## Website
+| [Gitee](https://gitee.com/texno3/passopt) | [Github](https://github.com/texno3/passopt) | [CTAN](https://ctan.org/pkg/passopt) |
+
+## Maintainer
+QuYi<br/>
+Email: toquyi at 163.com
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/passopt/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/passopt/passopt.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/passopt/passopt.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/passopt/passopt.pdf	2024-07-11 19:57:18 UTC (rev 71774)
+++ trunk/Master/texmf-dist/doc/latex/passopt/passopt.pdf	2024-07-11 19:57:52 UTC (rev 71775)

Property changes on: trunk/Master/texmf-dist/doc/latex/passopt/passopt.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/passopt/passopt.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/passopt/passopt.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/passopt/passopt.tex	2024-07-11 19:57:52 UTC (rev 71775)
@@ -0,0 +1,94 @@
+\documentclass[load-preamble+]{cnltx-doc}
+
+\usepackage{setspace,hologo,changelog,enumitem}
+\usepackage[margin = 1in,marginparwidth = 0.6in,footskip = 0.5in]{geometry}
+\setcnltx
+  {
+    package           = passopt,
+    version           = v1.00a,
+    date              = 2024/07/10,
+    authors           = Qu Yi,
+    info              = Passing options to packages or classes,
+    email             = toquyi at 163.com,
+    url               = https://github.com/texno3/passopt,
+    abstract          =
+      {
+        \pkg*{passopt} allow reset the global options of a loaded macro package or document class, or to change the position of the pre-passed options in the list to the right.
+      },
+    color-scheme      = blue,
+    listings-options  = {numbers = none,gobble = 2,lineskip = 1pt},
+    pre-output        = {\parindent = 0em\setstretch{1.3}},
+    before-skip       = \smallskipamount,
+    after-skip        = \smallskipamount
+  }
+\makeatletter
+\newcommand{\splitmeta}[2]{\meta{#1}\texttt{,}\meta{#2}}
+\newcommand{\newsplitarg}[4][\splitmeta]
+  {
+    \newcommand{#2}[2]
+      {\code{\textcolor{argument}{#3\textnormal{#1{##1}{##2}}#4}}}
+  }
+\newcommand{\kvsplit}[3]
+  {
+    \item\code{\option{#1}\cnltx at isvalue\splitmarg{#2}{#3}}
+    \cnltx at checkdefault{\hfill\newline}
+  }
+\newsplitarg{\splitoarg}{[}{]}
+\newsplitarg{\splitmarg}{\{}{\}}
+\newsplitarg{\splitdarg}{(}{)}
+\newnote{\newtag}[1]{\textcolor{red}{#1}}
+\renewcommand{\emph}[1]{\textcolor{red}{#1}}
+\renewcommand{\cnltx at write@lastname}{}
+\setlist{nosep,topsep = \smallskipamount}
+\setlist[description,1]{leftmargin = \parindent}
+\setlist[itemize,1]{leftmargin = *}
+\makeatother
+
+\begin{document}
+\section{Preface}
+For a developer, there are some cases where packages and classes may load other packages or classes with options. However, other developers or users may wish to disable the enabled options or enable new ones. To enable new options, \hologo{LaTeXe} provides the \cs{PassOptionsToPackage} and \cs{PassOptionsToClass} commands to pass the options before the package or class is loaded, but the passed options are located on the \textcolor{red}{left} side of the final options list.
+\begin{sourcecode}
+  \PassOptionsToPackage{opt1,opt2=A}{mypackage}
+
+  \documentclass{book}
+  \usepackage[opt3]{mypackage}
+
+  \begin{document}
+  \end{document}
+\end{sourcecode}
+
+In the example above, the list of options that the \pkg*{mypackage} macro package ends up executing is \fbox{\code{opt1,opt2=A,opt3}}. If you wish to \textcolor{red}{disable} the pre-enabled options or place the newly enabled options to the \textcolor{red}{right} of the list (last executed), then you need to modify the code of the load command in the package or class file, but this is not recommended for public sharing. Therefore, this macro package provides commands to reset the options and change the order of the new options.
+
+\section{User commands}
+\begin{commands}
+  \command{SetOptionsToPackage}[\sarg\marg{options list}\marg{package}]
+  Passes options to the macro package, the location of the passed options is to the right of the options used when loading the macro package. If an asterisk parameter is used, only the passed options were ultimately retained.
+  \command{SetOptionsToClass}[\sarg\marg{options list}\marg{class}]
+  Similar to the previous command, but passing options for the document class.
+  \begin{sourcecode}
+  \RequirePackage{passopt}
+  \SetOptionsToPackage{opt1,opt2=A}{mypackage}
+
+  \documentclass{book}
+  \usepackage[opt3]{mypackage}
+
+  \begin{document}
+  \end{sourcecode}
+
+  In the example above, the list of options that the \pkg*{mypackage} macro package ends up executing is \fbox{\code{opt3,opt1,opt2=A}}. If the asterisk parameter is used, the list is \fbox{\code{opt1,opt2=A}}.
+
+  Note that since macro packages or document classes can only be loaded effectively once (using the \cs{usepackage} and \cs{RequirePackage} commands), only options passed before the first loading of a macro package or document class are effective, and it is recommended for users to use commands that pass options before \cs{documentclass}.
+  \command{ClearPackageOptions}[\marg{package}]
+  Clears the options that will be loaded into the macro package. The following commands has the same effect as \cs*{SetOptionsToPackage}\code{*}.
+  \begin{sourcecode}
+  \ClearPackageOptions{mypackage}
+  \SetOptionsToPackage{opt1,opt2=A}{mypackage}
+  \end{sourcecode}
+  \command{ClearClassOptions}[\marg{class}]
+  Similar to the previous command, but passing options for the document class.
+\end{commands}
+
+\appendix
+\nocite{*}
+
+\end{document}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/passopt/passopt.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/passopt/passopt.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/passopt/passopt.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/passopt/passopt.sty	2024-07-11 19:57:52 UTC (rev 71775)
@@ -0,0 +1,60 @@
+%
+% ***************** THE PASSOPT PACKAGE *****************
+%
+% Copyright (C) 2024 by Qu Yi <toquyi at 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/10}{1.00a}
+  {Passing options to packages or classes}
+
+\cs_generate_variant:Nn \tl_if_blank:nF { v }
+\cs_new:Npn \po_save_option_list:n #1 { #1 }
+\cs_new:Npn \po_add_before_hook:nnn #1#2
+  { \AddToHook{#1/#2/before}[passopt] }
+\NewDocumentCommand{\SetOptionsToPackage}{smm}
+  {
+    \po_add_before_hook:nnn { package } {#3}
+      {
+        \cs_gset:cpx { @raw at opt@#3.sty }
+          {
+            \IfBooleanF{#1}
+              {
+                \tl_if_blank:vF { opt@#3.sty }
+                  { \use:c { opt@#3.sty }, }
+              }
+            \po_save_option_list:n {#2}
+          }
+      }
+  }
+\NewDocumentCommand{\SetOptionsToClass}{smm}
+  {
+    \po_add_before_hook:nnn { class } {#3}
+      {
+        \cs_gset:cpx { @raw at opt@#3.cls }
+          {
+            \IfBooleanF{#1}
+              {
+                \tl_if_blank:vF { opt@#3.cls }
+                  { \use:c { opt@#3.cls }, }
+              }
+            \po_save_option_list:n {#2}
+          }
+      }
+  }
+\cs_new_protected:Npn \ClearPackageOptions #1
+  {
+    \po_add_before_hook:nnn { package } {#1}
+      { \tl_clear:c { opt@#1.sty } }
+  }
+\cs_new_protected:Npn \ClearClassOptions #1
+  {
+    \po_add_before_hook:nnn { class } {#1}
+      { \tl_clear:c { opt@#1.cls } }
+  }
+\endinput
+%
+% End of file `passopt.sty'.
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/passopt/passopt.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2024-07-11 19:57:18 UTC (rev 71774)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2024-07-11 19:57:52 UTC (rev 71775)
@@ -641,7 +641,8 @@
     palatino palette pangram panneauxroute paper papercdcase papermas papertex
     papiergurvan paracol parades paralist parallel paratype
     paresse parnotes parrun parsa parsimatn parsinevis parselines parskip
-    pas-cours pas-crosswords pas-cv pas-tableur pascaltriangle passivetex 
+    pas-cours pas-crosswords pas-cv pas-tableur
+    pascaltriangle passivetex passopt
     patch patchcmd patgen2-tutorial path pauldoc pawpict pax
     pbalance pbibtex-base pbox pb-diagram pbibtex-manual pbsheet
     pdf14

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2024-07-11 19:57:18 UTC (rev 71774)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2024-07-11 19:57:52 UTC (rev 71775)
@@ -1059,6 +1059,7 @@
 depend pas-cours
 depend pas-cv
 depend pas-tableur
+depend passopt
 depend patch
 depend patchcmd
 depend pauldoc

Added: trunk/Master/tlpkg/tlpsrc/passopt.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.