diff options
Diffstat (limited to 'macros/latex')
-rw-r--r-- | macros/latex/contrib/catppuccinpalette/README.md | 28 | ||||
-rw-r--r-- | macros/latex/contrib/catppuccinpalette/catppuccinpalette.dtx | 422 | ||||
-rw-r--r-- | macros/latex/contrib/catppuccinpalette/catppuccinpalette.ins | 57 | ||||
-rw-r--r-- | macros/latex/contrib/catppuccinpalette/catppuccinpalette.pdf | bin | 0 -> 210724 bytes | |||
-rw-r--r-- | macros/latex/contrib/spbmark/spbmark.pdf | bin | 91761 -> 91750 bytes | |||
-rw-r--r-- | macros/latex/contrib/spbmark/spbmark.sty | 64 | ||||
-rw-r--r-- | macros/latex/contrib/spbmark/spbmark.tex | 41 |
7 files changed, 579 insertions, 33 deletions
diff --git a/macros/latex/contrib/catppuccinpalette/README.md b/macros/latex/contrib/catppuccinpalette/README.md new file mode 100644 index 0000000000..1cb1507f22 --- /dev/null +++ b/macros/latex/contrib/catppuccinpalette/README.md @@ -0,0 +1,28 @@ +# Readme for the package catppuccinPalette + +Author: Lukas Heindl (`oss.heindl+latex@protonmail.com`). + +CTAN page: not yet + +## License +The LaTeX package `catppuccinPalette` is distributed under the LPPL 1.3 license. + +## Description + +The LaTeX package `catppuccinPalette` provides new colors for xcolor. + +## Installation + +For a manual installation: + +* put the files `catppuccinpalette.ins` and `catppuccinpalette.dtx` in the same directory; +* run `latex catppuccinpalette.ins` in that directory. + +The file `catppuccinpalette.sty` will be generated. + +The file `catppuccinpalette.sty` is the only file necessary to use the latex package `catppuccinPalette`. +You have to put it in the same directory as your document or (best) in a `texmf` tree. + +Simplified version: + +* run `l3build unpack` to generate the `.sty` in `build/unpacked/` diff --git a/macros/latex/contrib/catppuccinpalette/catppuccinpalette.dtx b/macros/latex/contrib/catppuccinpalette/catppuccinpalette.dtx new file mode 100644 index 0000000000..d9cabfcd02 --- /dev/null +++ b/macros/latex/contrib/catppuccinpalette/catppuccinpalette.dtx @@ -0,0 +1,422 @@ +% \iffalse meta-comment +% +% Copyright (C) 2024 by Lukas Heindl <oss.heindl+latex@protonmail.com> +% --------------------------------------------------------------------------- +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Lukas Heindl. +% +% This work consists of the files catppuccinpalette.dtx and catppuccinpalette.ins +% and the derived filebase catppuccinpalette.sty. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{catppuccinpalette.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{catppuccinpalette} +%<*package> + [2024/02/27 v1.0.1 catppuccin xcolor palette] +%</package> +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{catppuccinpalette}[2024/02/27] +\usepackage{multicol} +\usepackage{pgffor} +\usepackage{tabularx, booktabs} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{catppuccinpalette.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi +% +% \CheckSum{111} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v0.0.1}{2024/02/09}{Converted to DTX file} +% \changes{v1.0.0}{2024/02/27}{First full release} +% \changes{v1.0.1}{2024/05/19}{Make fit for CTAN} +% +% \DoNotIndex{\newcommand,\newenvironment,\color,\colorlet,\def,\fi,\RequirePackage,\ProvidesPackage,\ProcessPgfOptions,\preparecolorset,\pgfkeys,\pagecolor,\newif,\NeedsTeXFormat} +% +% \providecommand*{\url}{\texttt} +% \GetFileInfo{catppuccinpalette.dtx} +% \title{The \textsf{catppuccinPalette} package} +% \author{Lukas Heindl \\ \url{oss.heindl+latex@protonmail.com} \\ \url{https://github.com/atticus-sullivan/catpuccinPalette}} +% \date{\fileversion~from \filedate} +% +% \maketitle +% +% \begin{abstract} +% The LaTeX package \pkg{catppuccinPalette} provides new colors for xcolor. +% \end{abstract} +% +% \section{Introduction} +% +% Catppuccin\footnote{\url{https://github.com/catppuccin/catppuccin}} is a nice +% pastel theme in 4 flavours/styles (\emph{Latte}, \emph{Frapp\'e}, +% \emph{Macchiato}, \emph{Mocha}). This package defines these themes as xcolor +% colors. +% +% \section{Usage} +% +% Load via |\usepackage{catppuccinpalette}| +% +% Just use the new colors (prefixed with \verb|Cat<Style>|) like normal xcolors. +% In addition to the usual colors of the palette, this package defines some +% colors according to the +% style guide\footnote{\url{https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md}} +% for ease of use. +% +% This package also allows you to set a specific style which sets the shortened +% color names (prefixed only with \verb|Cat|) to the selected style (allows for +% easy switching style) via the package option \verb|style|. +% +% This package loads xcolor (without options) so if you want to set some xcolor +% options you should load xcolor before loading this package. +% +% \subsection{Package options} +% \begin{tabularx}{\linewidth}{lX} +% \emph{Option} & \emph{Description} +% \\\toprule +% \verb|style| & +% set the style used by the shortened prefix (\verb|Cat|). Possible values: +% \verb|Latte| (default+initial), \verb|latte|, \verb|Frappe|, \verb|frappe|, +% \verb|Mocha|, \verb|mocha| +% \\ +% \verb|textcolor| & +% set the default textcolor of the document to \verb|CatText|. Possible values: +% \verb|false| (default+initial), \verb|true| +% \\ +% \verb|pagecolor| & +% set the pagecolor of the document to \verb|CatBackground|. Possible values: +% \verb|false| (default+initial), \verb|true| +% \\\midrule +% \verb|styleAll| & +% shortcut for setting \verb|pagecolor| and \verb|textcolor| +% \\\bottomrule +% \end{tabularx} +% +% \subsection{Colors} +% \newcommand{\showCol}[1]{\raisebox{0.5ex}{\fcolorbox{black}{#1}{\hspace{1em}}} #1} +% \foreach \Style in {Latte,Frappe,Macchiato,Mocha}{ +% \subsubsection{Style \texttt{\Style}} +% \begin{multicols}{2} +% \def\Style{Latte} +% \showCol{Cat\Style Blue}\par +% \showCol{Cat\Style Rosewater}\par +% \showCol{Cat\Style Flamingo}\par +% \showCol{Cat\Style Pink}\par +% \showCol{Cat\Style Mauve}\par +% \showCol{Cat\Style Red}\par +% \showCol{Cat\Style Maroon}\par +% \showCol{Cat\Style Peach}\par +% \showCol{Cat\Style Yellow}\par +% \showCol{Cat\Style Green}\par +% \showCol{Cat\Style Teal}\par +% \showCol{Cat\Style Sky}\par +% \showCol{Cat\Style Sapphire}\par +% \showCol{Cat\Style Blue}\par +% \showCol{Cat\Style Lavender}\par +% \showCol{Cat\Style Text}\par +% \showCol{Cat\Style Subtext1}\par +% \showCol{Cat\Style Subtext0}\par +% \showCol{Cat\Style Overlay2}\par +% \showCol{Cat\Style Overlay1}\par +% \showCol{Cat\Style Overlay0}\par +% \showCol{Cat\Style Surface2}\par +% \showCol{Cat\Style Surface1}\par +% \showCol{Cat\Style Surface0}\par +% \showCol{Cat\Style Base}\par +% \showCol{Cat\Style Mantle}\par +% \showCol{Cat\Style Crust}\par +% \end{multicols} +% +% Some basic colors according to the style guide: +% +% \begin{multicols}{2} +% \showCol{Cat\Style Background}\par +% \showCol{Cat\Style Link}\par +% \phantom{}\par +% \columnbreak +% \showCol{Cat\Style Success}\par +% \showCol{Cat\Style Warning}\par +% \showCol{Cat\Style Error}\par +% \end{multicols} +% +% } +% +% +% \StopEventually{} +% +% \section{Implementation} +% +% \iffalse +%<*package> +% \fi +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\RequirePackage{pgfopts} +\RequirePackage{xcolor} +% \end{macrocode} +% Define the conditionals used by package options +% \begin{macrocode} +\newif\ifcatppuccinpalette@pagecolor +\newif\ifcatppuccinpalette@textcolor +\pgfkeys{ + /catppuccinPalette/.cd, +% \end{macrocode} +% Define the package option keys +% \begin{macrocode} + style/.is choice, + style/.value required, + style/Latte/.code = {\def\catppuccinpalette@style{Latte}}, + style/latte/.forward to = /catppuccinPalette/style/Latte, + style/Frappe/.code = {\def\catppuccinpalette@style{Frappe}}, + style/frappe/.forward to = /catppuccinPalette/style/frappe, + style/Macchiato/.code = {\def\catppuccinpalette@style{Macchiato}}, + style/macchiato/.forward to = /catppuccinPalette/style/Macchiato, + style/Mocha/.code = {\def\catppuccinpalette@style{Mocha}}, + style/mocha/.forward to = /catppuccinPalette/style/Mocha, + textcolor/.is if = catppuccinpalette@textcolor, + textcolor/.default = true, + pagecolor/.is if = catppuccinpalette@pagecolor, + pagecolor/.default = true, + styleAll/.style = {pagecolor,textcolor}, +% \end{macrocode} +% Set initial values for all options +% \begin{macrocode} + textcolor = false, + pagecolor = false, + style = Latte, +} +\ProcessPgfOptions* +% \end{macrocode} +% Define the \emph{Latte} colorset +% \begin{macrocode} +\preparecolorset{RGB/HTML}{CatLatte}{}{% + Rosewater,220,138,120/DC8A78;% + Flamingo,221,120,120/DD7878;% + Pink,234,118,203/EA76CB;% + Mauve,136,57,239/8839EF;% + Red,210,15,57/D20F39;% + Maroon,230,69,83/E64553;% + Peach,254,100,11/FE640B;% + Yellow,223,142,29/DF8E1D;% + Green,64,160,43/40A02B;% + Teal,23,146,153/179299;% + Sky,4,165,229/04A5E5;% + Sapphire,32,159,181/209FB5;% + Blue,30,102,245/1E66F5;% + Lavender,114,135,253/7287FD;% + Text,76,79,105/4C4F69;% + Subtext1,92,95,119/5C5F77;% + Subtext0,108,111,133/6C6F85;% + Overlay2,124,127,147/7C7F93;% + Overlay1,140,143,161/8C8FA1;% + Overlay0,156,160,176/9CA0B0;% + Surface2,172,176,190/ACB0BE;% + Surface1,188,192,204/BCC0CC;% + Surface0,204,208,218/CCD0DA;% + Base,239,241,245/EFF1F5;% + Mantle,230,233,239/E6E9EF;% + Crust,220,224,232/DCE0E8% +} +% \end{macrocode} +% Define colors according to the catppuccin style guide +% \begin{macrocode} +\colorlet{CatLatteBackground}{CatLatteBase} +\colorlet{CatLatteLink}{CatLatteBlue} +\colorlet{CatLatteSuccess}{CatLatteGreen} +\colorlet{CatLatteWarning}{CatLatteYellow} +\colorlet{CatLatteError}{CatLatteRed} +% \end{macrocode} +% Define the styles \emph{Frappe}, \emph{Macchiato} and \emph{Mocha} accordingly +% \begin{macrocode} +\preparecolorset{RGB/HTML}{CatFrappe}{}{% + Rosewater,242,213,207/F2D5CF;% + Flamingo,238,190,190/EEBEBE;% + Pink,244,184,228/F4B8E4;% + Mauve,202,158,230/CA9EE6;% + Red,231,130,132/E78284;% + Maroon,234,153,156/EA999C;% + Peach,239,159,118/EF9F76;% + Yellow,229,200,144/E5C890;% + Green,166,209,137/A6D189;% + Teal,129,200,190/81C8BE;% + Sky,153,209,219/99D1DB;% + Sapphire,133,193,220/85C1DC;% + Blue,140,170,238/8CAAEE;% + Lavender,186,187,241/BABBF1;% + Text,198,208,245/C6D0F5;% + Subtext1,181,191,226/B5BFE2;% + Subtext0,165,173,206/A5ADCE;% + Overlay2,148,156,187/949CBB;% + Overlay1,131,139,167/838BA7;% + Overlay0,115,121,148/737994;% + Surface2,98,104,128/626880;% + Surface1,81,87,109/51576D;% + Surface0,65,69,89/414559;% + Base,48,52,70/303446;% + Mantle,41,44,60/292C3C;% + Crust,35,38,52/232634% +} +\colorlet{CatFrappeBackground}{CatFrappeBase} +\colorlet{CatFrappeLink}{CatFrappeBlue} +\colorlet{CatFrappeSuccess}{CatFrappeGreen} +\colorlet{CatFrappeWarning}{CatFrappeYellow} +\colorlet{CatFrappeError}{CatFrappeRed} +\preparecolorset{RGB/HTML}{CatMacchiato}{}{% + Rosewater,244,219,214/F4DBD6;% + Flamingo,240,198,198/F0C6C6;% + Pink,245,189,230/F5BDE6;% + Mauve,198,160,246/C6A0F6;% + Red,237,135,150/ED8796;% + Maroon,238,153,160/EE99A0;% + Peach,245,169,127/F5A97F;% + Yellow,238,212,159/EED49F;% + Green,166,218,149/A6DA95;% + Teal,139,213,202/8BD5CA;% + Sky,145,215,227/91D7E3;% + Sapphire,125,196,228/7DC4E4;% + Blue,138,173,244/8AADF4;% + Lavender,183,189,248/B7BDF8;% + Text,202,211,245/CAD3F5;% + Subtext1,184,192,224/B8C0E0;% + Subtext0,165,173,203/A5ADCB;% + Overlay2,147,154,183/939AB7;% + Overlay1,128,135,162/8087A2;% + Overlay0,110,115,141/6E738D;% + Surface2,91,96,120/5B6078;% + Surface1,73,77,100/494D64;% + Surface0,54,58,79/363A4F;% + Base,36,39,58/24273A;% + Mantle,30,32,48/1E2030;% + Crust,24,25,38/181926% +} +\colorlet{CatMacchiatoBackground}{CatMacchiatoBase} +\colorlet{CatMacchiatoLink}{CatMacchiatoBlue} +\colorlet{CatMacchiatoSuccess}{CatMacchiatoGreen} +\colorlet{CatMacchiatoWarning}{CatMacchiatoYellow} +\colorlet{CatMacchiatoError}{CatMacchiatoRed} +\preparecolorset{RGB/HTML}{CatMocha}{}{% + Rosewater,245,224,220/F5E0DC;% + Flamingo,242,205,205/F2CDCD;% + Pink,245,194,231/F5C2E7;% + Mauve,203,166,247/CBA6F7;% + Red,243,139,168/F38BA8;% + Maroon,235,160,172/EBA0AC;% + Peach,250,179,135/FAB387;% + Yellow,249,226,175/F9E2AF;% + Green,166,227,161/A6E3A1;% + Teal,148,226,213/94E2D5;% + Sky,137,220,235/89DCEB;% + Sapphire,116,199,236/74C7EC;% + Blue,137,180,250/89B4FA;% + Lavender,180,190,254/B4BEFE;% + Text,205,214,244/CDD6F4;% + Subtext1,186,194,222/BAC2DE;% + Subtext0,166,173,200/A6ADC8;% + Overlay2,147,153,178/9399B2;% + Overlay1,127,132,156/7F849C;% + Overlay0,108,112,134/6C7086;% + Surface2,88,91,112/585B70;% + Surface1,69,71,90/45475A;% + Surface0,49,50,68/313244;% + Base,30,30,46/1E1E2E;% + Mantle,24,24,37/181825;% + Crust,17,17,27/11111B% +} +% \end{macrocode} +% Define shortcuts for active style +% \begin{macrocode} +\colorlet{CatMochaBackground}{CatMochaBase} +\colorlet{CatMochaLink}{CatMochaBlue} +\colorlet{CatMochaSuccess}{CatMochaGreen} +\colorlet{CatMochaWarning}{CatMochaYellow} +\colorlet{CatMochaError}{CatMochaRed} +\colorlet{CatRosewater}{Cat\catppuccinpalette@style Rosewater} +\colorlet{CatFlamingo}{Cat\catppuccinpalette@style Flamingo} +\colorlet{CatPink}{Cat\catppuccinpalette@style Pink} +\colorlet{CatMauve}{Cat\catppuccinpalette@style Mauve} +\colorlet{CatRed}{Cat\catppuccinpalette@style Red} +\colorlet{CatMaroon}{Cat\catppuccinpalette@style Maroon} +\colorlet{CatPeach}{Cat\catppuccinpalette@style Peach} +\colorlet{CatYellow}{Cat\catppuccinpalette@style Yellow} +\colorlet{CatGreen}{Cat\catppuccinpalette@style Green} +\colorlet{CatTeal}{Cat\catppuccinpalette@style Teal} +\colorlet{CatSky}{Cat\catppuccinpalette@style Sky} +\colorlet{CatSapphire}{Cat\catppuccinpalette@style Sapphire} +\colorlet{CatBlue}{Cat\catppuccinpalette@style Blue} +\colorlet{CatLavender}{Cat\catppuccinpalette@style Lavender} +\colorlet{CatText}{Cat\catppuccinpalette@style Text} +\colorlet{CatSubtext1}{Cat\catppuccinpalette@style Subtext1} +\colorlet{CatSubtext0}{Cat\catppuccinpalette@style Subtext0} +\colorlet{CatOverlay2}{Cat\catppuccinpalette@style Overlay2} +\colorlet{CatOverlay1}{Cat\catppuccinpalette@style Overlay1} +\colorlet{CatOverlay0}{Cat\catppuccinpalette@style Overlay0} +\colorlet{CatSurface2}{Cat\catppuccinpalette@style Surface2} +\colorlet{CatSurface1}{Cat\catppuccinpalette@style Surface1} +\colorlet{CatSurface0}{Cat\catppuccinpalette@style Surface0} +\colorlet{CatBase}{Cat\catppuccinpalette@style Base} +\colorlet{CatMantle}{Cat\catppuccinpalette@style Mantle} +\colorlet{CatCrust}{Cat\catppuccinpalette@style Crust} +\colorlet{CatBackground}{Cat\catppuccinpalette@style Base} +\colorlet{CatLink}{Cat\catppuccinpalette@style Blue} +\colorlet{CatSuccess}{Cat\catppuccinpalette@style Green} +\colorlet{CatWarning}{Cat\catppuccinpalette@style Yellow} +\colorlet{CatError}{Cat\catppuccinpalette@style Red} +% \end{macrocode} +% Set (only initial) pagecolor according to the style guide if the user wants this +% \begin{macrocode} +\ifcatppuccinpalette@pagecolor + \pagecolor{CatBackground} +\fi +% \end{macrocode} +% Set textcolor according to the style guide if the user wants this +% \begin{macrocode} +\ifcatppuccinpalette@textcolor + \color{CatText} +\fi +% \end{macrocode} +\endinput +% +% \iffalse +%</package> +% \fi +% +% \Finale +\endinput diff --git a/macros/latex/contrib/catppuccinpalette/catppuccinpalette.ins b/macros/latex/contrib/catppuccinpalette/catppuccinpalette.ins new file mode 100644 index 0000000000..c93b929dcd --- /dev/null +++ b/macros/latex/contrib/catppuccinpalette/catppuccinpalette.ins @@ -0,0 +1,57 @@ +%% Copyright (C) 2024 by Lukas Heindl <oss.heindl+latex@protonmail.com> +%% -------------------------------------------------------------------------- +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Lukas Heindl. +%% +%% This work consists of the files catppuccinpalette.dtx and catppuccinpalette.ins +%% and the derived filebase catppuccinpalette.sty. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/catppuccinpalette} + +\preamble + +This is a generated file. + +Copyright (C) 2024 by Lukas Heindl <oss.heindl+latex@protonmail.com> +-------------------------------------------------------------------------- +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +\endpreamble + +\generate{\file{catppuccinpalette.sty}{\from{catppuccinpalette.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* catppuccinpalette.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file catppuccinpalette.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile diff --git a/macros/latex/contrib/catppuccinpalette/catppuccinpalette.pdf b/macros/latex/contrib/catppuccinpalette/catppuccinpalette.pdf Binary files differnew file mode 100644 index 0000000000..aedd35c9bf --- /dev/null +++ b/macros/latex/contrib/catppuccinpalette/catppuccinpalette.pdf diff --git a/macros/latex/contrib/spbmark/spbmark.pdf b/macros/latex/contrib/spbmark/spbmark.pdf Binary files differindex 5ad9b3e360..8242e5e3bf 100644 --- a/macros/latex/contrib/spbmark/spbmark.pdf +++ b/macros/latex/contrib/spbmark/spbmark.pdf diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty index 9646dc1e00..c1ce4837a5 100644 --- a/macros/latex/contrib/spbmark/spbmark.sty +++ b/macros/latex/contrib/spbmark/spbmark.sty @@ -9,7 +9,7 @@ % https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2018/12/31] \RequirePackage{xparse,l3keys2e} -\ProvidesExplPackage{spbmark}{2024/05/13}{1.46i} +\ProvidesExplPackage{spbmark}{2024/05/19}{1.46j} {Customize superscripts and subscripts} \cs_generate_variant:Nn \box_set_ht:Nn { cv } @@ -22,6 +22,8 @@ \cs_generate_variant:Nn \tl_if_novalue:nF { V } \cs_generate_variant:Nn \tl_if_blank:nF { v } +\providecommand{\AfterPreamble}{\AtBeginDocument} +\AtBeginDocument{\cs_set_eq:NN \AfterPreamble \use:n} \cs_set_eq:NN \spb@textsuperscript@save \textsuperscript \cs_set_eq:NN \spb@textsubscript@save \textsubscript \cs_set_eq:NN \spb@math@super@save \sp @@ -30,46 +32,78 @@ \cs_new_protected:Npn \spb_define:n { \keys_define:nn { ctex/tools } } \cs_new_protected:Npn \spb_set:n { \keys_set:nn { ctex/tools } } \cs_set_eq:NN \spbset \spb_set:n + \keys_define:nn { spbmark/option } { text .choice:, - text/true .code:n = + text/true .code:n = { \cs_set:Npn \textsuperscript { \super[textsp] } \cs_set:Npn \textsubscript { \sub[textsb] } }, - text/false .code:n = + text/false .code:n = { \cs_set:Npn \textsuperscript { \spb@textsuperscript@save } \cs_set:Npn \textsubscript { \spb@textsubscript@save } }, - text .default:n = true, + text .default:n = true, math .choice:, - math/true .code:n = + math/true .code:n = { \cs_set:Npn \sp { \super[mathsp] } \cs_set:Npn \sb { \sub[mathsb] } }, - math/false .code:n = + math/false .code:n = { \cs_set:Npn \sp { \spb@math@super@save } \cs_set:Npn \sb { \spb@math@sub@save } }, - math .default:n = true, + math .default:n = true, foot .choice:, - foot/true .code:n = + foot/true .code:n = { \cs_set:Npn \@makefnmark { \hbox:n { \fnmarkfont{\super[fnmark]{\@thefnmark}} } } }, - foot/false .code:n = + foot/false .code:n = { \cs_set:Npn \@makefnmark { \spb@@makefnmark@save } }, - foot .default:n = true, - both .meta:n = { text = #1,math = #1 }, - both .default:n = true, - all .meta:n = { text = #1,math = #1,foot = #1 }, - all .default:n = true + foot .default:n = true, + both .meta:n = { text = #1,math = #1 }, + both .default:n = true, + all .meta:n = { text = #1,math = #1,foot = #1 }, + all .default:n = true + } +\char_set_catcode_active:N \~ +\keys_define:nn { spbmark/option } + { + math* .choice:, + math*/true .code:n = + { + \AfterPreamble + { + \group_begin: + \char_set_lccode:nn { `\~ } { `\^ } + \lowercase{\group_end:\cs_set:Npn ~} { \super[mathsp*] } + \group_begin: + \char_set_lccode:nn { `\~ } { `\_ } + \lowercase{\group_end:\cs_set:Npn ~} { \sub[mathsb*] } + \char_set_mathcode:nn { `\^ } { "8000 } + \char_set_catcode_other:N \^ + \char_set_catcode_other:N \_ + } + }, + math*/false .code:n = + { + \AfterPreamble + { + \char_set_catcode_math_superscript:N \^ + \char_set_catcode_math_subscript:N \_ + \char_set_mathcode:nn { `\^ } { "005E } + } + }, + math* .default:n = true } +\char_set_catcode_space:N \~ \tl_if_exist:NTF \ftntm@font { \tl_set_eq:NN \fnmarkfont \ftntm@font } { \tl_set_eq:NN \fnmarkfont \normalfont } @@ -112,7 +146,7 @@ \cs_new_protected:Npn \spbshortkv #1#2 { \spb_define:n { #1 .meta:n = {#2} } } \clist_map_inline:nn - { textsp,textsb,mathsp,mathsb,fnmark } + { textsp,textsb,mathsp,mathsb,mathsp*,mathsb*,fnmark } { \defspbstyle{#1}{} \spbshortkv{#1}{style = #1} diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex index e631b4c210..9d04ea07f9 100644 --- a/macros/latex/contrib/spbmark/spbmark.tex +++ b/macros/latex/contrib/spbmark/spbmark.tex @@ -8,8 +8,8 @@ { package = spbmark, title = the spbmark package, - version = v1.46i, - date = 2024/05/13, + version = v1.46j, + date = 2024/05/19, authors = Qu Yi, info = Customize superscript and subscript, email = toquyi@163.com, @@ -40,7 +40,7 @@ \newsplitarg{\splitoarg}{[}{]} \newsplitarg{\splitmarg}{\{}{\}} \newsplitarg{\splitdarg}{(}{)} -\newnote{\newtag}[1][New]{\textcolor{red}{#1}} +\newnote{\newtag}[1]{\textcolor{red}{#1}} \renewcommand{\emph}[1]{\textcolor{red}{#1}} \renewcommand{\cnltx@write@lastname}{} \makeatother @@ -49,12 +49,14 @@ \section{Macro package options} The following macro package options will redefine the script commands of the \LaTeX{} kernel. If you do not specify the values of boolean options, they default to \code{true}. These options can also be changed in the preamble area and main body using the global control command \cs{spbset}. \begin{options} - \keychoice{text}{true,\fbox{false}}\newtag[Changed]% - \cs{textsuperscript} and \cs{textsubscript} are equivalent to the \cs{super} and \cs{sub} commands. You can also use the \cs{defspbstyle} command to define the style \code{textsp} and \code{textsb} to change the format of the text superscript and subscript. - \keychoice{math}{true,\fbox{false}}\newtag[Changed]% - \cs{sp} and \cs{sb} are equivalent to the \cs{super} and \cs{sub} commands. You can also use the \cs{defspbstyle} command to define the style \code{mathsp} and \code{mathsb} to change the format of the math superscript and subscript. - \keychoice{foot}{true,\fbox{false}}\newtag[Changed]% - The format of the footnote mark match the superscript global move and format settings. You can also use the \cs{defspbstyle} command to define the superscript style \code{fnmark} to change the format of the footnote mark. + \keychoice{text}{true,\fbox{false}} + \cs{textsuperscript} and \cs{textsubscript} are equivalent to the \cs{super} and \cs{sub} commands. The command \cs{defspbstyle} can be used to define the style \code{textsp} and \code{textsb} to change the format of the text superscript and subscript. + \keychoice{math}{true,\fbox{false}} + \cs{sp} and \cs{sb} are equivalent to the \cs{super} and \cs{sub} commands. The command \cs{defspbstyle} can be used to define the style \code{mathsp} and \code{mathsb} to change the format of the math superscript and subscript. + \keychoice{math*}{true,\fbox{false}}\newtag{Exp\\v1.46j}% + The \code{\^{}} and \code{\_{}} tokens in the math mode are equivalent to the \cs{super} and \cs{sub} commands. The command \cs{defspbstyle} can be used to define the style \code{mathsp*} and \code{mathsb*} to change the format of the math superscript and subscript. + \keychoice{foot}{true,\fbox{false}} + The format of the footnote mark match the superscript global move and format settings. \cs{defspbstyle} can be used to define the superscript style \code{fnmark} to change the format of the footnote mark. \begin{example}[code-only] \defspbstyle{textsp}{vmove=-1pt,cmd=\bfseries} \defspbstyle{mathsb}{hmove=0.5em} @@ -152,7 +154,7 @@ The options common to \meta{kv list} of the three commands are as follows. They Use the \meta{style name} defined by the \cs{defspbstyle} command to make it work global or local. \keychoice{mode}{text,math,\fbox{match}} The mode of superscript or subscript output can be \code{text} or \code{math} mode. The \code{match} option automatically matches output modes according to the current mode. - \keychoice{thiswd}{auto,\fbox{keep}}\newtag% + \keychoice{thiswd}{auto,\fbox{keep}} Sets how the length of the this marker is handled after this command is used. If it is \code{keep}, the width of the previous marker remains the same. If it is \code{auto}, if the next token is a marker command and the upper or lower position is the \textcolor{red}{opposite} of the this command, the width of the this marker is maintained, otherwise the width automatically returns to \textcolor{red}{zero}. \begin{example} \spbset{sbhmove=-\llastwd,sbthiswd=auto,sbcmd=\color{red}} @@ -161,7 +163,7 @@ The options common to \meta{kv list} of the three commands are as follows. They 3A\sub{bcd}[thiswd=keep]\sub{e}Some texts\sub{e} \\ 4A\sub{bcd}\sub{e}Some texts\sub{e} \end{example} - \keyval{regex}{regular expression}\newtag% + \keyval{regex}{regular expression} After using the superscript or subscript command, this option is used to determine whether the \textcolor{red}{following} tokens match the \meta{regular expression}. If it does \textcolor{red}{not}, the width of the this marker returns to zero. \begin{example}[code-only] \newcommand{\mysp}[2][]{\super[regex=\c{mysb},#1]{#2}} @@ -206,13 +208,13 @@ The following list of keys control the format both of superscript \emph{or} subs The distance between the subscript baseline and the previous line. \keyval{sbdepth}{fixed length} The distance between the subscript baseline and the next line. - \keychoice{spthiswd}{auto,\fbox{keep}}\newtag% + \keychoice{spthiswd}{auto,\fbox{keep}} Width processing mode after using this superscript. See Section \ref{sec:user commands} for the meaning of this option. - \keychoice{sbthiswd}{auto,\fbox{keep}}\newtag% + \keychoice{sbthiswd}{auto,\fbox{keep}} Width processing mode after using this subscript. See Section \ref{sec:user commands} for the meaning of this option. - \keyval{spregex}{regular expression}\newtag% + \keyval{spregex}{regular expression} After the superscript command is used, the regular expression rules of the following tokens are matched. See Section \ref{sec:user commands} for the meaning of this option. - \keyval{sbregex}{regular expression}\newtag% + \keyval{sbregex}{regular expression} After the subscript command is used, the regular expression rules of the following tokens are matched. See Section \ref{sec:user commands} for the meaning of this option. \end{options} @@ -251,9 +253,12 @@ Here is a list of the three commands, please pay attention to the usage of optio \subsection{siunitx} It can also be used with the \pkg*{siunitx} package to output superscript and subscript in the unit: \begin{example} - \unit[mode=math]{kg.m/s\super[vmove=-1pt]{2}} \\ - \qty[mode=text]{30}{A\supersub[hmove=1pt,cmd=\color{red}]{b}{c}} \\ - \spbset{sbhmove=2pt}\unit[mode=text]{A\sub{b}} + \spbset{spcmd=\spbifmath{}{\color{purple}}} + \sisetup{text-superscript-command=\super} + 1-\qty[mode=text]{10}{A^2} \\ + 2-\unit[mode=math]{kg.m/s\super[vmove=-1pt]{2}} \\ + 3-\qty[mode=text]{30}{A\supersub[hmove=1pt,cmd=\color{blue}]{b}{c}} \\ + 4-\spbset{sbhmove=2pt}\unit[mode=text]{A\sub{b}} \end{example} \subsection{realscripts} |