diff options
author | Norbert Preining <norbert@preining.info> | 2024-04-13 03:01:50 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-04-13 03:01:50 +0000 |
commit | 8c3c68877a46b9b70b5d02c8582595e90be9737a (patch) | |
tree | 1d3660064a6fbe1b71a4a6f1a505812aecafdf23 /macros | |
parent | 230773c2e42cd0257e4150d0b500aa7ca6c1c02a (diff) |
CTAN sync 202404130301
Diffstat (limited to 'macros')
39 files changed, 714 insertions, 245 deletions
diff --git a/macros/latex/contrib/huaz/README b/macros/latex/contrib/huaz/README index d0fcca51b4..b37490a04a 100644 --- a/macros/latex/contrib/huaz/README +++ b/macros/latex/contrib/huaz/README @@ -1,6 +1,6 @@ huaz.sty package -Copyright 2022 by Tibor Tómács +Copyright 2022-2024 by Tibor Tómács Automatic definite articles for Hungarian diff --git a/macros/latex/contrib/huaz/huaz.pdf b/macros/latex/contrib/huaz/huaz.pdf Binary files differindex a9092fdb9d..ab19e2a95f 100644 --- a/macros/latex/contrib/huaz/huaz.pdf +++ b/macros/latex/contrib/huaz/huaz.pdf diff --git a/macros/latex/contrib/huaz/huaz.sty b/macros/latex/contrib/huaz/huaz.sty index c6b40e6f14..8127c5b585 100644 --- a/macros/latex/contrib/huaz/huaz.sty +++ b/macros/latex/contrib/huaz/huaz.sty @@ -3,7 +3,7 @@ %% %% Automatic Hungarian definite articles %% -%% Copyright 2022 by Tibor Tomacs +%% Copyright 2022-2024 by Tibor Tomacs %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -18,7 +18,7 @@ %% The Current Maintainer of this work is Tibor Tomacs. %% \NeedsTeXFormat{LaTeX2e}[2021/10/10] -\ProvidesPackage{huaz}[2022/10/16 v1.0 Automatic Hungarian definite articles] +\ProvidesPackage{huaz}[2024/04/12 v1.1 Automatic Hungarian definite articles] \RequirePackage{xstring,refcount,iftex} @@ -102,7 +102,8 @@ \def\large{}\def\Large{}\def\LARGE{}\def\huge{}\def\Huge{}% \def\uppercase{}\def\lowercase{}\def\MakeUppercase{}\def\MakeLowercase{}% \def\textcolor{\huaz@deloptparam}\def\color{\huaz@deloptparam}% - \def\mbox{}\def\fbox{}} + \def\mbox{}\def\fbox{}% + \def\told{}} \AddToHook{huaz}{% Expandable cross-references commands \def\ref#1{\getrefnumber{#1}}% diff --git a/macros/latex/contrib/huaz/huaz.tex b/macros/latex/contrib/huaz/huaz.tex index 0d1eb4b74a..c873d10fb4 100644 --- a/macros/latex/contrib/huaz/huaz.tex +++ b/macros/latex/contrib/huaz/huaz.tex @@ -63,9 +63,9 @@ keepspaces]} \begin{document} \title{The \huaz\ package\\ - {\large v1.0 (2022/10/16)}} + {\large v1.1 (2024/04/12)}} \author{Tibor Tómács\\ - {\normalsize\href{email:tomacs.tibor@uni-eszterhazy.hu}{\nolinkurl{tomacs.tibor@uni-eszterhazy.hu}}}} + {\normalsize\href{email:tomacs.tibor@gmail.com}{\nolinkurl{tomacs.tibor@gmail.com}}}} \date{} \maketitle @@ -75,7 +75,7 @@ In Hungarian there are two definite articles, \emph{``a''} and \emph{``az''}, wh The \huaz\ package helps the user to insert automatically the correct definite article for cross-references and other commands containing text. Thus, if these change, the definite articles will also change accordingly. \medskip -\emph{Sorry, the documentation is in Hungarian, because only users of the Hungarian language are interested.} +\emph{Sorry, the documentation is in Hungarian. This is because only Hungar\-ian-speaking users are interested.} \end{abstract} \end{otherlanguage} diff --git a/macros/latex/contrib/hulipsum/hulipsum.dtx b/macros/latex/contrib/hulipsum/hulipsum.dtx index 02d257e3a9..693be54052 100644 --- a/macros/latex/contrib/hulipsum/hulipsum.dtx +++ b/macros/latex/contrib/hulipsum/hulipsum.dtx @@ -25,7 +25,7 @@ \ProvidesFile{hulipsum.dtx} %</driver> %<package>\NeedsTeXFormat{LaTeX2e}[2022/06/20] -%<package>\ProvidesPackage{hulipsum}[2024/04/07 v1.2 Hungarian dummy text (Lorum ipse)] +%<package>\ProvidesPackage{hulipsum}[2024/04/12 v1.3 Hungarian dummy text (Lorum ipse)] % %<*driver> \documentclass{ltxdoc} @@ -59,8 +59,8 @@ keepspaces]} % % \GetFileInfo{hulipsum.sty} % -% \title{The {\bfseries\sffamily hulipsum} package\\{\large v1.2 (2024/04/07)}} -% \author{Tibor Tómács\\{\normalsize\url{tomacs.tibor@gmail.com}}} +% \title{The {\bfseries\sffamily hulipsum} package\\{\large v1.3 (2024/04/12)}} +% \author{Tibor Tómács\\{\normalsize\href{mailto:tomacs.tibor@gmail.com}{\texttt{tomacs.tibor@gmail.com}}}} % \date{} % \maketitle % \thispagestyle{empty} @@ -110,22 +110,22 @@ keepspaces]} % % \begin{description} % \item \commandinline|maketitle=!<boolean>!| \hfill (default: \texttt{true})\\ -% Adds \verbinline|\maketitle| if the \commandinline|!<boolean>!| is \texttt{true}. +% Adds \verbinline|\maketitle|, if the \commandinline|!<boolean>!| is \texttt{true}. % % \item \commandinline|tableofcontents=!<boolean>!| \hfill (default: \texttt{true})\\ -% Adds \verbinline|\tableofcontents| if the \commandinline|!<boolean>!| is \texttt{true}. +% Adds \verbinline|\tableofcontents|, if the \commandinline|!<boolean>!| is \texttt{true}. % % \item \commandinline|part=!<boolean>!| \hfill (default: \texttt{false})\\ % Adds \verbinline|\part{...}| before the chapter and section, if the \commandinline|!<boolean>!| is \texttt{true}. % % \item \commandinline|abstract=!<boolean>!| \hfill (default: \texttt{true})\\ -% Adds an \texttt{abstract} environment if the \commandinline|!<boolean>!| is \texttt{true}. +% Adds an \texttt{abstract} environment, if the \commandinline|!<boolean>!| is \texttt{true}. % % \item \commandinline|math=!<boolean>!| \hfill (default: \texttt{true})\\ -% Adds a mathematical equation if the \commandinline|!<boolean>!| is \texttt{true}. +% Adds a mathematical formula, if the \commandinline|!<boolean>!| is \texttt{true}. % % \item \commandinline|bibliography=!<boolean>!| \hfill (default: \texttt{true})\\ -% Adds \texttt{thebibliography} environment if the \commandinline|!<boolean>!| is \texttt{true}. +% Adds \texttt{thebibliography} environment, if the \commandinline|!<boolean>!| is \texttt{true}. % \end{description} % The \texttt{=true} can be omitted in the options. For example \verbinline|\hulipsumdocument[part,math=false]|. % \end{description} @@ -243,7 +243,7 @@ keepspaces]} \if@hulipsum@maketitle \@ifundefined{title}{}{\title{L\'{o}rum ipse}} \@ifundefined{author}{}{\author{Nyomasek Bob\'{o}}} -\@ifundefined{supervisor}{}{\supervisor{Szel\'{e}s Gerg\H{o}\\ egyetemi docens}\author{Nyomasek Bob\'{o}\\ matematika szak}} +\@ifundefined{supervisor}{}{\supervisor{Dr. Szel\'{e}s Gerg\H{o}\\ egyetemi docens}\author{Nyomasek Bob\'{o}\\ matematika szak}} \@ifundefined{institute}{}{\institute{Matematikai és Informatikai Intézet}} \@ifundefined{city}{}{\city{Eger}} \@ifundefined{maketitle}{}{\maketitle} diff --git a/macros/latex/contrib/hulipsum/hulipsum.pdf b/macros/latex/contrib/hulipsum/hulipsum.pdf Binary files differindex c44bf76cb9..a692e8f383 100644 --- a/macros/latex/contrib/hulipsum/hulipsum.pdf +++ b/macros/latex/contrib/hulipsum/hulipsum.pdf diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md index 2c9d384bf9..87c775ca83 100644 --- a/macros/latex/contrib/siunitx/CHANGELOG.md +++ b/macros/latex/contrib/siunitx/CHANGELOG.md @@ -7,6 +7,12 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.3.13] - 2024-04-12 + +### Fixed +- Minimum digits in uncertainties under some circumstances (see issue + [\#725](https://github.com/josephwright/siunitx/issues/725)) + ## [v3.3.12] - 2024-02-15 ### Fixed @@ -2080,7 +2086,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ### Added - First public testing release (as `si`) -[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.3.12...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.3.13...HEAD +[v3.3.13]: https://github.com/josephwright/siunitx/compare/v3.3.12...v3.3.13 [v3.3.12]: https://github.com/josephwright/siunitx/compare/v3.3.11...v3.3.12 [v3.3.11]: https://github.com/josephwright/siunitx/compare/v3.3.10...v3.3.11 [v3.3.10]: https://github.com/josephwright/siunitx/compare/v3.3.9...v3.3.10 diff --git a/macros/latex/contrib/siunitx/README.md b/macros/latex/contrib/siunitx/README.md index 9b5881aead..9619de2d6b 100644 --- a/macros/latex/contrib/siunitx/README.md +++ b/macros/latex/contrib/siunitx/README.md @@ -17,8 +17,8 @@ ability to control tabular alignment of numbers. ## Author -This package is maintained by Joseph Wright: joseph.wright@morningstar2.co.uk +This package is maintained by Joseph Wright: joseph@texdev.net ## License -Released under the LaTeX Project Public License v1.3c or later. See https://www.latex-project.org/lppl.txt
\ No newline at end of file +Released under the LaTeX Project Public License v1.3c or later. See https://www.latex-project.org/lppl.txt diff --git a/macros/latex/contrib/siunitx/siunitx-abbreviation.dtx b/macros/latex/contrib/siunitx/siunitx-abbreviation.dtx index 2d4e60e1d4..f123546389 100644 --- a/macros/latex/contrib/siunitx/siunitx-abbreviation.dtx +++ b/macros/latex/contrib/siunitx/siunitx-abbreviation.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-abbreviation.dtx Copyright (C) 2018,2019,2021-2023 Joseph Wright +% File: siunitx-abbreviation.dtx Copyright (C) 2018,2019,2021-2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -49,7 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-angle.dtx b/macros/latex/contrib/siunitx/siunitx-angle.dtx index 7b2b012e13..ac933f4636 100644 --- a/macros/latex/contrib/siunitx/siunitx-angle.dtx +++ b/macros/latex/contrib/siunitx/siunitx-angle.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-angle.dtx Copyright (C) 2016-2019,2021-2023 Joseph Wright +% File: siunitx-angle.dtx Copyright (C) 2016-2019,2021-2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-binary.dtx b/macros/latex/contrib/siunitx/siunitx-binary.dtx index bcb643808e..04e18e6e06 100644 --- a/macros/latex/contrib/siunitx/siunitx-binary.dtx +++ b/macros/latex/contrib/siunitx/siunitx-binary.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-binary.dtx Copyright (C) 2021,2023 Joseph Wright +% File: siunitx-binary.dtx Copyright (C) 2021,2023,2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -49,7 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf Binary files differindex 71adbfb38c..cf00251427 100644 --- a/macros/latex/contrib/siunitx/siunitx-code.pdf +++ b/macros/latex/contrib/siunitx/siunitx-code.pdf diff --git a/macros/latex/contrib/siunitx/siunitx-code.tex b/macros/latex/contrib/siunitx/siunitx-code.tex index a0a4319e23..f392a6178f 100644 --- a/macros/latex/contrib/siunitx/siunitx-code.tex +++ b/macros/latex/contrib/siunitx/siunitx-code.tex @@ -1,6 +1,6 @@ \iffalse meta-comment -File: siunitx-code.tex Copyright (C) 2016-2023 Joseph Wright +File: siunitx-code.tex Copyright (C) 2016-2024 Joseph Wright It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -68,7 +68,7 @@ for those people who are interested. Joseph Wright% \thanks{% E-mail: - \email{joseph.wright@morningstar2.co.uk}% + \email{joseph@texdev.net}% }% } diff --git a/macros/latex/contrib/siunitx/siunitx-command.dtx b/macros/latex/contrib/siunitx/siunitx-command.dtx index a862676ade..49b513bbbd 100644 --- a/macros/latex/contrib/siunitx/siunitx-command.dtx +++ b/macros/latex/contrib/siunitx/siunitx-command.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-command.dtx Copyright (C) 2019,2021,2023 Joseph Wright +% File: siunitx-command.dtx Copyright (C) 2019,2021,2023,2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-complex.dtx b/macros/latex/contrib/siunitx/siunitx-complex.dtx index 644aa9c095..2ff86391c2 100644 --- a/macros/latex/contrib/siunitx/siunitx-complex.dtx +++ b/macros/latex/contrib/siunitx/siunitx-complex.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-complex.dtx Copyright (C) 2021-2023 Joseph Wright +% File: siunitx-complex.dtx Copyright (C) 2021-2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-compound.dtx b/macros/latex/contrib/siunitx/siunitx-compound.dtx index a6f1ccac76..ec5a680516 100644 --- a/macros/latex/contrib/siunitx/siunitx-compound.dtx +++ b/macros/latex/contrib/siunitx/siunitx-compound.dtx @@ -50,7 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-emulation.dtx b/macros/latex/contrib/siunitx/siunitx-emulation.dtx index 4d82d7b426..8909d2994f 100644 --- a/macros/latex/contrib/siunitx/siunitx-emulation.dtx +++ b/macros/latex/contrib/siunitx/siunitx-emulation.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-emulation.dtx Copyright (C) 2016-2019,2021-2023 Joseph Wright +% File: siunitx-emulation.dtx Copyright (C) 2016-2019,2021-2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -49,7 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-locale.dtx b/macros/latex/contrib/siunitx/siunitx-locale.dtx index da12029bc9..fd75128612 100644 --- a/macros/latex/contrib/siunitx/siunitx-locale.dtx +++ b/macros/latex/contrib/siunitx/siunitx-locale.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-locale.dtx Copyright (C) 2020-2023 Joseph Wright +% File: siunitx-locale.dtx Copyright (C) 2020-2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -49,7 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-number.dtx b/macros/latex/contrib/siunitx/siunitx-number.dtx index 8c94cefee4..cfa4a03e25 100644 --- a/macros/latex/contrib/siunitx/siunitx-number.dtx +++ b/macros/latex/contrib/siunitx/siunitx-number.dtx @@ -50,7 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % @@ -2703,13 +2703,12 @@ \cs_new:Npn \@@_digits_uncert_aux:nn #1#2 { \exp_not:n {#2} - \@@_digits:nn + \int_compare:nNnT + { \l_@@_min_decimal_int - \tl_count:n {#1} } > 0 { - \int_max:nn - { 0 } - { \l_@@_min_decimal_int - \tl_count:n {#1} + 1 } + \prg_replicate:nn + { \l_@@_min_decimal_int - \tl_count:n {#1} } { 0 } } - {#2} } \cs_new:Npn \@@_digits_uncert:nN #1#2 { diff --git a/macros/latex/contrib/siunitx/siunitx-print.dtx b/macros/latex/contrib/siunitx/siunitx-print.dtx index 9cc2e6aca2..7a8224c075 100644 --- a/macros/latex/contrib/siunitx/siunitx-print.dtx +++ b/macros/latex/contrib/siunitx/siunitx-print.dtx @@ -50,7 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-quantity.dtx b/macros/latex/contrib/siunitx/siunitx-quantity.dtx index b9c7e107bb..9e3c14ffaf 100644 --- a/macros/latex/contrib/siunitx/siunitx-quantity.dtx +++ b/macros/latex/contrib/siunitx/siunitx-quantity.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-quantity.dtx Copyright (C) 2018-2023 Joseph Wright +% File: siunitx-quantity.dtx Copyright (C) 2018-2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-symbol.dtx b/macros/latex/contrib/siunitx/siunitx-symbol.dtx index c5ec0c39ce..7428d39dc4 100644 --- a/macros/latex/contrib/siunitx/siunitx-symbol.dtx +++ b/macros/latex/contrib/siunitx/siunitx-symbol.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-symbol.dtx Copyright (C) 2018-2023 Joseph Wright +% File: siunitx-symbol.dtx Copyright (C) 2018-2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -49,7 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-table.dtx b/macros/latex/contrib/siunitx/siunitx-table.dtx index f900c741f8..5de8f0b603 100644 --- a/macros/latex/contrib/siunitx/siunitx-table.dtx +++ b/macros/latex/contrib/siunitx/siunitx-table.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-table.dtx Copyright (C) 2016-2019,2021-2023 Joseph Wright +% File: siunitx-table.dtx Copyright (C) 2016-2019,2021-2024 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -50,7 +50,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx-unit.dtx b/macros/latex/contrib/siunitx/siunitx-unit.dtx index 6c0210cec1..2c9c1efb13 100644 --- a/macros/latex/contrib/siunitx/siunitx-unit.dtx +++ b/macros/latex/contrib/siunitx/siunitx-unit.dtx @@ -64,7 +64,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx index bd231a50f7..0d79cd5fde 100644 --- a/macros/latex/contrib/siunitx/siunitx.dtx +++ b/macros/latex/contrib/siunitx/siunitx.dtx @@ -49,7 +49,7 @@ % Joseph Wright^^A % \thanks{^^A % E-mail: -% \email{joseph.wright@morningstar2.co.uk}^^A +% \email{joseph@texdev.net}^^A % }^^A % } % @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2024-02-15} {3.3.12} +\ProvidesExplPackage {siunitx} {2024-04-12} {3.3.13} {A comprehensive (SI) units package} % \end{macrocode} % diff --git a/macros/latex/contrib/siunitx/siunitx.ins b/macros/latex/contrib/siunitx/siunitx.ins index b2a35b2d4e..f03c6e745b 100644 --- a/macros/latex/contrib/siunitx/siunitx.ins +++ b/macros/latex/contrib/siunitx/siunitx.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File: siunitx.ins Copyright (C) 2014-2021 Joseph Wright +File: siunitx.ins Copyright (C) 2014-2021,2024 Joseph Wright It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -33,8 +33,8 @@ for those people who are interested. \preamble \endpreamble \postamble -Copyright (C) 2008-2022 by - Joseph Wright <joseph.wright@morningstar2.co.uk> +Copyright (C) 2008-2022,2024 by + Joseph Wright <joseph@texdev.net> It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf Binary files differindex 3d70a9723b..8bd9cefb62 100644 --- a/macros/latex/contrib/siunitx/siunitx.pdf +++ b/macros/latex/contrib/siunitx/siunitx.pdf diff --git a/macros/latex/contrib/siunitx/siunitx.tex b/macros/latex/contrib/siunitx/siunitx.tex index 59ecd43acd..d004e8f9d7 100644 --- a/macros/latex/contrib/siunitx/siunitx.tex +++ b/macros/latex/contrib/siunitx/siunitx.tex @@ -200,7 +200,7 @@ for those people who are interested. Joseph Wright% \thanks{% E-mail: - \email{joseph.wright@morningstar2.co.uk}% + \email{joseph@texdev.net}% }% } diff --git a/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.pdf b/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.pdf Binary files differindex 2e3d3e8a32..7bcc35aa1b 100644 --- a/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.pdf +++ b/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.pdf diff --git a/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.tex b/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.tex index 3648aa6f50..070c88b7cd 100644 --- a/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.tex +++ b/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.tex @@ -45,8 +45,8 @@ \setlength{\parindent}{0pt} \definecolor{LightGray}{gray}{0.9} -\def\TPversion{0.1.5} -\def\TPdate{15/11/2023} +\def\TPversion{0.1.6} +\def\TPdate{12/04/2024} \usepackage[most]{tcolorbox} \tcbuselibrary{minted} @@ -252,6 +252,30 @@ The package \textsf{WriteOnGrid} proposes "shortcuts" for classic colors ! {\tikz \filldraw[PapierGris] (0,0) rectangle++ (6,1) node[midway,font=\bfseries\large,text=black] {\verb+PapierGris+};} \end{PresentationCode} +\subsection{The number of squares} + +The number of grid squares (for individual grids and environments) can be given in several ways: + +\begin{itemize} + \item \Cle{NumSquares=<nbcols>x<nblines>} to specify manually; + \item \Cle{NumSquares=Auto} to fill the rest of the page (horiz. and vert.); + \item \Cle{NumSquares=Cx<nblines} to fill horizontally and specify the number of lines; + \item \Cle{NumSquares=<nbcols>xL} to fill vertically and specify the number of columns. +\end{itemize} + +Note that the calculations carried out to determine the remaining \textit{space} do not take into account any elastic springs that \LaTeX\ can add to \textit{optimize} the space. + +\smallskip + +To \textit{force} the addition of additional line(s), it is possible to use: + +\begin{itemize} + \item \Cle{NumSquares=Auto*} to force the addition of one more line; + \item \Cle{NumSquares=Auto**} to force the addition of two more lines; + \item \Cle{NumSquares=Auto***} to force the addition of three more lines; + \item etc. +\end{itemize} + \pagebreak \section{Commands, keys and options} @@ -501,6 +525,8 @@ To sum up, they create full paper grid (by preference for \texttt{\textbf{a4pape \part*{History} +\verb|v0.1.6|~:~~~~Possibility to automatically determine L\&C based on the remaining space. + \verb|v0.1.4|~:~~~~New \texttt{[keys]} + enhancements for paragraphs, for french version (for the moment\dots) \verb|v0.1.4|~:~~~~\texttt{xcolor} isn't loaded with \textsf{[table,svgnames]}) diff --git a/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-fr.pdf b/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-fr.pdf Binary files differindex c3573469d1..517ce5911d 100644 --- a/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-fr.pdf +++ b/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-fr.pdf diff --git a/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-fr.tex b/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-fr.tex index 74ac22a898..1da2b2b0bc 100644 --- a/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-fr.tex +++ b/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-fr.tex @@ -48,8 +48,8 @@ \setlength{\parindent}{0pt} \definecolor{LightGray}{gray}{0.9} -\def\TPversion{0.1.5} -\def\TPdate{15 novembre 2023} +\def\TPversion{0.1.6} +\def\TPdate{12 avril 2024} \usepackage[most]{tcolorbox} \tcbuselibrary{minted} @@ -266,7 +266,29 @@ Le package \textsf{WriteOnGrid} définit également des couleurs pour une saisie {\tikz \filldraw[PapierGris] (0,0) rectangle++ (6,1) node[midway,font=\bfseries\large,text=black] {\verb+PapierGris+};} \end{PresentationCode} +\subsection{Le nombre de carreaux} +Le nombre de carreaux de la grille (pour les quadrillages individuelles et les environnements) peuvent être donnés de plusieurs manières : + +\begin{itemize} + \item \Cle{NbCarreaux=<nbcols>x<nblignes>} pour spécifier manuellement ; + \item \Cle{NbCarreaux=Auto} pour remplir le reste de la page (horiz. et vert.) ; + \item \Cle{NbCarreaux=Cx<nblignes} pour remplir horizontalement et spécifier le nombre de lignes ; + \item \Cle{NbCarreaux=<nbcols>xL} pour remplir verticalement et spécifier le nombre de colonnes. +\end{itemize} + +À noter que les calculs effectués pour déterminer la \textit{place} restante ne tiennent pas compte des éventuels ressorts élastiques que \LaTeX\ peut rajouter pour \textit{optimiser} la place. + +\smallskip + +Pour \textit{forcer} l'ajout de ligne(s) supplémentaire(s), il est possible d'utiliser : + +\begin{itemize} + \item \Cle{NbCarreaux=Auto*} pour forcer l'ajout d'une ligne en plus ; + \item \Cle{NbCarreaux=Auto**} pour forcer l'ajout de deux lignes en plus ; + \item \Cle{NbCarreaux=Auto***} pour forcer l'ajout de trois lignes en plus ; + \item etc +\end{itemize} \pagebreak @@ -587,6 +609,14 @@ Le dernier argument, \textit{obligatoire} et entre \texttt{\{...\}} est le parag Un exemple \textit{détaillé}, avec le rendu en page suivante, avec quelques commentaires pour expliquer. \begin{PresentationCode}{listing only} +\documentclass[a4paper,11pt]{article} +\usepackage{WriteOnGrid} +\usepackage{amsmath,amssymb} +\usepackage{frcursive} +\usepackage{lipsum} + +\begin{document} + \pagestyle{empty} \begin{PleinePageSeyes}[NumLignes]%numéro de lignes pour mieux "lire" @@ -601,18 +631,16 @@ Un exemple \textit{détaillé}, avec le rendu en page suivante, avec quelques co %un paragraphe de quelques lignes \ParagraphePapierSeyes[Ligne=10]{\cursive\lipsum[1]} %un paragraphe avec des maths - \ParagraphePapierSeyes[Ligne=22] - {% + \ParagraphePapierSeyes[Ligne=22]{% On essaye avec des maths $1+\frac12=\frac32$ en mode ligne avec des lignes assez longues pour voir ce que ça peut donner\ldots Et une intégrale $\int_0^1 2x dx = 1$.\\On essaye en passant à la ligne !!! - } + } %une ligne avec des maths \LignePapierSeyes[Ligne=25]<center>{${\displaystyle\sum_{i=1}^{n} i=\displaystyle\frac{n(n+1)}{2}}$.} %un environnement, avec ajustement manuel via (x,y)... %pas fonctionnel à 100% - \LignePapierSeyes[Echelle=1.1,Ligne=27](-1.4,0.95) - { + \LignePapierSeyes[Echelle=1.1,Ligne=27](-1.4,0.95){ \begin{align*} \frac{d}{dx} \ln x &= \lim_{h\to 0} \frac{\ln(x+h) - \ln x}{h} \\ &= \ln e^{1/x} &&\text{How this follows is left as an exercise.}\\ @@ -620,9 +648,10 @@ Un exemple \textit{détaillé}, avec le rendu en page suivante, avec quelques co \end{align*} } %un paragraphe multiligne, avec police agrandie - \ParagraphePapierSeyes[Echelle=1.15,Ligne=30] - {BlablablaBlablabla.\\BlablablaBlablablaBlablablaBlablabla.} + \ParagraphePapierSeyes[Echelle=1.15,Ligne=30]{BlablablaBlablabla.\\BlablablaBlablablaBlablablaBlablabla.} \end{PleinePageSeyes} + +\end{document} \end{PresentationCode} \newpage @@ -813,6 +842,8 @@ Les exemples des pages suivantes ont été obtenus de la même manière que celu \section{Historique} +\verb|v0.1.6|~:~~~~Possibilité de déterminer automatiquement L\&C en fonction de la place restante. + \verb|v0.1.5|~:~~~~Possibilité de spécifier la réglure pour les quadrillages de type \textsf{Seyes} + meilleure gestion des paragraphes. \phantom{\texttt{v0.1.5}}~:~~~~Amélioration de la gestion des paragraphes en mode \textsf{pleine page}. diff --git a/macros/latex/contrib/writeongrid/tex/WriteOnGrid.sty b/macros/latex/contrib/writeongrid/tex/WriteOnGrid.sty index f6a9d6199e..e2673d3c58 100644 --- a/macros/latex/contrib/writeongrid/tex/WriteOnGrid.sty +++ b/macros/latex/contrib/writeongrid/tex/WriteOnGrid.sty @@ -2,7 +2,8 @@ % licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{WriteOnGrid}[2023/11/15 v0.1.5 package to write on grid lines] +\ProvidesPackage{WriteOnGrid}[2024/04/12 v0.1.6 package to write on grid lines] +% 0.1.6 Commande pour calculer le nombre de lignes à insérer en fin de page / options Auto % 0.1.5 Choix de la réglure pour le seyes (en pretest) + amélioration de la gestion des paragraphes % 0.1.4 Suppression des options de xcolor (définition manuelle des couleurs) % 0.1.3 Ajout de commandes simples pour des mini-quadrillages autonomes, sans texte @@ -20,6 +21,33 @@ %------Variables \newcounter{lgquadri}%compteur des lignes, qui sera incrémenté +%-----Calcul du nombre de lignes/colonnes +\NewDocumentCommand\GridCalcNbCols{ O{\ColAuto} m }{% + \IfStrEqCase{#2}{% + {Seyes}{\xdef#1{\fpeval{trunc((\the\linewidth)/(22.762192pt),0)}}}% + {5x5}{\xdef#1{\fpeval{trunc((\the\linewidth)/(14.22637pt),0)}}}% + {Ruled}{\xdef#1{\fpeval{trunc((\the\linewidth)/(25.607466pt),0)}}}% + }[\xdef#1{\fpeval{trunc((\the\linewidth)/(22.762192pt),0)}}]% +} + +\NewDocumentCommand\GridCalcNbLignes{ O{\LgnAuto} m }{% + \edef\measurepage{\dimexpr\pagegoal-\pagetotal\relax} + \IfStrEqCase{#2}{% + {Seyes}{\xdef#1{\fpeval{trunc((\the\measurepage)/(22.762192pt),0)}}}% + {5x5}{\xdef#1{\fpeval{trunc((\the\measurepage)/(14.22637pt),0)}}}% + {Ruled}{\xdef#1{\fpeval{trunc((\the\measurepage)/(25.607466pt),0)}}}% + }[\xdef#1{\fpeval{trunc((\the\measurepage)/(22.762192pt),0)}}]% +} + +\NewDocumentCommand\GridCalcAuto{ O{\LgnAuto} O{\ColAuto} m }{% + \edef\measurepage{\dimexpr\pagegoal-\pagetotal\relax} + \IfStrEqCase{#3}{% + {Seyes}{\xdef#1{\fpeval{trunc((\the\measurepage)/(22.762192pt),0)}}\xdef#2{\fpeval{trunc((\the\linewidth)/(22.762192pt),0)}}}% + {5x5}{\xdef#1{\fpeval{trunc((\the\measurepage)/(14.22637pt),0)}}\xdef#2{\fpeval{trunc((\the\linewidth)/(14.22637pt),0)}}}% + {Ruled}{\xdef#1{\fpeval{trunc((\the\measurepage)/(25.607466pt),0)}}\xdef#2{\fpeval{trunc((\the\linewidth)/(25.607466pt),0)}}}% + }[\xdef#1{\fpeval{trunc((\the\measurepage)/(22.762192pt),0)}}\xdef#2{\fpeval{trunc((\the\linewidth)/(22.762192pt),0)}}]% +} + %-----Couleurs utiles \definecolor{TyrianPurple}{rgb}{0.4,0.01,0.24} \definecolor{PapierRose}{HTML}{E6B8E6} @@ -78,7 +106,35 @@ \IfSubStr{#2}{/}%on récupère les couleurs {\StrCut{#2}{/}{\QuadCoulA}{\QuadCoulB}} {\def\QuadCoulA{#2}\def\QuadCoulB{#2}}% - \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% + %détermination des nb de carreaux, sans unite... ? TEST !!!!!! + \IfSubStr{\QuadNbCar}{Auto}% + {% + \GridCalcAuto[\QuadNbLig][\QuadNbCol]{\QuadType}% + \IfSubStr{\QuadNbCar}{Auto*}% + {% + \StrCount{\QuadNbCar}{*}[\tmpnbetoiles]% + \xdef\QuadNbLig{\inteval{\QuadNbLig+\tmpnbetoiles}}% + }% + {}% + }% + {% + \IfBeginWith{\QuadNbCar}{C}% + {% + \GridCalcNbCols[\QuadNbCol]{\QuadType}% + \StrBehind{\QuadNbCar}{x}[\QuadNbLig]% + }% + {% + \IfEndWith{\QuadNbCar}{L}% + {% + \GridCalcNbLignes[\QuadNbLig]{\QuadType}% + \StrBefore{\QuadNbCar}{x}[\QuadNbCol]% + }% + {% + \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% + }% + }% + }% + %suite des calculs \IfStrEq{\QuadType}{Seyes}%les types de quadrillages {\xdef\ValeurCarreau{0.8}\xdef\CoeffUnite{\fpeval{(\QuadReglureSeyes)/2}}}% {}% @@ -88,7 +144,6 @@ \IfStrEq{\QuadType}{Ruled}% {\xdef\ValeurCarreau{0.9}\xdef\CoeffUnite{1}}% {}% - \IfSubStr{\QuadElar}{/}%on récupère les élargissements G et D {\StrCut{\QuadElar}{/}{\QuadElarG}{\QuadElarD}}% {\def\QuadElarG{\QuadElar}\def\QuadElarD{\QuadElar}}% @@ -133,7 +188,35 @@ \IfSubStr{#2}{/}%on récupère les couleurs {\StrCut{#2}{/}{\QuadCoulA}{\QuadCoulB}} {\def\QuadCoulA{#2}\def\QuadCoulB{#2}}% - \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% + %détermination des nb de carreaux, sans unite... ? TEST !!!!!! + \IfSubStr{\QuadNbCar}{Auto}% + {% + \GridCalcAuto[\QuadNbLig][\QuadNbCol]{\QuadType}% + \IfSubStr{\QuadNbCar}{Auto*}% + {% + \StrCount{\QuadNbCar}{*}[\tmpnbetoiles]% + \xdef\QuadNbLig{\inteval{\QuadNbLig+\tmpnbetoiles}}% + }% + {}% + }% + {% + \IfBeginWith{\QuadNbCar}{C}% + {% + \GridCalcNbCols[\QuadNbCol]{\QuadType}% + \StrBehind{\QuadNbCar}{x}[\QuadNbLig]% + }% + {% + \IfEndWith{\QuadNbCar}{L}% + {% + \GridCalcNbLignes[\QuadNbLig]{\QuadType}% + \StrBefore{\QuadNbCar}{x}[\QuadNbCol]% + }% + {% + \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% + }% + }% + }% + %suite des calculs \IfStrEq{\QuadType}{Seyes}%les types de quadrillages {\xdef\ValeurCarreau{0.8}\xdef\CoeffUnite{\fpeval{(\QuadReglureSeyes)/2}}}% {}% @@ -204,7 +287,35 @@ \IfSubStr{#2}{/}%on récupère les couleurs {\StrCut{#2}{/}{\QuadCoulA}{\QuadCoulB}} {\def\QuadCoulA{#2}\def\QuadCoulB{#2}}% - \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% + %détermination des nb de carreaux, sans unite... ? TEST !!!!!! + \IfSubStr{\QuadNbCar}{Auto}% + {% + \GridCalcAuto[\QuadNbLig][\QuadNbCol]{\QuadType}% + \IfSubStr{\QuadNbCar}{Auto*}% + {% + \StrCount{\QuadNbCar}{*}[\tmpnbetoiles]% + \xdef\QuadNbLig{\inteval{\QuadNbLig+\tmpnbetoiles}}% + }% + {}% + }% + {% + \IfBeginWith{\QuadNbCar}{C}% + {% + \GridCalcNbCols[\QuadNbCol]{\QuadType}% + \StrBehind{\QuadNbCar}{x}[\QuadNbLig]% + }% + {% + \IfEndWith{\QuadNbCar}{L}% + {% + \GridCalcNbLignes[\QuadNbLig]{\QuadType}% + \StrBefore{\QuadNbCar}{x}[\QuadNbCol]% + }% + {% + \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% + }% + }% + }% + %suite des calculs \IfStrEq{\QuadType}{Seyes}%les types de quadrillages {\xdef\ValeurCarreau{0.8}}% {}% @@ -258,7 +369,35 @@ \IfSubStr{#2}{/}%on récupère les couleurs {\StrCut{#2}{/}{\QuadCoulA}{\QuadCoulB}} {\def\QuadCoulA{#2}\def\QuadCoulB{#2}}% - \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% + %détermination des nb de carreaux, sans unite... ? TEST !!!!!! + \IfSubStr{\QuadNbCar}{Auto}% + {% + \GridCalcAuto[\QuadNbLig][\QuadNbCol]{\QuadType}% + \IfSubStr{\QuadNbCar}{Auto*}% + {% + \StrCount{\QuadNbCar}{*}[\tmpnbetoiles]% + \xdef\QuadNbLig{\inteval{\QuadNbLig+\tmpnbetoiles}}% + }% + {}% + }% + {% + \IfBeginWith{\QuadNbCar}{C}% + {% + \GridCalcNbCols[\QuadNbCol]{\QuadType}% + \StrBehind{\QuadNbCar}{x}[\QuadNbLig]% + }% + {% + \IfEndWith{\QuadNbCar}{L}% + {% + \GridCalcNbLignes[\QuadNbLig]{\QuadType}% + \StrBefore{\QuadNbCar}{x}[\QuadNbCol]% + }% + {% + \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% + }% + }% + }% + %suite des calculs \IfStrEq{\QuadType}{Seyes}%les types de quadrillages {\xdef\ValeurCarreau{0.8}}% {}% @@ -354,7 +493,7 @@ {% \foreach \lig in {1,...,\inteval{\SeyesFullNbLignP+1}} {\node[gray,inner sep=0pt,anchor=base east] at ($(SeyesOrigine)+(-0.2,{-0.4*\SeyesFullReglureSeyes*(\lig-1)})$) {\scriptsize\sffamily\lig};} }% - {} + {}% } { \end{tikzpicture}% diff --git a/macros/latex/packages/README b/macros/latex/packages/README deleted file mode 100644 index 70f96627d1..0000000000 --- a/macros/latex/packages/README +++ /dev/null @@ -1,23 +0,0 @@ -CTAN:/macros/latex/packages - -With the 1998/12/01 release of LaTeX, the packages subdirectory of the -LaTeX distribution has been withdrawn and its contents moved. - -Subdirectories of the old packages directory are now available as -follows: - - amslatex/ now available from macros/latex/required/amslatex/ - babel/ now available from macros/latex/required/babel/ - expl3/ now available from macros/latex/exptl/project/expl3 - graphics/ now available from macros/latex/required/graphics/ - mfnfss/ now available from macros/latex/contrib/supported/mfnfss/ - psnfss/ now available from macros/latex/required/psnfss/ - tools/ now available from macros/latex/required/tools/ - -Some rationale for these changes is given in the latest issue of LaTeX -news (source in the distribution, but also available from -macros/latex/doc/ltnews10.ps) - -Robin Fairbairns - -For the CTAN team diff --git a/macros/latex/packages/index.html b/macros/latex/packages/index.html deleted file mode 100644 index fb4eda6298..0000000000 --- a/macros/latex/packages/index.html +++ /dev/null @@ -1,40 +0,0 @@ -<html> -<header> -<title>Packages directory superseded</title> -</header> -<body> -<h2>The directory <tt>CTAN:/macros/latex/packages</tt> has been superseded</h2> - -<p> -With the 1998/12/01 release of LaTeX, the packages subdirectory of the -LaTeX distribution has been withdrawn. -</p> - -<p> -Subdirectories of the old packages directory are now available as -follows: -</p> - -<dl> -<dt><tt>amslatex/</tt></dt> now available from <a href="../required/amslatex/"><tt>macros/latex/required/amslatex/</tt></a> -<dt><tt>babel/</tt></dt> now available from <a href="../required/babel/"><tt>macros/latex/required/babel/</tt></a> -<dt><tt>expl3/</tt></dt> now available from <a href="../exptl/project/expl3/"><tt>macros/latex/exptl/project/expl3/</tt></a> -<dt><tt>graphics/</tt></dt> now available from <a href="../required/graphics/"><tt>macros/latex/required/graphics/</tt></a> -<dt><tt>mfnfss/</tt></dt> now available from <a href="..//contrib/supported/mfnfss/"><tt>macros/latex/contrib/supported/mfnfss/</tt></a> -<dt><tt>psnfss/</tt></dt> now available from <a href="../required/psnfss/"><tt>macros/latex/required/psnfss/</tt></a> -<dt><tt>tools/</tt></dt> now available from <a href="../required/tools"><tt>macros/latex/required/tools/</tt></a> -</dl> - -<p> -Some rationale for these changes is given in the latest issue of LaTeX -news (source in the distribution, but also available from -<a href="../doc/ltnews10.ps">the doc directory</a>). -</p> - -<p> -Robin Fairbairns -</p><p> -For the CTAN team -</p> -</body> -</html> diff --git a/macros/luatex/generic/luamplib/NEWS b/macros/luatex/generic/luamplib/NEWS index aaa0eae0a2..905444e354 100644 --- a/macros/luatex/generic/luamplib/NEWS +++ b/macros/luatex/generic/luamplib/NEWS @@ -1,5 +1,31 @@ History of the luamplib package +2024/04/12 2.28.0 + * provide a new metapost operator 'mplibgraphictext', which is similar + to ConTeXt's 'graphictext'. But the syntax is not the same: + + mplibgraphictext "Text" fakebold 2 scale 3 + fillcolor red drawcolor blue + + where 'fakebold' and 'scale' are fontspec's font options. + 'fakebold', 'scale', 'drawcolor' and 'fillcolor' are optional and + default values are '2', '1', "black" and "white" respectively. + When color expressions are given as string, they are regarded as + xcolor's or l3color's expressions. The operator generates a metapost + picture, which can be drawn or assigned to a variable. For compatibilty + with 'graphictext', 'withdrawcolor' and 'withfillcolor' are synonyms of + 'drawcolor' and 'fillcolor'. Because the implementation is quite + different from the \ConTeXt's, there are some limitations such that + we can't apply shading (gradient colors) to the text. + + * support metafun's new shading method. Color expressions given as string + are regarded as xcolor's or l3color's expressions. Spot colors defined + by the color commands of l3color package are also acceptable + (currently '\DocumentMetadata{ }' is needed for spot colors). + + * fix the y-position of text figures, which means the result of 'infont' + operator, not of the 'textext' operator. + 2024/04/04 2.27.2 * for warning/info/error messages we now use our own lua function, instead of ltluatex's. As a result, mplib's multi-line messages are diff --git a/macros/luatex/generic/luamplib/luamplib.dtx b/macros/luatex/generic/luamplib/luamplib.dtx index 24408cd3b2..eacb425835 100644 --- a/macros/luatex/generic/luamplib/luamplib.dtx +++ b/macros/luatex/generic/luamplib/luamplib.dtx @@ -85,7 +85,7 @@ See source file '\inFileName' for licencing and contact information. %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{luamplib.drv}% - [2024/04/04 v2.27.2 Interface for using the mplib library]% + [2024/04/12 v2.28.0 Interface for using the mplib library]% \documentclass{ltxdoc} \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace} \usepackage[x11names]{xcolor} @@ -153,7 +153,7 @@ See source file '\inFileName' for licencing and contact information. % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\ % Maintainer: LuaLaTeX Maintainers --- % Support: \email{lualatex-dev@tug.org}} -% \date{2024/04/04 v2.27.2} +% \date{2024/04/12 v2.28.0} % % \maketitle % @@ -423,6 +423,27 @@ See source file '\inFileName' for licencing and contact information. % As backslashes (|\|) should be escaped by users, it would be easier to use % slashes (|/|) instead. % +% \paragraph{\texttt{mplibgraphictext}} +% For some amusement, luamplib provides its own metapost operator +% |mplibgraphictext|, the effect of which is similar to that of +% \ConTeXt's |graphictext|. However syntax is somewhat different. +% \begin{verbatim} +% mplibgraphictext "Funny" +% fakebold 2.3 scale 3 % fontspec options +% drawcolor .7blue fillcolor "red!50" % color expressions +% \end{verbatim} +% |fakebold|, |scale|, |drawcolor| and |fillcolor| are optional; +% default values are |2|, |1|, |"black"| and |"white"| respectively. +% When color expressions are given as string, they are regarded as +% xcolor's or l3color's expressions (this is the same with shading colors). +% All from |mplibgraphictext| to the end of sentence will compose an +% anonymous |picture|, which can be drawn or assigned to a variable. +% Incidentally, |withdrawcolor| and |withfillcolor| are synonyms of +% |drawcolor| and |fillcolor|, hopefully to be compatible with |graphictext|. +% \textsc{n.b.} Because luamplib's current implementation is quite different +% from the \ConTeXt's, there are some limitations such that you can't +% apply shading (gradient colors) to the text. +% % \paragraph{About figure box metrics} % Notice that, after each figure is processed, macro \cs{MPwidth} stores % the width value of latest figure; \cs{MPheight}, the height value. @@ -455,8 +476,8 @@ See source file '\inFileName' for licencing and contact information. luatexbase.provides_module { name = "luamplib", - version = "2.27.2", - date = "2024/04/04", + version = "2.28.0", + date = "2024/04/12", description = "Lua package to typeset Metapost with LuaTeX's MPLib.", } @@ -531,6 +552,7 @@ if not texruntoks then end local is_defined = token.is_defined +local get_macro = token.get_macro local mplib = require ('mplib') local kpse = require ('kpse') @@ -1062,7 +1084,7 @@ end local ccexplat = luatexbase.registernumber"luamplibcctabexplat" -local function process_color (str) +local function process_color (str, filldraw) if str then if not str:find("%b{}") then str = format("{%s}",str) @@ -1074,7 +1096,7 @@ local function process_color (str) else for _,v in ipairs(str:match"{(.+)}":explode"!") do if not v:find("^%s*%d+%s*$") then - local pp = token.get_macro(format("l__color_named_%s_prop",v)) + local pp = get_macro(format("l__color_named_%s_prop",v)) if not pp or pp == "" then myfmt = mplibcolorfmt.xcolor break @@ -1083,13 +1105,104 @@ local function process_color (str) end end end + if filldraw and filldraw ~= "shade" and myfmt == mplibcolorfmt.l3color then + return str + end run_tex_code(myfmt:format(str), ccexplat or catat11) local t = texgettoks"mplibtmptoks" + if filldraw then return t end return format('1 withprescript "MPlibOverrideColor=%s"', t) end return "" end +luamplib.outlinecolor = function (str, filldraw) + local nn = filldraw == "fill" and 'fn:=' or 'dn:=' + local cc = filldraw == "fill" and 'fc:=' or 'dc:=' + local res = process_color(str, filldraw) + if res:match"{(.+)}" == str then + return format('%s"n"; %s"%s";', nn,cc,str) + end + local tt, t = res:explode(), { } + local be = tt[1]:find"^%d" and 1 or 2 + for i=be, #tt do + if tt[i]:find"^%a" then break end + table.insert(t, tt[i]) + end + local md = #t == 1 and 'gray' or #t == 3 and 'rgb' or #t == 4 and 'cmyk' + return format('%s"nn"; %s"%s}{%s";', nn, cc, md, tableconcat(t,',')) +end + +luamplib.shadecolor = function (str) + local res = process_color(str, "shade") + if res:find" cs" then -- spot color shade: l3 only +% \end{macrocode} +% An example of spot color shading: +% \begin{verbatim} +% \DocumentMetadata{ } +% \documentclass{article} +% \usepackage{luamplib} +% \mplibsetformat{metafun} +% \ExplSyntaxOn +% \color_model_new:nnn { pantone3005 } +% { Separation } +% { name = PANTONE~3005~U , +% alternative-model = cmyk , +% alternative-values = {1, 0.56, 0, 0} +% } +% \color_set:nnn{spotA}{pantone3005}{1} +% \color_set:nnn{spotB}{pantone3005}{0.6} +% \color_model_new:nnn { pantone1215 } +% { Separation } +% { name = PANTONE~1215~U , +% alternative-model = cmyk , +% alternative-values = {0, 0.15, 0.51, 0} +% } +% \color_set:nnn{spotC}{pantone1215}{1} +% \color_model_new:nnn { pantone2040 } +% { Separation } +% { name = PANTONE~2040~U , +% alternative-model = cmyk , +% alternative-values = {0, 0.28, 0.21, 0.04} +% } +% \color_set:nnn{spotD}{pantone2040}{1} +% \ExplSyntaxOff +% \begin{document} +% \begin{mplibcode} +% beginfig(1) +% fill unitsquare xyscaled (\mpdim\textwidth,1cm) +% withshademethod "linear" +% withshadevector (0,1) +% withshadestep ( +% withshadefraction .5 +% withshadecolors ("spotB","spotC") +% ) +% withshadestep ( +% withshadefraction 1 +% withshadecolors ("spotC","spotD") +% ) +% ; +% endfig; +% \end{mplibcode} +% \end{document} +% \end{verbatim} +% \begin{macrocode} + run_tex_code({ + [[\color_export:nnN{]], str, [[}{backend}\mplib_@tempa]], + },ccexplat) + local name = get_macro'mplib_@tempa':match'{(.-)}{.+}' + local value = res:explode()[3] + return format('(%s) withprescript"mplib_spotcolor=%s:%s"', value,str,name) + end + local tt, t = res:explode(), { } + local be = tt[1]:find"^%d" and 1 or 2 + for i=be, #tt do + if tt[i]:find"^%a" then break end + table.insert(t, tt[i]) + end + return t +end + % \end{macrocode} % % for \cs{mpdim} or |mplibdimen| @@ -1217,13 +1330,13 @@ function luamplib.runscript (code) function mp.print(...) mpprint(buffer,...) end - f() + local res = {f()} buffer = tableconcat(buffer) if buffer and buffer ~= "" then return buffer end buffer = {} - mpprint(buffer, f()) + mpprint(buffer, table.unpack(res)) return tableconcat(buffer) end return "" @@ -1291,14 +1404,19 @@ if known context_mlib: (1-mfun_labxf@#-mfun_labyf@#)*llcorner p)) fi enddef; - def graphictext primary filename = - if (readfrom filename = EOF): - errmessage "Please prepare '"&filename&"' in advance with"& - " 'pstoedit -ssp -dt -f mpost yourfile.ps "&filename&"'"; + def colordecimals primary c = + if cmykcolor c: + decimal cyanpart c & ":" & decimal magentapart c & ":" & decimal yellowpart c & ":" & decimal blackpart c + elseif rgbcolor c: + decimal redpart c & ":" & decimal greenpart c & ":" & decimal bluepart c + elseif string c: + colordecimals resolvedcolor(c) + else: + decimal c fi - closefrom filename; - def data_mpy_file = filename enddef; - mfun_do_graphic_text (filename) + enddef; + def resolvedcolor(expr s) = + runscript("return luamplib.shadecolor('"& s &"')") enddef; else: vardef textext@# (text t) = rawtextext (t) enddef; @@ -1307,6 +1425,57 @@ def externalfigure primary filename = draw rawtextext("\includegraphics{"& filename &"}") enddef; def TEX = textext enddef; +def mplibgraphictext primary t = + begingroup; + mplibgraphictext_ (t) +enddef; +def mplibgraphictext_ (expr t) text rest = + save fakebold, scale, fillcolor, drawcolor, withfillcolor, withdrawcolor, + fb, sc, fc, dc, fn, dn, tpic; + picture tpic; tpic := nullpicture; + numeric fb, sc; string fc, dc, fn, dn; + fb:=2; sc:=1; fc:="white"; dc:="black"; fn:=dn:="n"; + def fakebold primary c = hide(fb:=c;) enddef; + def scale primary c = hide(sc:=c;) enddef; + def fillcolor primary c = hide( + if string c: + runscript("return luamplib.outlinecolor('"& c &"','fill')") + else: + fn:="nn"; fc:=mpliboutlinecolor_(c); + fi + ) enddef; + def drawcolor primary c = hide( + if string c: + runscript("return luamplib.outlinecolor('"& c &"','draw')") + else: + dn:="nn"; dc:=mpliboutlinecolor_(c); + fi + ) enddef; + let withfillcolor = fillcolor; let withdrawcolor = drawcolor; + addto tpic doublepath origin rest; tpic:=nullpicture; + def fakebold primary c = enddef; + def scale primary c = enddef; + def fillcolor primary c = enddef; + def drawcolor primary c = enddef; + let withfillcolor = fillcolor; let withdrawcolor = drawcolor; + image(draw rawtextext( + "{\addfontfeature{FakeBold="& decimal fb &",Scale="& decimal sc & + "}\csname color_fill:"& fn &"\endcsname{"& fc & + "}\csname color_stroke:"& dn &"\endcsname{"& dc & + "}"& t &"}") rest;) + endgroup; +enddef; +def mpliboutlinecolor_ (expr c) = + if color c: + "rgb}{" & decimal redpart c & "," & decimal greenpart c + & "," & decimal bluepart c + elseif cmykcolor c: + "cmyk}{" & decimal cyanpart c & "," & decimal magentapart c + & "," & decimal yellowpart c & "," & decimal blackpart c + else: + "gray}{" & decimal c + fi +enddef; ]] luamplib.mplibcodepreamble = mplibcodepreamble @@ -1447,13 +1616,12 @@ local further_split_keys = { sh_color_a = true, sh_color_b = true, } - local function script2table(s) local t = {} for _,i in ipairs(s:explode("\13+")) do local k,v = i:match("(.-)=(.*)") -- v may contain = or empty. - if k and v and k ~= "" then - if further_split_keys[k] then + if k and v and k ~= "" and not t[k] then + if further_split_keys[k] or further_split_keys[k:sub(1,10)] then t[k] = v:explode(":") else t[k] = v @@ -1499,7 +1667,7 @@ local function pdf_textfigure(font,size,text,width,height,depth) text = text:gsub(".",function(c) return format("\\hbox{\\char%i}",string.byte(c)) -- kerning happens in metapost end) - texsprint(format("\\mplibtextext{%s}{%f}{%s}{%s}{%f}",font,size,text,0,-( 7200/ 7227)/65536*depth)) + texsprint(format("\\mplibtextext{%s}{%f}{%s}{%s}{%f}",font,size,text,0,0)) end local bend_tolerance = 131/65536 @@ -1642,17 +1810,14 @@ end % Colors and Transparency % \begin{macrocode} local pdfmanagement = is_defined'pdfmanagement_add:nnn' - local pdf_objs = {} -local getpageres, setpageres -local pgf = { extgs = "pgf@sys@addpdfresource@extgs@plain" } +pdf_objs.pgfextgs = "pgf@sys@addpdfresource@extgs@plain" if pdfmode then - getpageres = pdf.getpageresources or function() return pdf.pageresources end - setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end + pdf_objs.getpageres = pdf.getpageresources or function() return pdf.pageresources end + pdf_objs.setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end else - texsprint("\\special{pdf:obj @MPlibTr<<>>}", - "\\special{pdf:obj @MPlibSh<<>>}") + texsprint("\\special{pdf:obj @MPlibTr<<>>}","\\special{pdf:obj @MPlibSh<<>>}") end local function update_pdfobjs (os) @@ -1685,12 +1850,14 @@ local function update_tr_res(res,mode,opaq) if new then if pdfmode then if pdfmanagement then - texsprint(ccexplat,format( - [[\pdfmanagement_add:nnn{Page/Resources/ExtGState}{MPlibTr%s}{%s 0 R}]], on,on)) + texsprint(ccexplat,{ + [[\pdfmanagement_add:nnn{Page/Resources/ExtGState}]], + format("{MPlibTr%s}{%s 0 R}", on, on), + }) else local tr = format("/MPlibTr%s %s 0 R",on,on) - if pgf.loaded then - texsprint(format("\\csname %s\\endcsname{%s}", pgf.extgs,tr)) + if pdf_objs.pgfloaded then + texsprint(format("\\csname %s\\endcsname{%s}", pdf_objs.pgfextgs,tr)) elseif is_defined"TRP@list" then texsprint(catat11,{ [[\if@filesw\immediate\write\@auxout{]], @@ -1698,7 +1865,7 @@ local function update_tr_res(res,mode,opaq) tr, [[}}\fi]], }) - if not token.get_macro"TRP@list":find(tr) then + if not get_macro"TRP@list":find(tr) then texsprint(catat11,[[\global\TRP@reruntrue]]) end else @@ -1707,12 +1874,14 @@ local function update_tr_res(res,mode,opaq) end else if pdfmanagement then - texsprint(ccexplat,format( - [[\pdfmanagement_add:nnn{Page/Resources/ExtGState}{MPlibTr%s}{@mplibpdfobj%s}]], on,on)) + texsprint(ccexplat,{ + [[\pdfmanagement_add:nnn{Page/Resources/ExtGState}]], + format("{MPlibTr%s}{@mplibpdfobj%s}", on, on), + }) else local tr = format("/MPlibTr%s @mplibpdfobj%s",on,on) - if pgf.loaded then - texsprint(format("\\csname %s\\endcsname{%s}", pgf.extgs,tr)) + if pdf_objs.pgfloaded then + texsprint(format("\\csname %s\\endcsname{%s}", pdf_objs.pgfextgs,tr)) else texsprint(format("\\special{pdf:put @MPlibTr<<%s>>}",tr)) end @@ -1723,87 +1892,123 @@ local function update_tr_res(res,mode,opaq) end local function tr_pdf_pageresources(mode,opaq) - if pgf.loaded == nil then - pgf.loaded = is_defined(pgf.extgs) + if pdf_objs.pgfloaded == nil then + pdf_objs.pgfloaded = is_defined(pdf_objs.pgfextgs) end local res, on_on, off_on = "", nil, nil res, off_on = update_tr_res(res, "Normal", 1) res, on_on = update_tr_res(res, mode, opaq) - if pdfmanagement or pgf.loaded or is_defined"TRP@list" then + if pdfmanagement or pdf_objs.pgfloaded or is_defined"TRP@list" then return on_on, off_on end if pdfmode then if res ~= "" then - local tpr, n = getpageres() or "", 0 + local tpr, n = pdf_objs.getpageres() or "", 0 tpr, n = tpr:gsub("/ExtGState<<", "%1"..res) if n == 0 then tpr = format("%s/ExtGState<<%s>>", tpr, res) end - setpageres(tpr) + pdf_objs.setpageres(tpr) end else - texsprint(format("\\special{pdf:put @resources<</ExtGState @MPlibTr>>}")) + texsprint"\\special{pdf:put @resources<</ExtGState @MPlibTr>>}" end return on_on, off_on end % \end{macrocode} % -% Shading with |metafun| format. (maybe legacy way) +% Shading with |metafun| format. % \begin{macrocode} -local shading_res - local function shading_initialize () - shading_res = {} + pdf_objs.shading_res = {} if pdfmode and luatexbase.callbacktypes.finish_pdffile then -- ltluatex local shading_obj = pdf.reserveobj() - setpageres(format("%s/Shading %i 0 R",getpageres() or "",shading_obj)) + pdf_objs.setpageres(format("%s/Shading %i 0 R",pdf_objs.getpageres() or "",shading_obj)) luatexbase.add_to_callback("finish_pdffile", function() - pdf.immediateobj(shading_obj,format("<<%s>>",tableconcat(shading_res))) - end, "luamplib.finish_pdffile") - pdf_objs.finishpdf = true + pdf.immediateobj(shading_obj,format("<<%s>>",tableconcat(pdf_objs.shading_res))) + end, "luamplib.finish_pdffile") end end -local function sh_pdfpageresources(shtype,domain,colorspace,colora,colorb,coordinates) - if not pdfmanagement and not shading_res then shading_initialize() end - local os = format("<</FunctionType 2/Domain [ %s ]/C0 [ %s ]/C1 [ %s ]/N 1>>", - domain, colora, colorb) - local funcobj = pdfmode and format("%s 0 R",update_pdfobjs(os)) - or format("@mplibpdfobj%s",update_pdfobjs(os)) - os = format("<</ShadingType %i/ColorSpace /%s/Function %s/Coords [ %s ]/Extend [ true true ]/AntiAlias true>>", - shtype, colorspace, funcobj, coordinates) - local on, new = update_pdfobjs(os) +local function sh_pdfpageresources(shtype,domain,colorspace,ca,cb,coordinates,steps,fractions) + if not pdfmanagement and not pdf_objs.shading_res then + shading_initialize() + end + local fun2fmt,os = "<</FunctionType 2/Domain [%s]/C0 [%s]/C1 [%s]/N 1>>" + if steps > 1 then + local list,bounds,encode = { },{ },{ } + for i=1,steps do + if i < steps then + bounds[i] = fractions[i] or 1 + end + encode[2*i-1] = 0 + encode[2*i] = 1 + os = fun2fmt:format(domain,tableconcat(ca[i],' '),tableconcat(cb[i],' ')) + list[i] = format(pdfmode and "%s 0 R" or "@mplibpdfobj%s",update_pdfobjs(os)) + end + os = tableconcat { + "<</FunctionType 3", + format("/Bounds [%s]", tableconcat(bounds,' ')), + format("/Encode [%s]", tableconcat(encode,' ')), + format("/Functions [%s]", tableconcat(list, ' ')), + format("/Domain [%s]>>", domain), + } + else + os = fun2fmt:format(domain,tableconcat(ca[1],' '),tableconcat(cb[1],' ')) + end + local objref = format(pdfmode and "%s 0 R" or "@mplibpdfobj%s",update_pdfobjs(os)) + os = tableconcat { + format("<</ShadingType %i", shtype), + format("/ColorSpace %s", colorspace), + format("/Function %s", objref), + format("/Coords [%s]", coordinates), + "/Extend [true true]/AntiAlias true>>", + } + local on, new + if colorspace == [[\pdffeedback lastobj 0 R]] then + on, new = pdf.reserveobj(), true + texsprint(format([[\immediate\pdfextension obj useobjnum %s{%s}]],on,os)) + else + on, new = update_pdfobjs(os) + end if pdfmode then if new then if pdfmanagement then - texsprint(ccexplat,format( - [[\pdfmanagement_add:nnn{Page/Resources/Shading}{MPlibSh%s}{%s 0 R}]], on,on)) + texsprint(ccexplat,{ + [[\pdfmanagement_add:nnn{Page/Resources/Shading}]], + format("{MPlibSh%s}{%s 0 R}", on, on), + }) else local res = format("/MPlibSh%s %s 0 R", on, on) - if pdf_objs.finishpdf then - shading_res[#shading_res+1] = res + if luatexbase.callbacktypes.finish_pdffile then + pdf_objs.shading_res[#pdf_objs.shading_res+1] = res else - local pageres = getpageres() or "" + local pageres = pdf_objs.getpageres() or "" if not pageres:find("/Shading<<.*>>") then pageres = pageres.."/Shading<<>>" end pageres = pageres:gsub("/Shading<<","%1"..res) - setpageres(pageres) + pdf_objs.setpageres(pageres) end end end else if pdfmanagement then if new then - texsprint(ccexplat,format( - [[\pdfmanagement_add:nnn{Page/Resources/Shading}{MPlibSh%s}{@mplibpdfobj%s}]], on,on)) + texsprint(ccexplat,{ + [[\pdfmanagement_add:nnn{Page/Resources/Shading}]], + format("{MPlibSh%s}{@mplibpdfobj%s}", on, on), + }) end else if new then - texsprint(format("\\special{pdf:put @MPlibSh<</MPlibSh%s @mplibpdfobj%s>>}",on,on)) + texsprint{ + "\\special{pdf:put @MPlibSh", + format("<</MPlibSh%s @mplibpdfobj%s>>}",on, on), + } end - texsprint(format("\\special{pdf:put @resources<</Shading @MPlibSh>>}")) + texsprint"\\special{pdf:put @resources<</Shading @MPlibSh>>}" end end return on @@ -1821,13 +2026,11 @@ local function color_normalize(ca,cb) end end -local prev_override_color - -local function do_preobj_color(object,prescript) % \end{macrocode} % % transparency % \begin{macrocode} +local function do_preobj_TR(prescript) local opaq = prescript and prescript.tr_transparency local tron_no, troff_no if opaq then @@ -1836,10 +2039,15 @@ local function do_preobj_color(object,prescript) tron_no, troff_no = tr_pdf_pageresources(mode,opaq) pdf_literalcode("/MPlibTr%i gs",tron_no) end + return troff_no +end + % \end{macrocode} % % color % \begin{macrocode} +local prev_override_color +local function do_preobj_CR(object,prescript) local override = prescript and prescript.MPlibOverrideColor if override then if pdfmode then @@ -1869,56 +2077,118 @@ local function do_preobj_color(object,prescript) end end end + return override +end + % \end{macrocode} % % shading % \begin{macrocode} +local function do_preobj_SH(object,prescript) + local shade_no local sh_type = prescript and prescript.sh_type if sh_type then - local domain = prescript.sh_domain - local centera = prescript.sh_center_a:explode() - local centerb = prescript.sh_center_b:explode() - for _,t in pairs({centera,centerb}) do - for i,v in ipairs(t) do - t[i] = format("%f",v) + local domain = prescript.sh_domain or "0 1" + local centera = prescript.sh_center_a or "0 0"; centera = centera:explode() + local centerb = prescript.sh_center_b or "0 0"; centerb = centerb:explode() + local transform = prescript.sh_transform == "yes" + local sx,sy,sr,dx,dy = 1,1,1,0,0 + if transform then + local first = prescript.sh_first or "0 0"; first = first:explode() + local setx = prescript.sh_set_x or "0 0"; setx = setx:explode() + local sety = prescript.sh_set_y or "0 0"; sety = sety:explode() + local x,y = tonumber(setx[1]) or 0, tonumber(sety[1]) or 0 + if x ~= 0 and y ~= 0 then + local path = object.path + local path1x = path[1].x_coord + local path1y = path[1].y_coord + local path2x = path[x].x_coord + local path2y = path[y].y_coord + local dxa = path2x - path1x + local dya = path2y - path1y + local dxb = setx[2] - first[1] + local dyb = sety[2] - first[2] + if dxa ~= 0 and dya ~= 0 and dxb ~= 0 and dyb ~= 0 then + sx = dxa / dxb ; if sx < 0 then sx = - sx end + sy = dya / dyb ; if sy < 0 then sy = - sy end + sr = math.sqrt(sx^2 + sy^2) + dx = path1x - sx*first[1] + dy = path1y - sy*first[2] + end end end - centera = tableconcat(centera," ") - centerb = tableconcat(centerb," ") - local colora = prescript.sh_color_a or {0}; - local colorb = prescript.sh_color_b or {1}; - for _,t in pairs({colora,colorb}) do - for i,v in ipairs(t) do - t[i] = format("%.3f",v) + local model, ca, cb, colorspace, steps, fractions = 0 + ca = { prescript.sh_color_a_1 or prescript.sh_color_a or {0} } + cb = { prescript.sh_color_b_1 or prescript.sh_color_b or {1} } + steps = tonumber(prescript.sh_step) or 1 + if steps > 1 then + fractions = { prescript.sh_fraction_1 or 0 } + for i=2,steps do + fractions[i] = prescript[format("sh_fraction_%i",i)] or (i/steps) + ca[i] = prescript[format("sh_color_a_%i",i)] or {0} + cb[i] = prescript[format("sh_color_b_%i",i)] or {1} end end - if #colora > #colorb then - color_normalize(colora,colorb) - elseif #colorb > #colora then - color_normalize(colorb,colora) - end - local colorspace - if #colorb == 1 then colorspace = "DeviceGray" - elseif #colorb == 3 then colorspace = "DeviceRGB" - elseif #colorb == 4 then colorspace = "DeviceCMYK" - else return troff_no,override + if prescript.mplib_spotcolor then + local names, last = { }, "" + local script = object.prescript:explode"\13+" + for i=#script,1,-1 do + if script[i]:find"mplib_spotcolor" then + local str, name = script[i]:match"mplib_spotcolor=(.-):(.+)" + if str ~= last then + names[#names+1] = name + end + last = str + end + end + texsprint(ccexplat,{ + [[\color_model_new:nnn{]], tableconcat(names), + [[}{DeviceN}{names={]], tableconcat(names,","), [[}}]] + }) + colorspace = [[\pdffeedback lastobj 0 R]] + for n,t in ipairs{ca,cb} do + for i=1,#t do + for j=1, i+n-2 do table.insert(t[i], j, 0) end + for j=i+n, #t+1 do table.insert(t[i], j, 0) end + end + end + else + for _,t in ipairs{ca,cb} do + for _,tt in ipairs(t) do + model = model > #tt and model or #tt + end + end + for _,t in ipairs{ca,cb} do + for _,tt in ipairs(t) do + if #tt < model then + color_normalize(model == 4 and {1,1,1,1} or {1,1,1},tt) + end + end + end + colorspace = model == 4 and "/DeviceCMYK" + or model == 3 and "/DeviceRGB" + or model == 1 and "/DeviceGray" + or err"unknown color model" end - colora = tableconcat(colora, " ") - colorb = tableconcat(colorb, " ") - local shade_no if sh_type == "linear" then - local coordinates = tableconcat({centera,centerb}," ") - shade_no = sh_pdfpageresources(2,domain,colorspace,colora,colorb,coordinates) + local coordinates = format("%f %f %f %f", + dx + sx*centera[1], dy + sy*centera[2], + dx + sx*centerb[1], dy + sy*centerb[2]) + shade_no = sh_pdfpageresources(2,domain,colorspace,ca,cb,coordinates,steps,fractions) elseif sh_type == "circular" then - local radiusa = format("%f",prescript.sh_radius_a) - local radiusb = format("%f",prescript.sh_radius_b) - local coordinates = tableconcat({centera,radiusa,centerb,radiusb}," ") - shade_no = sh_pdfpageresources(3,domain,colorspace,colora,colorb,coordinates) + local factor = prescript.sh_factor or 1 + local radiusa = factor * prescript.sh_radius_a + local radiusb = factor * prescript.sh_radius_b + local coordinates = format("%f %f %f %f %f %f", + dx + sx*centera[1], dy + sy*centera[2], sr*radiusa, + dx + sx*centerb[1], dy + sy*centerb[2], sr*radiusb) + shade_no = sh_pdfpageresources(3,domain,colorspace,ca,cb,coordinates,steps,fractions) + else + err"unknown shading type" end pdf_literalcode("q /Pattern cs") - return troff_no,override,shade_no end - return troff_no,override + return shade_no end local function do_postobj_color(tr,over,sh) @@ -1981,12 +2251,14 @@ local function flush(result,flusher) local objecttype = object.type % \end{macrocode} % -% The following 5 lines are part of |btex...etex| patch. +% The following 7 lines are part of |btex...etex| patch. % Again, colors are processed at this stage. % \begin{macrocode} local prescript = object.prescript prescript = prescript and script2table(prescript) -- prescript is now a table - local tr_opaq,cr_over,shade_no = do_preobj_color(object,prescript) + local tr_opaq = do_preobj_TR(prescript) + local cr_over = do_preobj_CR(object,prescript) + local shade_no = do_preobj_SH(object,prescript) if prescript and prescript.mplibtexboxid then put_tex_boxes(object,prescript) elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then --skip @@ -2208,7 +2480,7 @@ luamplib.colorconverter = colorconverter \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luamplib} - [2024/04/04 v2.27.2 mplib package for LuaTeX] + [2024/04/12 v2.28.0 mplib package for LuaTeX] \ifx\newluafunction\@undefined \input ltluatex \fi diff --git a/macros/luatex/generic/luamplib/luamplib.pdf b/macros/luatex/generic/luamplib/luamplib.pdf Binary files differindex e7580d5551..daf99fd769 100644 --- a/macros/luatex/generic/luamplib/luamplib.pdf +++ b/macros/luatex/generic/luamplib/luamplib.pdf diff --git a/macros/luatex/generic/luamplib/test-luamplib-latex.tex b/macros/luatex/generic/luamplib/test-luamplib-latex.tex index 62c416fece..339e27d838 100644 --- a/macros/luatex/generic/luamplib/test-luamplib-latex.tex +++ b/macros/luatex/generic/luamplib/test-luamplib-latex.tex @@ -1,5 +1,7 @@ \DocumentMetadata{ uncompress } \documentclass{article} +\usepackage{fontspec} +\setmainfont{latin modern roman} \usepackage{luamplib} \usepackage{xcolor} \everymplib{ beginfig(0); } @@ -166,6 +168,35 @@ diameter:\Dia bp.% rotatedlabel.top(textext("Rotated!"), origin, 45); endfig; \end{mplibcode}% +\par +\begin{mplibcode} +beginfig(1) +draw mplibgraphictext "\bfseries Funny" + fakebold 2 scale 2 % fontspec options + drawcolor "blue" fillcolor "red!50" % l3color expressions + scaled 2 rotated 30 ; +picture p; +p:=mplibgraphictext "\bfseries\itshape xyz"; +draw p scaled 3 shifted (40,0); +endfig; +\end{mplibcode}% +\mplibsetformat{metafun}% +\begin{mplibcode} +beginfig(1) +fill unitsquare xyscaled (\mpdim\textwidth,1cm) + withshademethod "linear" + withshadevector (0,1) + withshadestep ( + withshadefraction .5 + withshadecolors (red,"blue!50") + ) + withshadestep ( + withshadefraction 1 + withshadecolors ("blue!50",green) + ) + ; +endfig; +\end{mplibcode}% \tracingcommands0 \vskip 2\baselineskip |