diff options
Diffstat (limited to 'macros')
18 files changed, 1971 insertions, 199 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 14f666ba70..fcfd0a1e77 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -14,8 +14,7 @@ % This work has the LPPL maintenance status `maintained'. %<*class> \NeedsTeXFormat{LaTeX2e}[2021/11/15] -\RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2024/04/28}{2024bc} +\ProvidesExplClass{easybook}{2024/05/01}{2024be} {Easily typesetting Chinese theses or books} \bool_new:N \l__eb_compile_draft_bool @@ -47,7 +46,12 @@ unknown .code:n = \clist_gput_right:NV \g__eb_doc_options_clist \CurrentOption } -\ProcessKeysOptions{easybook} +\cs_if_exist:NTF \ProcessKeyOptions + { \ProcessKeyOptions[easybook] } + { + \RequirePackage{l3keys2e} + \ProcessKeysOptions{easybook} + } \PassOptionsToPackage{no-math,quiet,CJKmath}{xeCJK} \eb_put_ctexbook:V \g__eb_doc_options_clist \LoadClass[UTF8]{ctexbook} @@ -296,8 +300,8 @@ %</class> %<*package> \NeedsTeXFormat{LaTeX2e}[2021/11/15] -\RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2024/04/28}{2024bc} +\RequirePackage{etoolbox} +\ProvidesExplPackage{easybase}{2024/05/01}{2024be} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -421,7 +425,12 @@ \PassOptionsToPackage{list = off}{bicaption} \PassOptionsToPackage{svgnames}{xcolor} \PassOptionsToPackage{many}{tcolorbox} -\ProcessKeysOptions{easybase} +\cs_if_exist:NTF \ProcessKeyOptions + { \ProcessKeyOptions[easybase] } + { + \RequirePackage{l3keys2e} + \ProcessKeysOptions{easybase} + } \PassOptionsToPackage{\g__eb_ctex_options_clist}{ctex} \IfClassLoadedTF{ctexbook}{} { @@ -1149,14 +1158,15 @@ { \bool_if:NTF \l__eb_normal_footnote_bool { - \bool_if:NT \l__eb_fnmarktext_format_match_bool + \bool_if:NTF \l__eb_fnmarktext_format_match_bool { \tl_clear:N \l__eb_fnmarktext_format_tl } + { \spbset{spcmd = { }} } } { - \bool_if:NT \l__eb_fncustom_format_match_bool + \bool_if:NTF \l__eb_fncustom_format_match_bool { \tl_clear:N \l__eb_fnmarktext_format_tl } + { \spbset{spcmd = { }} } } - \bool_if:NF \l__eb_fnmarktext_format_match_bool { \spbset{spcmd = { }} } \eb@font@footnote } \cs_new_protected:Npn \defupfntmark #1 @@ -1727,7 +1737,7 @@ \ifbool{@filesw} { \tl_if_exist:cF { tf@#1 } - {\iow_new:c { tf@#1 }\iow_open:cn { tf@#1 } { \jobname.#1 }} + { \iow_new:c { tf@#1 }\iow_open:cn { tf@#1 } { \jobname.#1 } } } {} } @@ -2527,7 +2537,7 @@ } %</package> %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2024/04/28}{2024bc} +\ProvidesExplFile{eb-tcolorbox.cfg}{2024/05/01}{2024be} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf Binary files differindex e2270fd55d..7ba31f65c1 100644 --- a/macros/latex/contrib/easybook/easybook.pdf +++ b/macros/latex/contrib/easybook/easybook.pdf diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 20a5a1233a..7820c2a137 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -23,8 +23,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK使用手册, - version = v2024bc, - date = 2024/04/28, + version = v2024be, + date = 2024/05/01, authors = 瞿毅, info = 简便地排版中文学位论文或书籍, email = toquyi@163.com, diff --git a/macros/latex/contrib/mathgreeks/README.md b/macros/latex/contrib/mathgreeks/README.md new file mode 100644 index 0000000000..971fa77dc7 --- /dev/null +++ b/macros/latex/contrib/mathgreeks/README.md @@ -0,0 +1,30 @@ +# Math Greek letters - The mathgreeks package + + +## Presentation + +The purpose of this package is to provide access to numerous Greek letter fonts +for math mode, without altering other mathematical characters and symbols +and without loading whole extensions that provide these fonts. +Moreover, the chosen font or shape can be changed dynamically throughout the document. + + +## Installation + +- run LaTeX on mathgreeks.ins, you obtain the file mathgreeks.sty; +- if then you run LuaLaTeX on mathgreeks.dtx you get the file mathgreeks.pdf which is also in the archive; +- if you run pdfLaTex on mathgreeks.dtx you get a shorter version of this pdf file without the examples using fontspec or unicode-math; +- put the files mathgreeks.sty and mathgreeks.pdf in your TeX Directory Structure. + + +## Author + +Antoine Missier + +Email: antoine.missier@ac-toulouse.fr + + +## License + +Released under the LaTeX Project Public License v1.3 or later. +See http://www.latex-project.org/lppl.txt diff --git a/macros/latex/contrib/mathgreeks/mathgreeks.dtx b/macros/latex/contrib/mathgreeks/mathgreeks.dtx new file mode 100644 index 0000000000..5cdb03dda1 --- /dev/null +++ b/macros/latex/contrib/mathgreeks/mathgreeks.dtx @@ -0,0 +1,1309 @@ +% \iffalse meta-comment +% +% Copyright (C) 2024 by Antoine Missier <antoine.missier@ac-toulouse.fr> +% +% This file 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. +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{mathgreeks.dtx} +%</driver> +%<*package> +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{mathgreeks} + [2024/04/30 v1.0 .dtx Math Greek letters] +%</package> +%<*driver> +\documentclass[11pt]{article} +%\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[english]{babel} +\usepackage{doc} +\usepackage{geometry} +\usepackage[savegreeks,otherfonts]{mathgreeks} +\usepackage{sectsty} +\usepackage{xcolor} +\usepackage{spacingtricks} +\usepackage{metalogo} +%\usepackage{supertabular} +\usepackage{tabls} +\usepackage{multirow} +\usepackage{ifluatex} +\ifluatex + \usepackage{unicode-math} + \setmainfont{XCharter} +\else + \usepackage{charter} +\fi +\geometry{scale=0.73,vmarginratio=3:4,heightrounded} +\MakeShortVerb{"} +\definecolor{darkbrown}{rgb}{0.5,0.1,0.1} +\allsectionsfont{\color{darkbrown}} +\newcommand\bs{\textbackslash} +\DisableCrossrefs +%\CodelineIndex +%\RecordChanges +\OnlyDescription +\usepackage{hyperref} +\title{The \textsf{mathgreeks} package} +\author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}} +\date{\filedate, \fileversion} +\hypersetup{% + colorlinks, + linkcolor=blue, + citecolor=red, + pdftitle={mathgreeks}, + pdfsubject={LaTeX package}, + pdfauthor={Antoine Missier} +} + +\begin{document} +\DocInput{mathgreeks.dtx} +%\PrintChanges +%\PrintIndex +\end{document} +%</driver> +% \fi +% +% \CheckSum{1060} +% +% \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{v1.0}{2024/04/30}{Initial version} +% +% \GetFileInfo{mathgreeks.sty} +% +% \maketitle +% \tableofcontents +% +% \section{Introduction} +% +% The purpose of this package is to provide access to numerous Greek letter fonts +% for math mode, without altering other mathematical characters and symbols +% and without loading whole extensions that provide these fonts. +% +% The commands "\italpha", "\itbeta"\ldots\ produce the italic forms of the chosen font, +% and "\upalpha", "\upbeta" \ldots\ produce the upright forms. +% Style options allow choosing between italic or upright forms for the basic commands +% "\alpha", "\beta"\ldots +% Only letters whose glyph differs from the corresponding Roman letter +% will be defined this way. +% Therefore, the package does not provide a command "\omicron", +% whose letter is identical to the Roman `o', and only a few uppercase letters are defined: +% "\Gamma", "\Delta", "\Theta"\ldots +% +% \medskip +% An ISO recommendation, rarely followed, is to typeset uppercase +% Greek letters in italic shape, as for other variables~\cite{ICTNS}. +% This is automatically achieved, for some particular fonts, with packages +% such as \textsf{fixmath} by Walter Schmidt~\cite{FIXM}, +% \mbox{\textsf{isomath}} by Günter Milde~\cite{ISOM} +% or \textsf{pm-isomath} by Claudio Beccari~\cite{PMISO} and optionally with some others +% (such as \textsf{mathpazo} or \textsf{mathptmx} with the option \texttt{slantedGreek}). +% When running through \LuaLaTeX\ or \XeLaTeX\ you can also get this result +% with the option \mbox{\texttt{math-style=ISO}} provided +% by the \textsf{unicode-math} package~\cite{UNIC}. +% +% Furthermore there are several packages that provide the uppercase Greek letters +% in italic and have also options to typeset the lowercase Greek +% letters in upright shape. +% Notably, let us mention +% \mbox{\textsf{mathdesign}}~\cite{DESIGN}, +% \mbox{\textsf{kpfonts}}~\cite{KPF}, +% \mbox{\textsf{fourier}}~\cite{FOUR}, but also +% \mbox{\textsf{pxgreeks}} (using \textsf{pxfonts}~\cite{PX}), \mbox{\textsf{txgreeks}} +% (using \textsf{txfonts}~\cite{TX}), +% \mbox{\textsf{libertinust1math}}~\cite{LIB}, \mbox{\textsf{libgreek}}, etc. +% A special mention goes to \textsf{lgrmath} of Jean-François Burnol~\cite{LGR} +% which allows the use of any Greek LGR-encoded font in math mode, +% an idea taken up in \textsf{mathgreeks}. +% Also note \textsf{newtxmath}~\cite{NTX} which has several font options. +% For upright lowercase letters, we have the nice \textsf{upgreek}~\cite{GREEK} package. +% +% \medskip +% The interest of \textsf{mathgreeks} lies in being able to choose the Greek letters font +% from one of these packages or from a TrueType or OpenType font installed on your computer. +% The package sets Greek letters in the desired font and shape +% and enables to change font or shape dynamically within the document. +% +% \section{Options and settings} +% +% \subsection{Package options} +% +% When calling the package, there are three types of options: +% \begin{itemize} +% \item Font options, +% \item Shape options (the style), +% \item Additional options. +% \end{itemize} +% These options use the `\texttt{key=value}' mechanism. +% When a default value is set, the key can be used without specifying a value +% (which will then be the default value). +% Some keys represent booleans with the default value being `\texttt{true}'. +% +% \bigskip +% The first table, in two parts, presents the different keys corresponding to font options, +% the list of possible values (complete when it is reduced). +% The default value is indicated in bold, the second part consist in boolean options. +% Results are presented in section~\ref{examples}. +% +% \begin{table}[h] +% \begin{center}\ttfamily +% \begin{tabular}{ll} +% \hline +% \vstrut{2ex}\normalfont{Option} & \normalfont{Values} \\ +% \hline +% lgrmath & Alegreya-LF, Cochineal-LF, \textbf{fcm}\ldots \\ +% fontspec & FreeSerif, \textbf{GFS Didot}, Cambria\ldots \\ +% unicode-math & \textbf{Latin Modern Math}, STIX Two Math\ldots \\ +% upgreek & Euler, \textbf{Symbol}, Symbolsmallscale \\ +% mathdesign & Utopia, Garamond, \textbf{Charter} \\ +% kpfonts & \textbf{normal}, light \\ +% \hline +% \end{tabular} +% \hspace{1cm} +% \begin{tabular}{l} +% \hline +% \vstrut{2ex}\normalfont{Booleans} \\ +% \hline +% fourier \\ +% pxfonts \\ +% txfonts \\ +% libertinus \\ +% concrete \\ +% cmbright \\ +% \hline +% \end{tabular} +% \end{center} +% \caption{font options\label{table:font}} +% \end{table} +% The \texttt{fontspec} and \texttt{unicode-math} options require loading +% the corresponding packages, and these can only work when running through +% \LuaLaTeX\ (or \XeLaTeX). +% The fontspec option allows for the use of most TrueType or OpenType +% fonts installed on your computer, +% those that have Greek letters. +% +% When calling "\boldmath" (outside the math environment), you get the letters in bold face, +% but the command "\mathbf" doesn't work here. +% +% \bigskip +% The second table below presents the shape options. If the shape option +% is not specified, the italic shape is chosen by default, meaning that the commands +% "\alpha", "\beta", \ldots, "\Delta", "\Gamma"\ldots will produce the same result +% as the corresponding "\it"\meta{letter} commands. +% +% \begin{table}[h] +% \begin{center} +% \begin{tabular}{ll} +% \hline +% \vstrut{2ex}\normalfont{Option} & \normalfont{Description} \\ +% \hline +% \texttt{greekup} & lowercase letters in upright shape \\ +% \texttt{Greekup} & uppercase letters in upright shape \\ +% \texttt{TeX} & lowercase=italic, uppercase=upright \\ +% \texttt{ISO} & lowercase=italic, uppercase=italic \\ +% \texttt{upright} & lowercase=upright, uppercase=upright \\ +% \texttt{style} & possible values: \texttt{TeX}, \texttt{ISO}, \texttt{upright} \\ +% \hline +% \end{tabular} +% \end{center} +% \caption{shape options\label{table:shape}} +% \end{table} +% +% \begin{itemize} +% \item Except for \texttt{style}, all these options are booleans. +% \item The \texttt{Greekup} option est initialized to \texttt{true} (corresponding +% to the \texttt{TeX} style). +% \item The \texttt{style=ISO} option produces the same result as the simple +% \texttt{ISO} option, and the same applies to the other two styles +% (\texttt{TeX}, \texttt{upright}). +% \item To get lowercase letters in upright shape and uppercase letters in italic, +% activate \begin{center}\texttt{greekup=true,Greekup=false}.\end{center} +% \end{itemize} +% +% \smallskip +% The following list presents the additional options, which are also booleans: +% \begin{description} +% \item[\texttt{savegreeks}] Saves the letters corresponding to the original commands +% "\alpha", "\beta"\ldots so that they remain accessible through the commands +% "\backalpha", "\backbeta"\ldots +% \item[\texttt{otherfonts}] Allows dynamic font switching (see next section) +% for later use of \texttt{lgrmath}, \texttt{fourier}, \texttt{libertinus} or \texttt{upgreek}. +% \item[\texttt{lowercase}] This option is initialized to \texttt{true}; +% \texttt{lowercase=false} allows keeping the original lowercase Greek letters +% without redefining the commands "\alpha", "\beta"\ldots +% \item[\texttt{uppercase}] This option is initialized to \texttt{true}; +% \texttt{uppercase=false} allows keeping the original uppercase Greek letters +% without redefining the commands "\Gamma", "\Delta"\ldots +% \end{description} +% +% \subsection{Dynamic settings commands} +% +% There are two command for dynamic settings: +% \begin{description} +% \item[] "\setmathgreeks" +% This command takes a mandatory parameter which is a list of +% `\texttt{key=value}' settings among the shape options presented +% in table~\ref{table:shape} (the other options are not usable in this command). +% This allows modifying these settings in the body of the document, +% with a global effect, or local if the command is called in an environment +% or a group (delimited by braces). +% +% \item[] "\mathgreeksfont" +% This command allows modifying the font of Greek letters throughout the document, +% with a global or local effect. +% The possible options fall into two categories: +% \begin{center} +% \texttt{fontspec}, \texttt{unicode-math}, \\ +% \texttt{enc}, \texttt{fam}, \texttt{series}, \texttt{shape}. +% \end{center} +% The \texttt{fontspec} and \texttt{unicode-math} options are identical +% to those in table~\ref{table:font}. +% The other previous font options (\texttt{lgrmath}, \texttt{mathdesign}, etc.)\@ +% are not usable in "\mathgreeksfont". +% However, these fonts can be obtained by specifying the encoding (option \texttt{enc}), +% family (option \texttt{fam}), series and shape: the New Font Selection Scheme (NFSS). +% The series defines the `boldness' and has a default value: \texttt{series=m} (medium). +% For the shape, the default value is \texttt{shape=it}; +% \texttt{enc} and \texttt{fam} have no default value. +% For example, +% \begin{center} +% "\mathgreeksfont{enc=OML,fam=mdbch,shape=n}" +% \end{center} +% will produce upright letters from the Charter font provided by \textsf{mathdesign}. +% For each font option seen previously, +% the following examples (section~\ref{examples}) indicates +% the values to give to \texttt{enc}, \texttt{fam}, and \texttt{shape}. +% The font definition by NFSS attributes will not produce specific commands for italics +% "\it"\meta{letter} or for upright letters "\up"\meta{letter}. +% Only the commands "\alpha", "\beta"\ldots will be redefined according to the +% selected shape. +% +% If you use the \texttt{fontspec} or \texttt{unicode-math} option, +% these second kind of options have no effect. +% +% Notice that the encoding obtained by the package font options is faster, moreover +% the command "\boldmath" doesn't work anymore +% when changing the font with \texttt{enc}, \texttt{fam} and \texttt{shape}, +% but you can obtain the boldface +% letters with \texttt{series=b}, or \texttt{series=bx} (bold extended). +% +% \end{description} +% +% \section{Examples} \label{examples} +% \begin{description} +% \item[] "\greektable" +% The examples in this section are obtained with the "\greektable" command. +% This command generates a table with two rows: the first contains the lowercase letters +% obtained with "\alpha", \ldots, "\omega", and the second contains variants +% "\varepsilon", "\vartheta"\ldots of certain letters as well as the uppercase letters +% obtained with "\Gamma", "\Delta", \ldots, "\Omega" +% (for those who differ from their Latin equivalent). +% \end{description} +% +% \subsection{PostScript font options} +% +% The \texttt{upgreek} option, as its name suggests, produces only upright letters, +% and the \texttt{Euler} font does not have the variants "\varrho" and "\varsigma". +% The \texttt{Symbolsmallscale} font is identical to Symbol but reduced in size by 90\,\%. +% \texttt{mathdesign=Garamond} yields a virtual font +% that may not always work. +% +% \newlength\legendwidth +% \setlength\legendwidth{3.2cm} +% \newcommand*\doublerows[1]{\multirow{2}{\legendwidth}[-1.5ex]{\bfseries#1}} + +% \begin{center} +% \begin{tabular}{|l|@{}c@{}|c@{$\;$}c@{}c|} +% \hline +% \makebox[\legendwidth][l]{\textbf{upgreek=...}} & \makebox[8.4cm]{Résult} +% & \makebox[1cm]{enc} & \makebox[1cm]{fam} & shape \\ +% \hline +% \textbf{Symbol} +% & \mathgreeksfont{enc=U,fam=psy,shape=n}\greektable +% & U & psy & n \\ +% \hline +% \textbf{Symbolsmallscale} +% & \mathgreeksfont{enc=U,fam=fsy,shape=n} \greektable +% & U & fsy & n \\ +% \hline +% \textbf{Euler} +% & \mathgreeksfont{enc=U,fam=eur,shape=n} \greektable +% & U & eur & n \\ +% \hline +% \end{tabular} +% \end{center} +% +% \begin{center} +% \begin{tabular}{|l|@{}c@{}|c@{$\;$}c@{}c|} +% \hline +% \textbf{mathdesign=...} & \makebox[8.4cm]{Résult} & enc & fam & shape \\ +% \hline +% \doublerows{Utopia} +% & \mathgreeksfont{enc=OML,fam=mdput} \greektable +% & OML & mdput & it \\ +% & \mathgreeksfont{enc=OML,fam=mdput,shape=n} \greektable +% & OML & mdput & n \\ +% \hline +% \doublerows{Garamond} +% & \mathgreeksfont{enc=OML,fam=mdugm} \greektable +% & OML & mdugm & it \\ +% & \mathgreeksfont{enc=OML,fam=mdugm,shape=n} \greektable +% & OML & mdugm & n \\ +% \hline +% \doublerows{Charter} +% & \mathgreeksfont{enc=OML,fam=mdbch} \greektable +% & OML & mdbch & it \\ +% & \mathgreeksfont{enc=OML,fam=mdbch,shape=n} \greektable +% & OML & mdbch & n \\ +% \hline +% \end{tabular} +% \end{center} +% +% \begin{center} +% \begin{tabular}{|l|@{}c@{}|c@{$\;$}c@{}c|} +% \hline +% \textbf{kpfonts=...} & \makebox[8.4cm]{Résult} & enc & fam & shape \\ +% \hline +% \doublerows{normal} +% & \mathgreeksfont{enc=OML,fam=jkp} \greektable +% & OML & jkp & it \\ +% & \mathgreeksfont{enc=U,fam=jkpmia} \greektable +% & U & jkpmia & it \\ +% \hline +% \doublerows{light} +% & \mathgreeksfont{enc=OML,fam=jkpl} \greektable +% & OML & jkpl & it \\ +% & \mathgreeksfont{enc=U,fam=jkplmia} \greektable +% & U & jkplmia & it \\ +% \hline +% \end{tabular} +% \end{center} +% +% \begin{center} +% \begin{tabular}{|l|@{}c@{}|c@{$\;$}c@{}c|} +% \hline +% Boolean options & \makebox[8.2cm]{Résult} & enc & fam & shape \\ +% \hline +% \doublerows{fourier} +% & \mathgreeksfont{enc=FML,fam=futmi} \greektable +% & FML & futmi & it \\ +% & \mathgreeksfont{enc=FML,fam=futm} \greektable +% & FML & futm & it \\ +% \hline +% % \doublerows{pxfonts} +% & \mathgreeksfont{enc=OML,fam=pxmi} \greektable +% & OML & pxmi & it \\ +% & \mathgreeksfont{enc=U,fam=pxmia} \greektable +% & U & pxmia & it \\ +% \hline +% \doublerows{txfonts} +% & \mathgreeksfont{enc=OML,fam=txmi} \greektable +% & OML & txmi & it \\ +% & \mathgreeksfont{enc=U,fam=txmia} \greektable +% & U & txmia & it \\ +% \hline +% \doublerows{libertinus} +% & \mathgreeksfont{enc=LS1,fam=libertinust1math} \greektable +% & LS1 & * & it \\ +% & \mathgreeksfont{enc=LS1,fam=libertinust1math,shape=n} \greektable +% & LS1 & * & n \\ +% \hline +% \textbf{concrete} +% & \mathgreeksfont{enc=OML,fam=ccm} \greektable +% & OML & ccl & it \\ +% \hline +% \textbf{cmbright} +% & \mathgreeksfont{enc=OML,fam=cmbrm} \greektable +% & OML & cmbrm & it \\ +% \hline +% \end{tabular} +% \end{center} +% \emph{* The asterisk for the} \texttt{libertinus} \emph{value corresponds to the} +% \texttt{libertinust1math} \emph{family, a name too long to appear in this table.} +% +% \subsection{The \texttt{lgrmath} option} +% +% The \texttt{lgrmath} option, inspired by the eponymous package developed by J.F. Burnol, +% has a large number of possible values. We present here only a few. +% The documentation of the \textsf{lgrmath} package~\cite{LGR} explains how +% to list and consult the fonts available on your distribution with the LGR encoding. +% One can also consult with profit the documentation of \textsf{cb-fonts}\cite{CB}, +% the Greek fonts of Claudio Beccari. +% +% With the \texttt{lgrmath} option, the alternative commands for the variants +% produce the same glyphs as those of the normal letters except for "\varsigma". +% +% We have not presented here the third column previously indicating the values for +% \texttt{enc}, \texttt{fam}, and \texttt{shape} because, for this entire section, +% we have \texttt{enc=LGR}, \texttt{fam=\meta{font-name}}, the name of the font presented, +% and \texttt{shape=it}, for the italic shape, or \texttt{shape=n}, for the upright shape. +% Example: +% \begin{center} +% "\mathgreeksfont{enc=LGR,fam=Alegreya-LF,shape=n}" +% \end{center} +% +%\setlength\legendwidth{4cm} +% \newcommand\lgrtbl[1]{% +% \doublerows{#1} +% & \mathgreeksfont{enc=LGR,fam=#1} \greektable \\ +% & \mathgreeksfont{enc=LGR,fam=#1,shape=n} \greektable \\ +% \hline +% } +% +% \begin{center} +% \begin{tabular}{|l|c|} +% \hline +% \textbf{lgrmath=...} & Résult \\ +% \hline +% \lgrtbl{Alegreya-LF} +% \lgrtbl{Cochineal-LF} +% \lgrtbl{LibertinusSans-LF} +% \lgrtbl{NotoSerif-LF} +% \lgrtbl{NotoSans-LF} +% \lgrtbl{droidserif} +% \lgrtbl{fcm} +% \lgrtbl{gentium} +% \lgrtbl{llcmss} +% \end{tabular} +% \end{center} +% +% \ifluatex +% \subsection{The \texttt{fontspec} option} +% +% Most TrueType or OpenType fonts can be used here. +% ^^A Needs the \textsf{fontspec} package and must be run through \LuaLaTeX\ or \XeLaTeX. +% Some of the fonts below are not free, and some do not have the variants +% "\varepsilon"\ldots for example Arial, Times New Roman. +% +% \newcommand\fontspectbl[2][fontspec]{% +% \doublerows{#2} +% & \mathgreeksfont{#1=#2} +% \setmathgreeks{style=ISO} \greektable \\ +% & \mathgreeksfont{fontspec=#2} +% \setmathgreeks{style=upright} \greektable \\ +% \hline +% } +% +% \begin{center} +% \begin{tabular}{|l|c|} +% \hline +% \textbf{fontspec=...} & Résult \\ +% \hline +% \fontspectbl{DejaVu Serif} +% \fontspectbl{DejaVu Sans} +% \fontspectbl{FreeSerif} +% \fontspectbl{FreeSans} +% \fontspectbl{GFS Artemisia} +% \fontspectbl{GFS Didot} +% \fontspectbl{Liberation Serif} +% \fontspectbl{Liberation Sans} +% \end{tabular} +% \end{center} +% +% \begin{center} +% \begin{tabular}{|l|c|} +% \hline +% \textbf{fontspec=...} & Résult \\ +% \hline +% \fontspectbl{Linux Libertine O} +% ^^A\fontspectbl{Linux Biolinum O} +% \fontspectbl{Arial} +% \fontspectbl{Cambria} +% \fontspectbl{Palatino Linotype} +% \fontspectbl{Times New Roman} +% \end{tabular} +% \end{center} +% +% +% \subsection{The \texttt{unicode-math} option} +% +% \begin{center} +% \begin{tabular}{|l|c|} +% \hline +% \textbf{unicode-math=...} & Résult \\ +% \hline +% \fontspectbl[unicode-math]{Latin Modern Math} +% \fontspectbl[unicode-math]{STIX Two Math} +% \fontspectbl[unicode-math]{Fira Math} +% \end{tabular} +% \end{center} +% +% \else +% \typeout{This is a short version of the documentation. +% Use LuaLaTeX to get the complete version} +% \fi +% +% \StopEventually{ +% \begin{thebibliography}{20} +% \begin{raggedright} +% \bibitem{ICTNS} \emph{On the Use of Italic and up Fonts for Symbols in Scientific Text}, +% I.M.~Mills and W.V.~Metanomski, ICTNS (Interdivisional Committee +% on Terminology, Nomenclature and Symbols), dec 1999, +% \url{https://old.iupac.org/standing/idcns/italic-roman_dec99.pdf}. +% \bibitem{UNIC} \emph{Experimental Unicode mathematical typesetting: +% The \textsf{unicode-math} package}, Will Robertson, Philipp Stephani, Joseph Wright, +% Khaled Hosny, and others, CTAN, v0.8r 2023/08/13. +% \bibitem{FSPEC} \emph{The \textsf{fontspec} package -- Font selection for \XeLaTeX\ +% and \LuaLaTeX}, Will Robertson, CTAN, v2.9b 2024/04/27. +% \bibitem{FIXM} \emph{The \textsf{fixmath} package for \LaTeXe}, Walter Schmidt, +% CTAN, v0.9 2000/04/11. +% \bibitem{ISOM} \emph{\textsf{isomath} -- Mathematical style for science and technology}, +% Günter Milde, CTAN, v0.6.1 2012/09/04. +% \bibitem{PMISO} \emph{\textsf{PM-ISOmath}, The Poor Man ISO math bundle}, +% the \textsf{pm-isomath} package by Claudio Beccari, CTAN, v1.2.00 2021/08/04. +% \bibitem{GREEK} \emph{The \textsf{upgreek} package for \LaTeXe}, Walter Schmidt, +% CTAN, v2.0 2003/02/12. +% \bibitem{DESIGN} \emph{The \textsf{mathdesign} package}, +% Paul Pichaureau, CTAN, v2.31 2013/08/29. +% \bibitem{KPF} \emph{\textsf{Kp-Fonts} -- The Johannes Kepler project}, +% Christophe Caignaert, CTAN, v3.34 20/09/2022. +% \bibitem{FOUR} \textsf{Fourier-GUT\hspace{-0.1em}\emph{enberg}}, +% Michel Bovani, CTAN, v1.3 2005/01/30. +% \bibitem{PX} \emph{\textsf{PX Fonts} -- Palatino-like fonts in support of mathematics}, +% Young Ryu, CTAN, 2000/12/14. +% \bibitem{TX} \emph{\textsf{TX Fonts} -- Times-like fonts in support of mathematics}, +% Young Ryu, CTAN, 2000/12/15. +% \bibitem{CB} \emph{The CB Greek fonts}, Claudio Beccari, CTAN, 2008/01/01. +% \bibitem{PXG} \emph{The \textsf{pxgreeks} package}, Jean-François Burnol, +% CTAN v1.0 2011/03/16. +% \bibitem{TXG} \emph{The \textsf{txgreeks} package}, Jean-François Burnol, +% CTAN v1.0 2011/03/16. +% \bibitem{LIBG} \emph{The \textsf{libgreek} package}, Jean-François Burnol, +% CTAN v1.1 2022/11/11. +% \bibitem{LGR} \emph{The \textsf{lgrmath} package}, Jean-François B., CTAN, v1.0 2022/11/16. +% \bibitem{NTX} \emph{New TX font package}, Micahel Sharpe, CTAN, v1.735 2024/03/01. +% \bibitem{LIB} \emph{The LibertinusT1 Math Package}, Michael Sharpe, CTAN, +% v2.0.4 2024/01/14. +% \bibitem{CHEM} \emph{\textsf{chemgreek} -- Upright Greek letters in chemistry}, +% Clemens Niederberger, CTAN, v1.1a 2020/01/16. +% \end{raggedright} +% \end{thebibliography} +%} +% +% \section{Implementation} +% +% \begin{macrocode} +\RequirePackage{kvoptions} +%\SetupKeyvalOptions{family=mgr} % mathgreeks by default + +\DeclareStringOption{lgrmath}[fcm] +\newif\ifmathgreeks@lgrmath +\AddToKeyvalOption*{lgrmath}{\mathgreeks@lgrmathtrue} +\DeclareStringOption{fontspec}[GFS Didot] +\newif\ifmathgreeks@fontspec +\AddToKeyvalOption*{fontspec}{\mathgreeks@fontspectrue} +\newif\ifmathgreeks@unicodemath +\define@key{mathgreeks}{unicode-math}[Latin Modern Math]{ + \newcommand*{\mathgreeks@unicodemath}{#1} + \mathgreeks@unicodemathtrue} +\DeclareStringOption{upgreek}[Symbol] +\newif\ifmathgreeks@upgreek +\AddToKeyvalOption*{upgreek}{\mathgreeks@upgreektrue + \mathgreeks@Greekuptrue\mathgreeks@greekuptrue} +\DeclareStringOption{mathdesign}[Charter] +\newif\ifmathgreeks@mathdesign +\AddToKeyvalOption*{mathdesign}{\mathgreeks@mathdesigntrue} +\DeclareBoolOption{fourier}% false by default +\DeclareStringOption{kpfonts}[normal] +\newif\ifmathgreeks@kpfonts +\AddToKeyvalOption*{kpfonts}{\mathgreeks@kpfontstrue} +\DeclareBoolOption{pxfonts} +\DeclareBoolOption{txfonts} +\DeclareBoolOption{libertinus} +\DeclareBoolOption{concrete} +\DeclareBoolOption{cmbright} + +\DeclareBoolOption{savegreeks} +\DeclareBoolOption{otherfonts} +\DeclareBoolOption[true]{lowercase} +\DeclareBoolOption[true]{uppercase} + +% dynamic options +\DeclareBoolOption[true]{Greekup} +\DeclareBoolOption{greekup} +\DeclareBoolOption{upright} +\AddToKeyvalOption*{upright}{\mathgreeks@Greekuptrue + \mathgreeks@greekuptrue} +\DeclareBoolOption{ISO} +\AddToKeyvalOption*{ISO}{\mathgreeks@Greekupfalse + \mathgreeks@greekupfalse} +\DeclareBoolOption{TeX} +\AddToKeyvalOption*{TeX}{\mathgreeks@Greekuptrue + \mathgreeks@greekupfalse} +\DeclareStringOption{style} +\AddToKeyvalOption*{style}{\setkeys{mathgreeks}{\mathgreeks@style}} + +\DeclareDefaultOption{\PackageError{mathgreeks}{% + Option key `\CurrentOptionKey' undefined}{}} +\ProcessLocalKeyvalOptions* % \setkeys is done here + +\RequirePackage{etoolbox} % provides \AtEndPreamble + +\newif\ifkp@upRm % from kpgonts, bugs if after \ifmathgreeks@kpfonts +\newif\iflibus@sansmath % from libertinust1math +\newif\ifmathgreeks@Symbol % for codes definition +\newif\ifmathgreeks@itgreek % for fonts without upright shape +\newif\ifmathgreeks@font % if font option at package call +\mathgreeks@fonttrue + + +%%%%%%%%%%%%%%%% INITIAL SETTINGS %%%%%%%%%%%%%%% + +\ifmathgreeks@otherfonts + \DeclareFontEncoding{LGR}{}{} + \DeclareFontEncoding{FML}{}{} + \DeclareFontSubstitution{FML}{futm}{m}{it} + \DeclareFontEncoding{LS1}{}{} + \DeclareFontSubstitution{LS1}{libertinust1math}{m}{n} + + % from the upgreek package + \DeclareFontFamily{U}{eur}{\skewchar\font'177} + \DeclareFontShape{U}{eur}{m}{n}{% + <-6> eurm5 <6-8> eurm7 <8-> eurm10}{} + \DeclareFontShape{U}{eur}{b}{n}{% + <-6> eurb5 <6-8> eurb7 <8-> eurb10}{} + \DeclareFontFamily{U}{fsy}{} + \DeclareFontShape{U}{fsy}{m}{n}{<->s*[.9]psyr}{} + +\fi + +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{lgrmath} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{fontspec} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{unicodemath} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{upgreek} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{mathdesign} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{fourier} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{kpfonts} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{pxfonts} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{txfonts} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{savegreeks} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{otherfonts} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{lowercase} +\DisableKeyvalOption[action=warning,package=mathgreeks]{mathgreeks}{uppercase} + + +\AtEndPreamble{\AtBeginDocument{ + \@ifundefined{text}{\RequirePackage{amstext}}{} + + \ifmathgreeks@lgrmath + \DeclareFontEncoding{LGR}{}{} + \DeclareSymbolFont{mgr@it}{LGR}{\mathgreeks@lgrmath}{m}{it} + \SetSymbolFont{mgr@it}{bold}{LGR}{\mathgreeks@lgrmath}{b}{it} + \DeclareSymbolFont{mgr@up}{LGR}{\mathgreeks@lgrmath}{m}{n} + \SetSymbolFont{mgr@up}{bold}{LGR}{\mathgreeks@lgrmath}{b}{n} + + \else\ifmathgreeks@fontspec + \@ifpackageloaded{fontspec}{}{ + \PackageError{mathgreeks}{`fontspec' or `unicodemath' + options need the fontspec package\MessageBreak + which must be run with LuaLaTeX or XeLaTeX}{} + } + \newfontfamily\MathGreeksFont{\mathgreeks@fontspec}% + [NFSSFamily=mgru] + \DeclareSymbolFont{mgr@it}{TU}{mgru}{m}{it} + \SetSymbolFont{mgr@it}{bold}{TU}{mgru}{b}{it} + \DeclareSymbolFont{mgr@up}{TU}{mgru}{m}{n} + \SetSymbolFont{mgr@it}{bold}{TU}{mgru}{b}{n} + + \else\ifmathgreeks@unicodemath + \@ifpackageloaded{unicode-math}{}{ + \PackageError{mathgreeks}{`unicodemath' option needs + the unicode-math package\MessageBreak + which must be run with LuaLaTeX or XeLaTeX}{} + } + \setmathfont{\mathgreeks@unicodemath}[range=it/{greek,Greek}] + \setmathfont{\mathgreeks@unicodemath}[range=up/{greek,Greek}] + \mathgreeks@fontspectrue % for \mgr@CodeGreeks + \let\mgr@UnicodeGreek\mgr@UnicodemathGreek + + \else\ifmathgreeks@upgreek + \ifdefstring{\mathgreeks@upgreek}{Euler}{ + \DeclareFontFamily{U}{eur}{\skewchar\font'177} + \DeclareFontShape{U}{eur}{m}{n}{% + <-6> eurm5 <6-8> eurm7 <8-> eurm10}{} + \DeclareFontShape{U}{eur}{b}{n}{% + <-6> eurb5 <6-8> eurb7 <8-> eurb10}{} + \DeclareSymbolFont{mgr@up}{U}{eur}{m}{n} + \SetSymbolFont{mgr@up}{bold}{U}{eur}{b}{n} + }{ + \ifdefstring{\mathgreeks@upgreek}{Symbol}{ + \DeclareSymbolFont{mgr@up}{U}{psy}{m}{n} % no bold face + \mathgreeks@Symboltrue + }{ + \ifdefstring{\mathgreeks@upgreek}{Symbolsmallscale}{ + \DeclareFontFamily{U}{fsy}{} + \DeclareFontShape{U}{fsy}{m}{n}{<->s*[.9]psyr}{} + \DeclareSymbolFont{mgr@up}{U}{fsy}{m}{n} + \mathgreeks@Symboltrue + }{ + \PackageError{mathgreeks}{Invalid value + `\mathgreeks@upgreek' with `upgreek' key}{With `upgreek' + possible values are: Euler, Symbol, Symbolsmallscale.} + }}} + + \else\ifmathgreeks@mathdesign + \ifdefstring{\mathgreeks@mathdesign}{Utopia}{ + \DeclareSymbolFont{mgr@it}{OML}{mdput}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{mdput}{b}{it} + \DeclareSymbolFont{mgr@up}{OML}{mdput}{m}{n} + \SetSymbolFont{mgr@up}{bold}{OML}{mdput}{b}{n} + }{ + \ifdefstring{\mathgreeks@mathdesign}{Garamond}{ + \DeclareSymbolFont{mgr@it}{OML}{mdugm}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{mdugm}{b}{it} + \DeclareSymbolFont{mgr@up}{OML}{mdugm}{m}{n} + \SetSymbolFont{mgr@up}{bold}{OML}{mdugm}{b}{n} + }{ + \ifdefstring{\mathgreeks@mathdesign}{Charter}{ + \DeclareSymbolFont{mgr@it}{OML}{mdbch}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{mdbch}{b}{it} + \DeclareSymbolFont{mgr@up}{OML}{mdbch}{m}{n} + \SetSymbolFont{mgr@up}{bold}{OML}{mdbch}{b}{n} + }{ + \PackageError{mathgreeks}{Invalid value + `\mathgreeks@mathdesign' with `mathdesign' key}{With + `mathdesign' possible values are: + Utopia, Garamond, Charter.} + }}} + + \else\ifmathgreeks@fourier + \DeclareFontEncoding{FML}{}{} + \DeclareFontSubstitution{FML}{futm}{m}{it} + \DeclareSymbolFont{mgr@it}{FML}{futmi}{m}{it} + \SetSymbolFont{mgr@it}{bold}{FML}{futmi}{b}{it} + \DeclareSymbolFont{mgr@up}{FML}{futm}{m}{it} + \SetSymbolFont{mgr@up}{bold}{FML}{futm}{b}{it} + + \else\ifmathgreeks@kpfonts + \ifdefstring{\mathgreeks@kpfonts}{normal}{ + \DeclareSymbolFont{mgr@it}{OML}{jkp}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{jkp}{bx}{it} + \DeclareSymbolFont{mgr@up}{U}{jkpmia}{m}{it} + \SetSymbolFont{mgr@up}{bold}{U}{jkpmia}{bx}{it} + }{ + \ifdefstring{\mathgreeks@kpfonts}{light}{ + \DeclareSymbolFont{mgr@it}{OML}{jkpl}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{jkpl}{bx}{it} + \DeclareSymbolFont{mgr@up}{U}{jkplmia}{m}{it} + \SetSymbolFont{mgr@up}{bold}{U}{jkplmia}{bx}{it} + }{ + \PackageError{mathgreeks}{Invalid value + `\mathgreeks@kpfonts' with `kpfonts' key}{With + `kpfonts' possible values are: normal, light.} + }} + + \else\ifmathgreeks@pxfonts % no font option specified + \DeclareSymbolFont{mgr@it}{OML}{pxmi}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{pxmi}{bx}{it} + \DeclareSymbolFont{mgr@up}{U}{pxmia}{m}{it} + \SetSymbolFont{mgr@up}{bold}{U}{pxmia}{bx}{it} + + \else\ifmathgreeks@txfonts + \DeclareSymbolFont{mgr@it}{OML}{txmi}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{txmi}{bx}{it} + \DeclareSymbolFont{mgr@up}{U}{txmia}{m}{it} + \SetSymbolFont{mgr@up}{bold}{U}{txmia}{bx}{it} + + \else\ifmathgreeks@libertinus + \DeclareFontEncoding{LS1}{}{} + \DeclareFontSubstitution{LS1}{libertinust1math}{m}{n} + \DeclareSymbolFont{mgr@it}{LS1}{libertinust1math}{m}{it} + \SetSymbolFont{mgr@it}{bold}{LS1}{libertinust1math}{m}{it} + \DeclareSymbolFont{mgr@up}{LS1}{libertinust1math}{m}{n} + \SetSymbolFont{mgr@up}{bold}{LS1}{libertinust1math}{m}{n} + + \else\ifmathgreeks@concrete + \DeclareSymbolFont{mgr@it}{OML}{ccm}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{ccm}{b}{it} + \mathgreeks@itgreektrue + + \else\ifmathgreeks@cmbright + \DeclareSymbolFont{mgr@it}{OML}{cmbrm}{m}{it} + \SetSymbolFont{mgr@it}{bold}{OML}{cmbrm}{b}{it} + \mathgreeks@itgreektrue + + \else + \PackageWarningNoLine{mathgreeks}{No font option specified} + \mathgreeks@fontfalse + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + + \ifmathgreeks@savegreeks \SaveGreeks \fi + + \ifmathgreeks@font + \ifmathgreeks@upgreek + \mathgreeks@Greekuptrue \mathgreeks@greekuptrue + \PackageWarningNoLine{mathgreeks}{Commands \string \italpha, + \string\itbeta... \MessageBreak + not available with the `upgreek' option} + \else + \mgr@CodeGreeks{it} + \fi + \ifmathgreeks@itgreek + \mathgreeks@Greekupfalse \mathgreeks@greekupfalse + \PackageWarningNoLine{mathgreeks}{Commands \string \upalpha, + \string\upbeta... \MessageBreak + not available with `concrete' or 'cmbright} + \else + \mgr@CodeGreeks{up} + \fi + \mgr@DefaultGreeks + \fi +}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%% MACROS %%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\setmathgreeks#1{\setkeys{mathgreeks}{#1}\unskip + \ifmathgreeks@upgreek + \mathgreeks@Greekuptrue + \mathgreeks@greekuptrue + \PackageWarning{mathgreeks}{Style is set to `upright' + \MessageBreak with the `upgreek' option} + \fi + \mgr@DefaultGreeks\ignorespaces +} + + +\def\re@DeclareMathSymbol#1#2#3#4{% from kpfonts, pxfonts, txfonts + \let#1=\undefined + \DeclareMathSymbol{#1}{#2}{#3}{#4}} + +%\def\re@DeclareMathSymbol#1#2#3#4{% from newtxmath +%\if\relax\noexpand#1\let#1=\undefined \fi +%\DeclareMathSymbol{#1}{#2}{#3}{#4}} + +\newcommand{\mgr@CodeGreek}[3]{% #1 = it or up + \expandafter\re@DeclareMathSymbol\csname#1#2\endcsname% + {\mathalpha}{mgr@#1}{#3} +} + +\newcommand{\mgr@UnicodeGreek}[3]{% + \expandafter\Umathchardef\csname#1#2\endcsname="7 % mathalpha + \csname symmgr@#1\endcsname #3 +} + +\def\mgr@UnicodemathGreek#1#2#3{\unskip + \expandafter\DeclareRobustCommand\csname#1#2\endcsname + {\csname sym#1\endcsname{\symbol{#3}}}\ignorespaces +} + +\newcommand{\mgr@CodeGreeks}[1]{% #1 = it or up + \ifmathgreeks@lgrmath % LGR encoding + \mgr@CodeGreek{#1}{Gamma}{71} + \mgr@CodeGreek{#1}{Delta}{68} + \mgr@CodeGreek{#1}{Theta}{74} + \mgr@CodeGreek{#1}{Lambda}{76} + \mgr@CodeGreek{#1}{Xi}{88} + \mgr@CodeGreek{#1}{Pi}{80} + \mgr@CodeGreek{#1}{Sigma}{83} + \mgr@CodeGreek{#1}{Upsilon}{85} + \mgr@CodeGreek{#1}{Phi}{70} + \mgr@CodeGreek{#1}{Psi}{89} + \mgr@CodeGreek{#1}{Omega}{87} + \mgr@CodeGreek{#1}{alpha}{97} + \mgr@CodeGreek{#1}{beta}{98} + \mgr@CodeGreek{#1}{gamma}{103} + \mgr@CodeGreek{#1}{delta}{100} + \mgr@CodeGreek{#1}{epsilon}{101} + \mgr@CodeGreek{#1}{zeta}{122} + \mgr@CodeGreek{#1}{eta}{104} + \mgr@CodeGreek{#1}{theta}{106} + \mgr@CodeGreek{#1}{iota}{105} + \mgr@CodeGreek{#1}{kappa}{107} + \mgr@CodeGreek{#1}{lambda}{108} + \mgr@CodeGreek{#1}{mu}{109} + \mgr@CodeGreek{#1}{nu}{110} + \mgr@CodeGreek{#1}{xi}{120} + \mgr@CodeGreek{#1}{pi}{112} + \mgr@CodeGreek{#1}{rho}{114} + \mgr@CodeGreek{#1}{sigma}{115} + \mgr@CodeGreek{#1}{tau}{116} + \mgr@CodeGreek{#1}{upsilon}{117} + \mgr@CodeGreek{#1}{phi}{102} + \mgr@CodeGreek{#1}{chi}{113} + \mgr@CodeGreek{#1}{psi}{121} + \mgr@CodeGreek{#1}{omega}{119} + \mgr@CodeGreek{#1}{varepsilon}{101} % = epsilon + \mgr@CodeGreek{#1}{vartheta}{106} % = theta + \mgr@CodeGreek{#1}{varpi}{112} % = pi + \mgr@CodeGreek{#1}{varrho}{114} % = rho + \mgr@CodeGreek{#1}{varsigma}{99} + \mgr@CodeGreek{#1}{varphi}{102} % = phi + \else\ifmathgreeks@fontspec % unicode encoding + \mgr@UnicodeGreek{#1}{Gamma}{"0393} + \mgr@UnicodeGreek{#1}{Delta}{"0394} + \mgr@UnicodeGreek{#1}{Theta}{"0398} + \mgr@UnicodeGreek{#1}{Lambda}{"039B} + \mgr@UnicodeGreek{#1}{Xi}{"039E} + \mgr@UnicodeGreek{#1}{Pi}{"03A0} + \mgr@UnicodeGreek{#1}{Sigma}{"03A3} + \mgr@UnicodeGreek{#1}{Upsilon}{"03A5} + \mgr@UnicodeGreek{#1}{Phi}{"03A6} + \mgr@UnicodeGreek{#1}{Psi}{"03A8} + \mgr@UnicodeGreek{#1}{Omega}{"03A9} + \mgr@UnicodeGreek{#1}{alpha}{"03B1} + \mgr@UnicodeGreek{#1}{beta}{"03B2} + \mgr@UnicodeGreek{#1}{gamma}{"03B3} + \mgr@UnicodeGreek{#1}{delta}{"03B4} + \mgr@UnicodeGreek{#1}{epsilon}{"03B5} + \mgr@UnicodeGreek{#1}{zeta}{"03B6} + \mgr@UnicodeGreek{#1}{eta}{"03B7} + \mgr@UnicodeGreek{#1}{theta}{"03B8} + \mgr@UnicodeGreek{#1}{iota}{"03B9} + \mgr@UnicodeGreek{#1}{kappa}{"03BA} + \mgr@UnicodeGreek{#1}{lambda}{"03BB} + \mgr@UnicodeGreek{#1}{mu}{"03BC} + \mgr@UnicodeGreek{#1}{nu}{"03BD} + \mgr@UnicodeGreek{#1}{xi}{"03BE} % not omicron + \mgr@UnicodeGreek{#1}{pi}{"03C0} + \mgr@UnicodeGreek{#1}{rho}{"03C1} + \mgr@UnicodeGreek{#1}{sigma}{"03C3} + \mgr@UnicodeGreek{#1}{tau}{"03C4} + \mgr@UnicodeGreek{#1}{upsilon}{"03C5} + \mgr@UnicodeGreek{#1}{phi}{"03C6} + \mgr@UnicodeGreek{#1}{chi}{"03C7} + \mgr@UnicodeGreek{#1}{psi}{"03C8} + \mgr@UnicodeGreek{#1}{omega}{"03C9} + \mgr@UnicodeGreek{#1}{varepsilon}{"03F5} + \mgr@UnicodeGreek{#1}{vartheta}{"03D1} + \mgr@UnicodeGreek{#1}{varpi}{"03D6} + \mgr@UnicodeGreek{#1}{varrho}{"03F1} + \mgr@UnicodeGreek{#1}{varsigma}{"03C2} + \mgr@UnicodeGreek{#1}{varphi}{"03D5} + \else\ifmathgreeks@Symbol % Symbol encoding + \mgr@CodeGreek{#1}{Gamma}{`G} + \mgr@CodeGreek{#1}{Delta}{`D} + \mgr@CodeGreek{#1}{Theta}{`Q} + \mgr@CodeGreek{#1}{Lambda}{`L} + \mgr@CodeGreek{#1}{Xi}{`X} + \mgr@CodeGreek{#1}{Pi}{`P} + \mgr@CodeGreek{#1}{Sigma}{`S} + \mgr@CodeGreek{#1}{Upsilon}{`U} + \mgr@CodeGreek{#1}{Phi}{`F} + \mgr@CodeGreek{#1}{Psi}{`Y} + \mgr@CodeGreek{#1}{Omega}{`W} + \mgr@CodeGreek{#1}{alpha}{`a} + \mgr@CodeGreek{#1}{beta}{`b} + \mgr@CodeGreek{#1}{gamma}{`g} + \mgr@CodeGreek{#1}{delta}{`d} + \mgr@CodeGreek{#1}{epsilon}{`e} + \mgr@CodeGreek{#1}{zeta}{`z} + \mgr@CodeGreek{#1}{eta}{`h} + \mgr@CodeGreek{#1}{theta}{`q} + \mgr@CodeGreek{#1}{iota}{`i} + \mgr@CodeGreek{#1}{kappa}{`k} + \mgr@CodeGreek{#1}{lambda}{`l} + \mgr@CodeGreek{#1}{mu}{`m} + \mgr@CodeGreek{#1}{nu}{`n} + \mgr@CodeGreek{#1}{xi}{`x} + \mgr@CodeGreek{#1}{pi}{`p} + \mgr@CodeGreek{#1}{rho}{`r} + \mgr@CodeGreek{#1}{sigma}{`s} + \mgr@CodeGreek{#1}{tau}{`t} + \mgr@CodeGreek{#1}{upsilon}{`u} + \mgr@CodeGreek{#1}{phi}{`f} + \mgr@CodeGreek{#1}{chi}{`c} + \mgr@CodeGreek{#1}{psi}{`y} + \mgr@CodeGreek{#1}{omega}{`w} + \mgr@CodeGreek{#1}{varepsilon}{`u} % = epsilon + \mgr@CodeGreek{#1}{vartheta}{`J} + \mgr@CodeGreek{#1}{varpi}{`v} + \mgr@CodeGreek{#1}{varrho}{`r} % = rho + \mgr@CodeGreek{#1}{varsigma}{`s} % = sigma + \mgr@CodeGreek{#1}{varphi}{`j} + \else % OML (or U) encoding + \mgr@CodeGreek{#1}{Gamma}{"00} + \mgr@CodeGreek{#1}{Delta}{"01} + \mgr@CodeGreek{#1}{Theta}{"02} + \mgr@CodeGreek{#1}{Lambda}{"03} + \mgr@CodeGreek{#1}{Xi}{"04} + \mgr@CodeGreek{#1}{Pi}{"05} + \mgr@CodeGreek{#1}{Sigma}{"06} + \mgr@CodeGreek{#1}{Upsilon}{"07} + \mgr@CodeGreek{#1}{Phi}{"08} + \mgr@CodeGreek{#1}{Psi}{"09} + \mgr@CodeGreek{#1}{Omega}{"0A} + \mgr@CodeGreek{#1}{alpha}{"0B} + \mgr@CodeGreek{#1}{beta}{"0C} + \mgr@CodeGreek{#1}{gamma}{"0D} + \mgr@CodeGreek{#1}{delta}{"0E} + \mgr@CodeGreek{#1}{epsilon}{"0F} + \mgr@CodeGreek{#1}{zeta}{"10} + \mgr@CodeGreek{#1}{eta}{"11} + \mgr@CodeGreek{#1}{theta}{"12} + \mgr@CodeGreek{#1}{iota}{"13} + \mgr@CodeGreek{#1}{kappa}{"14} + \mgr@CodeGreek{#1}{lambda}{"15} + \mgr@CodeGreek{#1}{mu}{"16} + \mgr@CodeGreek{#1}{nu}{"17} + \mgr@CodeGreek{#1}{xi}{"18} + \mgr@CodeGreek{#1}{pi}{"19} + \mgr@CodeGreek{#1}{rho}{"1A} + \mgr@CodeGreek{#1}{sigma}{"1B} + \mgr@CodeGreek{#1}{tau}{"1C} + \mgr@CodeGreek{#1}{upsilon}{"1D} + \mgr@CodeGreek{#1}{phi}{"1E} + \mgr@CodeGreek{#1}{chi}{"1F} + \mgr@CodeGreek{#1}{psi}{"20} + \mgr@CodeGreek{#1}{omega}{"21} + \mgr@CodeGreek{#1}{varepsilon}{"22} + \mgr@CodeGreek{#1}{vartheta}{"23} + \mgr@CodeGreek{#1}{varpi}{"24} + \mgr@CodeGreek{#1}{varrho}{"25} + \mgr@CodeGreek{#1}{varsigma}{"26} + \mgr@CodeGreek{#1}{varphi}{"27} + %\mgr@CodeGreek{#1}{varkappa}{"FE} + \fi\fi\fi +} + +\newcommand\mgr@DefaultGreeks{% + \ifmathgreeks@uppercase + \ifmathgreeks@Greekup + \let\Gamma\upGamma + \let\Delta\upDelta + \let\Theta\upTheta + \let\Lambda\upLambda + \let\Xi\upXi + \let\Pi\upPi + \let\Sigma\upSigma + \let\Upsilon\upUpsilon + \let\Phi\upPhi + \let\Psi\upPsi + \let\Omega\upOmega + \else + \let\Gamma\itGamma + \let\Delta\itDelta + \let\Theta\itTheta + \let\Lambda\itLambda + \let\Xi\itXi + \let\Pi\itPi + \let\Sigma\itSigma + \let\Upsilon\itUpsilon + \let\Phi\itPhi + \let\Psi\itPsi + \let\Omega\itOmega + \fi\fi + \ifmathgreeks@lowercase + \ifmathgreeks@greekup + \let\alpha\upalpha + \let\beta\upbeta + \let\gamma\upgamma + \let\delta\updelta + \let\epsilon\upepsilon + \let\zeta\upzeta + \let\eta\upeta + \let\theta\uptheta + \let\iota\upiota + \let\kappa\upkappa + \let\lambda\uplambda + \let\mu\upmu + \let\nu\upnu + \let\xi\upxi + \let\pi\uppi + \let\rho\uprho + \let\sigma\upsigma + \let\tau\uptau + \let\upsilon\upupsilon + \let\phi\upphi + \let\chi\upchi + \let\psi\uppsi + \let\omega\upomega + \let\varepsilon\upvarepsilon + \let\vartheta\upvartheta + \let\varpi\upvarpi + \let\varrho\upvarrho + \let\varsigma\upvarsigma + \let\varphi\upvarphi + \else + \let\alpha\italpha + \let\beta\itbeta + \let\gamma\itgamma + \let\delta\itdelta + \let\epsilon\itepsilon + \let\zeta\itzeta + \let\eta\iteta + \let\theta\ittheta + \let\iota\itiota + \let\kappa\itkappa + \let\lambda\itlambda + \let\mu\itmu + \let\nu\itnu + \let\xi\itxi + \let\pi\itpi + \let\rho\itrho + \let\sigma\itsigma + \let\tau\ittau + \let\upsilon\itupsilon + \let\phi\itphi + \let\chi\itchi + \let\psi\itpsi + \let\omega\itomega + \let\varepsilon\itvarepsilon + \let\vartheta\itvartheta + \let\varpi\itvarpi + \let\varrho\itvarrho + \let\varsigma\itvarsigma + \let\varphi\itvarphi + \fi\fi +} + +\providecommand\SaveGreeks{% + \let\backGamma\Gamma + \let\backDelta\Delta + \let\backTheta\Theta + \let\backLambda\Lambda + \let\backXi\Xi + \let\backPi\Pi + \let\backSigma\Sigma + \let\backUpsilon\Upsilon + \let\backPhi\Phi + \let\backPsi\Psi + \let\backOmega\Omega + \let\backalpha\alpha + \let\backbeta\beta + \let\backgamma\gamma + \let\backdelta\delta + \let\backepsilon\epsilon + \let\backzeta\zeta + \let\backeta\eta + \let\backtheta\theta + \let\backiota\iota + \let\backkappa\kappa + \let\backlambda\lambda + \let\backmu\mu + \let\backnu\nu + \let\backxi\xi + \let\backpi\pi + \let\backrho\rho + \let\backsigma\sigma + \let\backtau\tau + \let\backupsilon\upsilon + \let\backphi\phi + \let\backchi\chi + \let\backpsi\psi + \let\backomega\omega + \let\backvarepsilon\varepsilon + \let\backvartheta\vartheta + \let\backvarpi\varpi + \let\backvarrtho\varrho + \let\backvarsigma\varsigma + \let\backvarphi\varphi +} + + +%%%%%%%%%%%%%% Macros for changing font dynamically %%%%%%%%%%%%% + +\newif\ifmgrfont@unicodemath +\define@key{mgrfont}{unicode-math}[Latin Modern Math]{% + \def\mgrfont@unicodemath{#1}\mgrfont@unicodemathtrue} +\newif\ifmgrfont@fontspec +\define@key{mgrfont}{fontspec}[GFS Didot]{% + \def\mgrfont@fontspec{#1}\mgrfont@fontspectrue} +\define@key{mgrfont}{enc}{\def\mgrfont@enc{#1}} +\define@key{mgrfont}{fam}{\def\mgrfont@fam{#1}} +\newcommand*\mgrfont@series{m} % default value +\define@key{mgrfont}{series}{\renewcommand*\mgrfont@series{#1}} +\newcommand*\mgrfont@shape{it} % default value +\define@key{mgrfont}{shape}{\renewcommand*\mgrfont@shape{#1}} + +\def\mathgreeksfont#1{% + \mgrfont@unicodemathfalse + \mgrfont@fontspecfalse + \renewcommand*\mgrfont@series{m} + \renewcommand*\mgrfont@shape{it} + \mathgreeks@lgrmathfalse + \mathgreeks@fontspecfalse + \mathgreeks@Symbolfalse + \mathgreeks@upgreekfalse + \setkeys{mgrfont}{#1} + \ifmgrfont@unicodemath + \setmathfont{\mgrfont@unicodemath}[range=it/{greek,Greek}] + \setmathfont{\mgrfont@unicodemath}[range=up/{greek,Greek}] + \let\mgr@UnicodeGreek\mgr@UnicodemathGreek + \mathgreeks@fontspectrue % for \mgr@CodeGreeks + \mgr@CodeGreeks{it} + \mgr@CodeGreeks{up} + \mgr@DefaultGreeks + \else\ifmgrfont@fontspec + \let\MathGreeksFont\relax + \newfontfamily\MathGreeksFont{\mgrfont@fontspec} + \let\mgr@UnicodeGreek\mgr@NewUnicodeGreek + \mathgreeks@fontspectrue + \mgr@CodeGreeks{it} + \mgr@CodeGreeks{up} + \mgr@DefaultGreeks + \else + \let\mgr@CodeGreek\mgr@NewCodeGreek + \ifdefstring{\mgrfont@enc}{LGR}{ + \mathgreeks@lgrmathtrue + }{ + \ifdefstring{\mgrfont@fam}{psy}{ + \mathgreeks@Symboltrue + }{ + \ifdefstring{\mgrfont@fam}{fsy}{ + \mathgreeks@Symboltrue + }{ + }}} + \mgr@CodeGreeks{} + \fi\fi +} + +\def\mgr@NewCodeGreek#1#2#3{\unskip + \expandafter\DeclareRobustCommand\csname#1#2\endcsname + {\mathalpha{\text{\usefont{\mgrfont@enc}{\mgrfont@fam} + {\mgrfont@series}{\mgrfont@shape}\symbol{#3}} + }}\ignorespaces +} + +\def\mgr@NewUnicodeGreek#1#2#3{\unskip % only with fontspec + \expandafter\DeclareRobustCommand\csname#1#2\endcsname + {\mathalpha{\text{\csname#1shape\endcsname% + \MathGreeksFont\symbol{#3}} + }}\ignorespaces +} + +\providecommand\greektable{ + $\begin{array}{c} + \begin{array}{*{23}{@{\;}c}@{\;}} + \alpha & \beta & \gamma & \delta & \epsilon & \zeta & \eta & + \theta & \iota & \kappa & \lambda & \mu & \nu & \xi & \pi & + \rho & \sigma & \tau & \upsilon & \phi & \chi & \psi & \omega + \end{array} + \\ + \begin{array}{*{18}{@{\;}c}@{\;}} + \varepsilon & \vartheta & \varpi & \varrho & \varsigma & \varphi + & | & + \Gamma & \Delta & \Theta & \Lambda & \Xi & \Pi & \Sigma & + \Upsilon & \Phi & \Psi & \Omega + \end{array} + \end{array}$ +} + +% \end{macrocode} +% \Finale +\endinput diff --git a/macros/latex/contrib/mathgreeks/mathgreeks.ins b/macros/latex/contrib/mathgreeks/mathgreeks.ins new file mode 100644 index 0000000000..a1a8f6786b --- /dev/null +++ b/macros/latex/contrib/mathgreeks/mathgreeks.ins @@ -0,0 +1,56 @@ +%% +%% Copyright (C) 2024 by Antoine Missier <antoine.missier@ac-toulouse.fr> +%% +%% This file 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. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/mathgreeks} + +\preamble + +This is a generated file. + +Copyright (C) 2024 by Antoine Missier <antoine.missier@ac-toulouse.fr> + +This file 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{mathgreeks.sty}{\from{mathgreeks.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* files into a directory searched by TeX: *} +\Msg{* *} +\Msg{* mathgreeks.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* mathgreeks.dtx through LuaLaTeX *} +\Msg{* (or LaTeX for a shorter version). *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile diff --git a/macros/latex/contrib/mathgreeks/mathgreeks.pdf b/macros/latex/contrib/mathgreeks/mathgreeks.pdf Binary files differnew file mode 100644 index 0000000000..03ca96ca9d --- /dev/null +++ b/macros/latex/contrib/mathgreeks/mathgreeks.pdf diff --git a/macros/latex/contrib/osda/README.md b/macros/latex/contrib/osda/README.md index 03de404407..07396d51d5 100644 --- a/macros/latex/contrib/osda/README.md +++ b/macros/latex/contrib/osda/README.md @@ -28,7 +28,7 @@ above. ``` \usepackage[ - 2023, + 2024, cc-by, pages={1}{6}, url=https://osda.ws/r/aaVHo, @@ -59,7 +59,7 @@ pdflatex osda.dtx ## License information -Copyright 2023 by Christian Krieg (christian@osda.ws) +Copyright 2023-2024 by Christian Krieg (christian@osda.ws) This work (excluding the OSDA logo) may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this diff --git a/macros/latex/contrib/osda/example.png b/macros/latex/contrib/osda/example.png Binary files differindex 4f8b01b361..2b1a2f49b1 100644 --- a/macros/latex/contrib/osda/example.png +++ b/macros/latex/contrib/osda/example.png diff --git a/macros/latex/contrib/osda/osda.dtx b/macros/latex/contrib/osda/osda.dtx index b0ad170e90..7406112206 100644 --- a/macros/latex/contrib/osda/osda.dtx +++ b/macros/latex/contrib/osda/osda.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % osda.ins -% Copyright 2023 by Christian Krieg (christian@osda.ws) +% Copyright 2023-2024 by Christian Krieg (christian@osda.ws) % % This work (excluding the OSDA logo) may be distributed and/or modified under % the conditions of the LaTeX Project Public License, either version 1.3 of this @@ -29,7 +29,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{osda} %<*package> - [2023/04/03 v1.2.0 OSDA copyright notice generator] + [2024/05/01 v1.4.0 OSDA copyright notice generator] %</package> % %<*driver> @@ -52,7 +52,7 @@ moredelim=**[is][\ttfamily\bfseries\color{red}]{(*}{*)}, } \usepackage[ - 2023, + 2024, cc-by, pages={1}{6}, url=https://osda.ws/r/0slLz, @@ -93,6 +93,11 @@ % \changes{v1.0.0}{2023/03/30}{Initial version} % \changes{v1.1.0}{2023/04/03}{Adding 'auto' option} % \changes{v1.2.0}{2023/04/03}{Updating README} +% \changes{v1.3.0}{2023/04/04}{ +% Adding presets for the years 2019 and 2020, +% adding inline OSDA logo +% } +% \changes{v1.4.0}{2024/05/01}{Adding preset for 2020} % % \GetFileInfo{osda.sty} % @@ -107,7 +112,7 @@ % \author{Christian Krieg\\ Workshop on Open-Source Design Automation (OSDA) \\ % \texttt{christian@osda.ws} % } -% \date{April 03, 2023} +% \date{May 01, 2024} % % \newcommand{\Example}{\vspace{1em}\noindent\textbf{Example:}\vspace{1em}} % @@ -139,7 +144,7 @@ % \begin{lstlisting}[gobble=6,float=tb,label=lst:usage-example,caption={An % example for the most-frequent use case to use this package}] % \usepackage[ -% 2023, +% 2024, % cc-by, % pages={1}{6}, % url=https://osda.ws/r/0slLz, @@ -190,7 +195,7 @@ % setting package options}] % \usepackage[auto=false]{osda} % \osdaset{ -% 2023, +% 2024, % cc-by, % pages={1}{6}, % url=https://osda.ws/r/0slLz, @@ -237,10 +242,13 @@ % example is given in \Cref{lst:option-year}. % % \begin{lstlisting}[gobble=6, label=lst:option-year, caption={Setting all -% workshop-related options for the year 2023}] -% \osdaset{2023} +% workshop-related options for the year 2024}] +% \osdaset{2024} % \end{lstlisting} % +% Currently, presets for the following years are available: +% |2024|, |2023|, |2020|, |2019| +% % \subsection{Paper license} % % \DescribeMacro{cc-by} @@ -436,6 +444,36 @@ % \end{tabular} % \end{table} % +% \section{Useful commands} +% +% \subsection{Inline logo} +% +% \DescribeMacro{\osda} +% This command prints the OSDA logo inline as shown in the following examples at +% different font sizes (\Cref{lst:inline-logo}): +% +% \begin{lstlisting}[gobble=6, label=lst:inline-logo, caption={Inline OSDA logo}] +% Hello there, \osda{} is the place to be +% +% {\large I agree, \osda{} is the place to be!} +% +% {\small I agree, \osda{} is the place to be!} +% +% {\Huge I agree, \osda{} is the place to be!} +% +% {\tiny I agree, \osda{} is the place to be!} +% \end{lstlisting} +% +% Hello there, \osda{} is the place to be +% +% {\large I agree, \osda{} is the place to be!} +% +% {\small I agree, \osda{} is the place to be!} +% +% {\Huge I agree, \osda{} is the place to be!} +% +% {\tiny I agree, \osda{} is the place to be!} +% % % \StopEventually{} % @@ -560,6 +598,19 @@ % % Default values for specific editions of OSDA % + 2024/.style={ + proceedings/title = Proceedings of the 4th Workshop on Open-Source Design Automation (OSDA), + workshop/counter = 4th, + workshop/longname = Workshop on Open-Source Design Automation, + workshop/acronym = OSDA, + location/city = Valencia, + location/country = Spain, + date/month = March, + date/day = 25, + date/year = 2024, + hostconference/longname = {Design, Automation, and Test in Europe Conference}, + hostconference/acronym = DATE, + }, 2023/.style={ proceedings/title = Proceedings of the 3rd Workshop on Open-Source Design Automation (OSDA), workshop/counter = 3rd, @@ -573,6 +624,32 @@ hostconference/longname = {Design, Automation, and Test in Europe Conference}, hostconference/acronym = DATE, }, + 2020/.style={ + proceedings/title = Proceedings of the 2nd Workshop on Open-Source Design Automation (OSDA), + workshop/counter = 2nd, + workshop/longname = Workshop on Open-Source Design Automation, + workshop/acronym = OSDA, + location/city = Grenoble, + location/country = France, + date/month = March, + date/day = 13, + date/year = 2020, + hostconference/longname = {Design, Automation, and Test in Europe Conference}, + hostconference/acronym = DATE, + }, + 2019/.style={ + proceedings/title = Proceedings of the 1st Workshop on Open-Source Design Automation (OSDA), + workshop/counter = 1st, + workshop/longname = Workshop on Open-Source Design Automation, + workshop/acronym = OSDA, + location/city = Florence, + location/country = Italy, + date/month = March, + date/day = 29, + date/year = 2019, + hostconference/longname = {Design, Automation, and Test in Europe Conference}, + hostconference/acronym = DATE, + }, % % Licenses % @@ -737,6 +814,24 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\osda} +%% +%% |\osda| +%% +%% This command prints the OSDA logo inline at a height of 1ex +%% +%% Usage: +%% +%% |\osda{}| +%% +% \begin{macrocode} +% +\newcommand{\osda}{\raisebox{.6\baselineskip}{\osdalogo{.7\baselineskip}}} +% +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\osdanotice} %% %% |\osdanotice| diff --git a/macros/latex/contrib/osda/osda.ins b/macros/latex/contrib/osda/osda.ins index a76841c47b..21524ff0ac 100644 --- a/macros/latex/contrib/osda/osda.ins +++ b/macros/latex/contrib/osda/osda.ins @@ -1,5 +1,5 @@ %% osda.ins -%% Copyright 2023 by Christian Krieg <christian@osda.ws> +%% Copyright 2023-2024 by Christian Krieg <christian@osda.ws> %% %% This work (excluding the OSDA logo) may be distributed and/or modified under %% the conditions of the LaTeX Project Public License, either version 1.3 @@ -29,7 +29,7 @@ This is a generated file. -Copyright (C) 2023 by Christian Krieg <christian@osda.ws> +Copyright (C) 2023-2024 by Christian Krieg <christian@osda.ws> This work (excluding the OSDA logo) may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/osda/osda.pdf b/macros/latex/contrib/osda/osda.pdf Binary files differindex 51bdfa0b02..5399ddcda0 100644 --- a/macros/latex/contrib/osda/osda.pdf +++ b/macros/latex/contrib/osda/osda.pdf diff --git a/macros/luatex/generic/luamplib/Makefile b/macros/luatex/generic/luamplib/Makefile index f4d638764e..f41c9a6339 100644 --- a/macros/luatex/generic/luamplib/Makefile +++ b/macros/luatex/generic/luamplib/Makefile @@ -36,7 +36,7 @@ world: all ctan .PHONY: all doc unpack ctan tds check world %.pdf: %.dtx - latexmk -lualatex -recorder- -silent $< >/dev/null + @texfot --quiet --tee=/dev/null --ignore "^Overfull" --ignore "^Underfull" lualatex -recorder $< $(UNPACKED): $(DTX) luatex -interaction=batchmode $< >/dev/null diff --git a/macros/luatex/generic/luamplib/NEWS b/macros/luatex/generic/luamplib/NEWS index f0dd1cf2f4..87f52a0066 100644 --- a/macros/luatex/generic/luamplib/NEWS +++ b/macros/luatex/generic/luamplib/NEWS @@ -1,5 +1,48 @@ History of the luamplib package +2024/05/01 2.29.0 + + * provide new TeX macros to reduce typing toil. + + \mpfig ... \endmpfig is roughly the abbreviation of + \begin{mplibcode}[@mpfig] + beginfig(0) + token list declared by \everymplib[@mpfig] + ... + token list declared by \everyendmplib[@mpfig] + endfig; + \end{mplibcode} + + \mpfig* ... \endmpfig is roughly the abbreviation of + \begin{mplibcode}[@mpfig] + ... + \end{mplibcode} + + These macros are protected and unexpandable. + In these macros \mpliblegacybehavior{false} is forcibly declared. + As both share the same instance name, MetaPost codes are inherited among them. + The instance name (default: @mpfig) can be changed by redefining `\mpfiginstancename'. + + * instance names are allowed in plain TeX as well. The syntax is: + + \mplibcode[name] ... \endmplibcode + \everymplib[name]{ ... } + \everyendmplib[name]{ ... } + + These macros are now protected and unexpandable. + + * provide new MetaPost operators `mplibtexcolor' and `mplibrgbtexcolor' + which convert TeX color expressions to MetaPost color expressions. + The latter one forces rgb model results (#112). For instance, + + mplibtexcolor "olive" % => (0, 0, 1, 0.5) + mplibrgbtexcolor "olive" % => (0.5, 0.5, 0) + + As spot colors are always forced to cmyk or rgb model, it is not + recommended to use these operators for them. + + * write down MetaPost messages into the log file + 2024/04/25 2.28.2 * direction of figure box is explicitly declared as TLT (#129) * figure box materials are emitted in one go at the end of the figure @@ -72,11 +115,11 @@ 2024/03/01 2.26.0 * when \mplibcachedir{<dir>} is not set, default cache directory will be in the following order: - $TEXMFVAR/luamplib_cache - $TEXMF_OUTPUT_DIRECTORY/luamplib_cache - ./luamplib_cache - $TEXMFOUTPUT/luamplib_cache - . + $TEXMFVAR/luamplib_cache + $TEXMF_OUTPUT_DIRECTORY/luamplib_cache + ./luamplib_cache + $TEXMFOUTPUT/luamplib_cache + . 2024/01/25 2.25.3 * protect "..." even if textextlabel is disabled (revert part of v2.25.0) diff --git a/macros/luatex/generic/luamplib/luamplib.dtx b/macros/luatex/generic/luamplib/luamplib.dtx index 283120c622..52b35b8acb 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/25 v2.28.2 Interface for using the mplib library]% + [2024/05/01 v2.29.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/25 v2.28.2} +% \date{2024/05/01 v2.29.0} % % \maketitle % @@ -209,6 +209,41 @@ See source file '\inFileName' for licencing and contact information. % setting. (Actually these commands redefine |\prependtomplibbox|. You % can define this command with anything suitable before a box.) % +% \paragraph{\cs{mpfig} \ldots\ \cs{endmpfig}} +% Since v2.29 we provide unexpandable \TeX\ macros |\mpfig ... \endmpfig| and its starred version +% |\mpfig* ... \endmpfig| to save typing toil. +% The first is roughly the same as follows: +% \begin{verbatim} +% \begin{mplibcode}[@mpfig] +% beginfig(0) +% token list declared by \everymplib[@mpfig] +% ... +% token list declared by \everyendmplib[@mpfig] +% endfig; +% \end{mplibcode} +% \end{verbatim} +% and the starred version is roughly the same as follows: +% \begin{verbatim} +% \begin{mplibcode}[@mpfig] +% ... +% \end{mplibcode} +% \end{verbatim} +% In these macros |\mpliblegacybehavior{disable}| (see below) +% is forcibly declared. +% And as both share the same instance name, metapost codes are inherited among them. +% A simple example: +% \begin{verbatim} +% \mpfig* input boxes \endmpfig +% \everymplib[@mpfig]{ drawoptions(withcolor .5[red,white]); } +% \mpfig circleit.a(btex Box 1 etex); drawboxed(a); \endmpfig +% \end{verbatim} +% The instance name (default: |@mpfig|) can be changed by redefining +% \cs{mpfiginstancename}, after which a new MPlib instance will start and +% code inheritance too will begin anew. |\let\mpfiginstancename\empty| will +% prevent code inheritance if |\mplibcodeinherit{true}| (see below) is not declared.\footnote{% +% As for user setting values, |enable|, |true|, |yes| are identical, and +% |disable|, |false|, |no| are identical.} +% % \paragraph{\cs{mpliblegacybehavior\{enable\}}} % By default, |\mpliblegacybehavior{enable}| is already declared, % in which case @@ -326,9 +361,10 @@ See source file '\inFileName' for licencing and contact information. % each code chunks being treated as an independent instance, and never % affected by previous code chunks. % -% \paragraph{Separate instances for \LaTeX{} environment} +% \paragraph{Separate instances for \LaTeX{} and plain \TeX} % v2.22 has added the support for several named MetaPost instances % in \LaTeX{} |mplibcode| environment. +% (And since v2.29 plain \TeX\ users can use this functionality as well.) % Syntax is like so: % \begin{verbatim} % \begin{mplibcode}[instanceName] @@ -378,7 +414,8 @@ See source file '\inFileName' for licencing and contact information. % \endmplibcode % \end{verbatim} % Generally speaking, it is recommended to turn |mplibglobaltextext| -% always on, because it has the advantage of more efficient processing. +% always on, because it has the advantage of reusing metapost pictures +% among code chunks sharing the same mplib instance. % But everything has its downside: it will waste more memory resources. % % \paragraph{\cs{mplibverbatim}} @@ -423,6 +460,19 @@ 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{mplibtexcolor}, \texttt{mplibrgbtexcolor}} +% |mplibtexcolor| is a metapost operator that converts a \TeX\ color expression +% to a MetaPost color expression. For instance: +% \begin{verbatim} +% color col; col := mplibtexcolor "olive!50"; +% \end{verbatim} +% The result may vary in its color model (gray/rgb/cmyk) +% according to the given \TeX\ color. (Spot colors are forced to +% cmyk model, so this operator is not recommended for spot colors.) +% Therefore the example shown above would raise a metapost error: +% |cmykcolor col;| should have been declared. +% By contrast, |mplibrgbtexcolor| always returns rgb model expressions. +% % \paragraph{\texttt{mplibgraphictext}} % For some amusement, luamplib provides its own metapost operator % |mplibgraphictext|, the effect of which is similar to that of @@ -476,8 +526,8 @@ See source file '\inFileName' for licencing and contact information. luatexbase.provides_module { name = "luamplib", - version = "2.28.2", - date = "2024/04/25", + version = "2.29.0", + date = "2024/05/01", description = "Lua package to typeset Metapost with LuaTeX's MPLib.", } @@ -821,9 +871,8 @@ luamplib.setformat = setformat % v2.9 has introduced the concept of ``code inherit'' % \begin{macrocode} luamplib.codeinherit = false - local mplibinstances = {} -local instancename +local has_instancename = false local function reporterror (result, prevlog) if not result then @@ -913,7 +962,7 @@ end % Here, excute each |mplibcode| data, % ie |\begin{mplibcode} ... \end{mplibcode}|. % \begin{macrocode} -local function process (data) +local function process (data, instancename) % \end{macrocode} % % The workaround of issue \#70 seems to be unnecessary, as we use @@ -927,6 +976,7 @@ local function process (data) local currfmt if instancename and instancename ~= "" then currfmt = instancename + has_instancename = true else currfmt = tableconcat{ currentformat, @@ -934,12 +984,10 @@ local function process (data) tostring(luamplib.textextlabel), tostring(luamplib.legacy_verbatimtex), } + has_instancename = false end local mpx = mplibinstances[currfmt] - local standalone = false - if currfmt ~= instancename then - standalone = not luamplib.codeinherit - end + local standalone = not (has_instancename or luamplib.codeinherit) if mpx and standalone then mpx:finish() end @@ -1006,10 +1054,7 @@ end % Boxes of an instance will also be global, so that % their tex boxes can be shared among instances of the same name. % \begin{macrocode} -local texboxes = { - locals = {}, localid = 4096, - globals = {}, globalid = 0, -} +local texboxes = { globalid = 0, localid = 4096 } % \end{macrocode} % For conversion of |sp| to |bp|. % \begin{macrocode} @@ -1021,32 +1066,21 @@ withprescript "mplibtexboxid=%i:%f:%f")' local function process_tex_text (str) if str then - local boxtable, global - if instancename and instancename ~= "" - or luamplib.globaltextext or luamplib.codeinherit then - boxtable, global = texboxes.globals, "\\global" + local global = (has_instancename or luamplib.globaltextext or luamplib.codeinherit) + and "\\global" or "" + local tex_box_id + if global == "" then + tex_box_id = texboxes.localid + 1 + texboxes.localid = tex_box_id else - boxtable, global = texboxes.locals, "" - end - local tex_box_id = boxtable[str] - local box = tex_box_id and texgetbox(tex_box_id) - if not box then - if global == "" then - tex_box_id = texboxes.localid + 1 - texboxes.localid = tex_box_id - else - local boxid = texboxes.globalid + 1 - texboxes.globalid = boxid - run_tex_code(format( - [[\expandafter\newbox\csname luamplib.box.%s\endcsname]], boxid)) - tex_box_id = tex.getcount'allocationnumber' - end - if str:find"^[%s%w%{%}%$%^%_]*$" then -- the same cs may expand differently - boxtable[str] = tex_box_id - end - run_tex_code(format("%s\\setbox%i\\hbox{%s}", global, tex_box_id, str)) - box = texgetbox(tex_box_id) + local boxid = texboxes.globalid + 1 + texboxes.globalid = boxid + run_tex_code(format( + [[\expandafter\newbox\csname luamplib.box.%s\endcsname]], boxid)) + tex_box_id = tex.getcount'allocationnumber' end + run_tex_code(format("%s\\setbox%i\\hbox{%s}", global, tex_box_id, str)) + local box = texgetbox(tex_box_id) local wd = box.width / factor local ht = box.height / factor local dp = box.depth / factor @@ -1146,6 +1180,33 @@ luamplib.outlinecolor = function (str, filldraw) return format('%s"nn"; %s"%s}{%s";', nn, cc, md, tableconcat(t,',')) end +luamplib.gettexcolor = function (str, rgb) + local res = process_color(str, "metapost") + if res:find" cs " or res:find"@pdf.obj" then + if not rgb then + warn("%s is a spot color. Forced to CMYK", str) + end + run_tex_code({ + "\\color_export:nnN{", + str, + "}{", + rgb and "space-sep-rgb" or "space-sep-cmyk", + "}\\mplib_@tempa", + },ccexplat) + return get_macro"mplib_@tempa":explode() + end + local t = colorsplit(res) + if #t == 3 or not rgb then return t end + run_tex_code({ -- force to rgb + "\\color_export:nnnN{", + #t == 4 and "cmyk" or "gray", + "}{", + tableconcat(t,","), + "}{space-sep-rgb}\\mplib_@tempa", + },ccexplat) + return get_macro"mplib_@tempa":explode() +end + luamplib.shadecolor = function (str) local res = process_color(str, "shade") if res:find" cs " or res:find"@pdf.obj" then -- spot color shade: l3 only @@ -1259,11 +1320,6 @@ local tex_code_pre_mplib = {} luamplib.figid = 1 luamplib.in_the_fig = false -local function legacy_mplibcode_reset () - tex_code_pre_mplib = {} - luamplib.figid = 1 -end - local function process_verbatimtex_prefig (str) if str then tex_code_pre_mplib[luamplib.figid] = str @@ -1297,7 +1353,6 @@ mp.mf_path_reset = mp.mf_path_reset or function() end mp.mf_finish_saving_data = mp.mf_finish_saving_data or function() end mp.report = mp.report or info - % \end{macrocode} % % metafun 2021-03-09 changes crashes luamplib. @@ -1411,6 +1466,9 @@ def rawtextext (expr t) = runscript("luamplibtext{"&t&"}") enddef; def mplibcolor (expr t) = runscript("luamplibcolor{"&t&"}") enddef; def mplibdimen (expr t) = runscript("luamplibdimen{"&t&"}") enddef; def VerbatimTeX (expr t) = runscript("luamplibverbtex{"&t&"}") enddef; +def message expr t = + if string t: runscript("mp.report[=["&t&"]=]") else: errmessage "Not a string" fi +enddef; if known context_mlib: defaultfont := "cmtt10"; let infont = normalinfont; @@ -1445,6 +1503,12 @@ def externalfigure primary filename = draw rawtextext("\includegraphics{"& filename &"}") enddef; def TEX = textext enddef; +def mplibtexcolor primary c = + runscript("return luamplib.gettexcolor('"& c &"')") +enddef; +def mplibrgbtexcolor primary c = + runscript("return luamplib.gettexcolor('"& c &"','rgb')") +enddef; def mplibgraphictext primary t = begingroup; mplibgraphictext_ (t) @@ -1556,23 +1620,22 @@ local function unprotect_expansion (str) end end -luamplib.everymplib = { [""] = "" } -luamplib.everyendmplib = { [""] = "" } +luamplib.everymplib = setmetatable({ [""] = "" },{ __index = function(t) return t[""] end }) +luamplib.everyendmplib = setmetatable({ [""] = "" },{ __index = function(t) return t[""] end }) -local function process_mplibcode (data, instance) - instancename = instance - texboxes.locals, texboxes.localid = {}, 4096 +local function process_mplibcode (data, instancename) + texboxes.localid = 4096 % \end{macrocode} % -% This is needed for legacy behavior regarding |verbatimtex| +% This is needed for legacy behavior % \begin{macrocode} - legacy_mplibcode_reset() + if luamplib.legacy_verbatimtex then + luamplib.figid, tex_code_pre_mplib = 1, {} + end - local everymplib = luamplib.everymplib[instancename] or - luamplib.everymplib[""] - local everyendmplib = luamplib.everyendmplib[instancename] or - luamplib.everyendmplib[""] + local everymplib = luamplib.everymplib[instancename] + local everyendmplib = luamplib.everyendmplib[instancename] data = format("\n%s\n%s\n%s\n",everymplib, data, everyendmplib) :gsub("\r","\n") @@ -1618,7 +1681,7 @@ local function process_mplibcode (data, instance) end) end - process(data) + process(data, instancename) end luamplib.process_mplibcode = process_mplibcode @@ -1820,7 +1883,37 @@ end % \end{macrocode} % -% Colors and Transparency +% Colors +% \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 + pdf_literalcode(override) + override = nil + else + put2output("\\special{%s}",override) + prev_override_color = override + end + else + local cs = object.color + if cs and #cs > 0 then + pdf_literalcode(luamplib.colorconverter(cs)) + prev_override_color = nil + elseif not pdfmode then + override = prev_override_color + if override then + put2output("\\special{%s}",override) + end + end + end + return override +end + +% \end{macrocode} +% +% For transparency and shading % \begin{macrocode} local pdfmanagement = is_defined'pdfmanagement_add:nnn' local pdfobjs, pdfetcs = {}, {} @@ -1851,7 +1944,7 @@ end % \end{macrocode} % -% transparency +% Transparency % \begin{macrocode} local transparancy_modes = { [0] = "Normal", "Normal", "Multiply", "Screen", "Overlay", @@ -1937,45 +2030,15 @@ end local function do_preobj_TR(prescript) local opaq = prescript and prescript.tr_transparency - local tron_no, troff_no + local tron_no if opaq then local mode = prescript.tr_alternative or 1 mode = transparancy_modes[tonumber(mode)] - troff_no = update_tr_res("Normal", 1) - tron_no = update_tr_res(mode, opaq) + tron_no = update_tr_res(mode, opaq) + start_pdf_code() 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 - pdf_literalcode(override) - override = nil - else - put2output("\\special{%s}",override) - prev_override_color = override - end - else - local cs = object.color - if cs and #cs > 0 then - pdf_literalcode(luamplib.colorconverter(cs)) - prev_override_color = nil - elseif not pdfmode then - override = prev_override_color - if override then - put2output("\\special{%s}",override) - end - end - end - return override + return tron_no end % \end{macrocode} @@ -2213,22 +2276,6 @@ end % \end{macrocode} % -% color stuffs at the end of object -% \begin{macrocode} -local function do_postobj_color(tr,over,sh) - if sh then - pdf_literalcode("W n /MPlibSh%s sh Q",sh) - end - if over then - put2output"\\special{pdf:ec}" - end - if tr then - pdf_literalcode("/MPlibTr%i gs",tr) - end -end - -% \end{macrocode} -% % Finally, flush figures by inserting PDF literals. % \begin{macrocode} local function flush(result,flusher) @@ -2257,9 +2304,7 @@ local function flush(result,flusher) % \begin{macrocode} else % \end{macrocode} -% For collecting pdf materials and -% for legacy behavior. Insert `pre-fig' \TeX\ code here, and -% prepare a table for `in-fig' codes. +% For legacy behavior, insert `pre-fig' \TeX\ code here. % \begin{macrocode} if tex_code_pre_mplib[f] then put2output(tex_code_pre_mplib[f]) @@ -2274,14 +2319,13 @@ local function flush(result,flusher) local objecttype = object.type % \end{macrocode} % -% The following 7 lines are part of |btex...etex| patch. +% The following 6 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 = do_preobj_TR(prescript) - local cr_over = do_preobj_CR(object,prescript) - local shade_no = do_preobj_SH(object,prescript) + local cr_over = do_preobj_CR(object,prescript) -- color + local tr_opaq = do_preobj_TR(prescript) -- opacity if prescript and prescript.mplibtexboxid then put_tex_boxes(object,prescript) elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then --skip @@ -2332,6 +2376,11 @@ local function flush(result,flusher) savedhtap[#savedhtap+1] = object.htap or false end else +% \end{macrocode} +% Removed from ConTeXt general: color stuff. +% Added instead : shading stuff +% \begin{macrocode} + local shade_no = do_preobj_SH(object,prescript) -- shading local ml = object.miterlimit if ml and ml ~= miterlimit then miterlimit = ml @@ -2394,8 +2443,7 @@ local function flush(result,flusher) flushnormalpath(path,open) end % \end{macrocode} -% -% Change from ConTeXt general: there was color stuffs. +% Shading seems to conflict with these ops % \begin{macrocode} if not shade_no then -- conflict with shading if objecttype == "fill" then @@ -2447,18 +2495,28 @@ local function flush(result,flusher) stop_pdf_code() end end - end - end % \end{macrocode} % -% Added to ConTeXt general: color stuff. -% And execute legacy |verbatimtex| code. +% Added to ConTeXt general: post-object color and shading stuff. % \begin{macrocode} - do_postobj_color(tr_opaq,cr_over,shade_no) + if shade_no then -- shading + pdf_literalcode("W n /MPlibSh%s sh Q",shade_no) + end + end + end + if tr_opaq then -- opacity + stop_pdf_code() + end + if cr_over then -- color + put2output"\\special{pdf:ec}" + end end end stop_pdf_code() pdf_stopfigure() +% \end{macrocode} +% output collected materials to PDF, plus legacy |verbatimtex| code. +% \begin{macrocode} for _,v in ipairs(figcontents) do if type(v) == "table" then texsprint"\\mplibtoPDF{"; texsprint(v[1], v[2]); texsprint"}" @@ -2511,7 +2569,7 @@ luamplib.colorconverter = colorconverter \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luamplib} - [2024/04/25 v2.28.2 mplib package for LuaTeX] + [2024/05/01 v2.29.0 mplib package for LuaTeX] \ifx\newluafunction\@undefined \input ltluatex \fi @@ -2549,12 +2607,12 @@ luamplib.colorconverter = colorconverter \ifcsname PackageInfo\endcsname \PackageInfo{luamplib}{only dvipdfmx is supported currently} \else - \write128{luamplib Info: only dvipdfmx is supported currently} + \immediate\write-1{luamplib Info: only dvipdfmx is supported currently} \fi \fi % \end{macrocode} % -% Make |mplibcode| typesetted always in horizontal mode. +% To make |mplibcode| typeset always in horizontal mode. % \begin{macrocode} \def\mplibforcehmode{\let\prependtomplibbox\leavevmode} \def\mplibnoforcehmode{\let\prependtomplibbox\relax} @@ -2575,47 +2633,122 @@ luamplib.colorconverter = colorconverter \def\mplibputtextbox#1{\vbox to 0pt{\vss\hbox to 0pt{\raise\dp#1\copy#1\hss}}} % \end{macrocode} % -% The Plain-specific stuff. +% simple way to use mplib: +% |\mpfig draw fullcircle scaled 10; \endmpfig| % \begin{macrocode} -\unless\ifcsname ver@luamplib.sty\endcsname -\def\mplibcode{% +\def\mpfiginstancename{@mpfig} +\protected\def\mpfig{% \begingroup + \futurelet\nexttok\mplibmpfigbranch +} +\def\mplibmpfigbranch{% + \ifx *\nexttok + \expandafter\mplibprempfig + \else + \expandafter\mplibmainmpfig + \fi +} +\def\mplibmainmpfig{% \begingroup \mplibsetupcatcodes - \mplibdocode + \mplibdomainmpfig } -\long\def\mplibdocode#1\endmplibcode{% +\long\def\mplibdomainmpfig#1\endmpfig{% \endgroup - \directlua{luamplib.process_mplibcode([===[\unexpanded{#1}]===],"")}% + \directlua{ + local legacy = luamplib.legacy_verbatimtex + local everympfig = luamplib.everymplib["\mpfiginstancename"] or "" + local everyendmpfig = luamplib.everyendmplib["\mpfiginstancename"] or "" + luamplib.legacy_verbatimtex = false + luamplib.everymplib["\mpfiginstancename"] = "" + luamplib.everyendmplib["\mpfiginstancename"] = "" + luamplib.process_mplibcode( + "beginfig(0) "..everympfig.." "..[===[\unexpanded{#1}]===].." "..everyendmpfig.." endfig;", + "\mpfiginstancename") + luamplib.legacy_verbatimtex = legacy + luamplib.everymplib["\mpfiginstancename"] = everympfig + luamplib.everyendmplib["\mpfiginstancename"] = everyendmpfig + }% \endgroup } -\else -% \end{macrocode} -% -% The \LaTeX-specific part: a new environment. -% \begin{macrocode} -\newenvironment{mplibcode}[1][]{% - \global\def\currentmpinstancename{#1}% - \mplibtmptoks{}\ltxdomplibcode -}{} -\def\ltxdomplibcode{% +\def\mplibprempfig#1{% \begingroup \mplibsetupcatcodes - \ltxdomplibcodeindeed + \mplibdoprempfig } -\def\mplib@mplibcode{mplibcode} -\long\def\ltxdomplibcodeindeed#1\end#2{% +\long\def\mplibdoprempfig#1\endmpfig{% + \endgroup + \directlua{ + local legacy = luamplib.legacy_verbatimtex + local everympfig = luamplib.everymplib["\mpfiginstancename"] + local everyendmpfig = luamplib.everyendmplib["\mpfiginstancename"] + luamplib.legacy_verbatimtex = false + luamplib.everymplib["\mpfiginstancename"] = "" + luamplib.everyendmplib["\mpfiginstancename"] = "" + luamplib.process_mplibcode([===[\unexpanded{#1}]===],"\mpfiginstancename") + luamplib.legacy_verbatimtex = legacy + luamplib.everymplib["\mpfiginstancename"] = everympfig + luamplib.everyendmplib["\mpfiginstancename"] = everyendmpfig + }% \endgroup - \mplibtmptoks\expandafter{\the\mplibtmptoks#1}% - \def\mplibtemp@a{#2}% - \ifx\mplib@mplibcode\mplibtemp@a - \directlua{luamplib.process_mplibcode([===[\the\mplibtmptoks]===],"\currentmpinstancename")}% - \end{mplibcode}% - \else - \mplibtmptoks\expandafter{\the\mplibtmptoks\end{#2}}% - \expandafter\ltxdomplibcode - \fi } +\protected\def\endmpfig{endmpfig} +% \end{macrocode} +% +% The Plain-specific stuff. +% \begin{macrocode} +\unless\ifcsname ver@luamplib.sty\endcsname + \def\mplibcodegetinstancename[#1]{\gdef\currentmpinstancename{#1}\mplibcodeindeed} + \protected\def\mplibcode{% + \begingroup + \futurelet\nexttok\mplibcodebranch + } + \def\mplibcodebranch{% + \ifx [\nexttok + \expandafter\mplibcodegetinstancename + \else + \global\let\currentmpinstancename\empty + \expandafter\mplibcodeindeed + \fi + } + \def\mplibcodeindeed{% + \begingroup + \mplibsetupcatcodes + \mplibdocode + } + \long\def\mplibdocode#1\endmplibcode{% + \endgroup + \directlua{luamplib.process_mplibcode([===[\unexpanded{#1}]===],"\currentmpinstancename")}% + \endgroup + } + \protected\def\endmplibcode{endmplibcode} +\else +% \end{macrocode} +% +% The \LaTeX-specific part: a new environment. +% \begin{macrocode} + \newenvironment{mplibcode}[1][]{% + \global\def\currentmpinstancename{#1}% + \mplibtmptoks{}\ltxdomplibcode + }{} + \def\ltxdomplibcode{% + \begingroup + \mplibsetupcatcodes + \ltxdomplibcodeindeed + } + \def\mplib@mplibcode{mplibcode} + \long\def\ltxdomplibcodeindeed#1\end#2{% + \endgroup + \mplibtmptoks\expandafter{\the\mplibtmptoks#1}% + \def\mplibtemp@a{#2}% + \ifx\mplib@mplibcode\mplibtemp@a + \directlua{luamplib.process_mplibcode([===[\the\mplibtmptoks]===],"\currentmpinstancename")}% + \end{mplibcode}% + \else + \mplibtmptoks\expandafter{\the\mplibtmptoks\end{#2}}% + \expandafter\ltxdomplibcode + \fi + } \fi % \end{macrocode} % @@ -2652,17 +2785,17 @@ luamplib.colorconverter = colorconverter % |luamplib.every(end)mplib| tables % % \begin{macrocode} -\protected\def\everymplib{% - \begingroup - \mplibsetupcatcodes - \mplibdoeverymplib -} -\protected\def\everyendmplib{% - \begingroup - \mplibsetupcatcodes - \mplibdoeveryendmplib -} \ifcsname ver@luamplib.sty\endcsname + \protected\def\everymplib{% + \begingroup + \mplibsetupcatcodes + \mplibdoeverymplib + } + \protected\def\everyendmplib{% + \begingroup + \mplibsetupcatcodes + \mplibdoeveryendmplib + } \newcommand\mplibdoeverymplib[2][]{% \endgroup \directlua{ @@ -2676,16 +2809,29 @@ luamplib.colorconverter = colorconverter }% } \else + \def\mplibgetinstancename[#1]{\def\currentmpinstancename{#1}} + \protected\def\everymplib#1#{% + \ifx\empty#1\empty \mplibgetinstancename[]\else \mplibgetinstancename#1\fi + \begingroup + \mplibsetupcatcodes + \mplibdoeverymplib + } \long\def\mplibdoeverymplib#1{% \endgroup \directlua{ - luamplib.everymplib[""] = [===[\unexpanded{#1}]===] + luamplib.everymplib["\currentmpinstancename"] = [===[\unexpanded{#1}]===] }% } + \protected\def\everyendmplib#1#{% + \ifx\empty#1\empty \mplibgetinstancename[]\else \mplibgetinstancename#1\fi + \begingroup + \mplibsetupcatcodes + \mplibdoeveryendmplib + } \long\def\mplibdoeveryendmplib#1{% \endgroup \directlua{ - luamplib.everyendmplib[""] = [===[\unexpanded{#1}]===] + luamplib.everyendmplib["\currentmpinstancename"] = [===[\unexpanded{#1}]===] }% } \fi diff --git a/macros/luatex/generic/luamplib/luamplib.pdf b/macros/luatex/generic/luamplib/luamplib.pdf Binary files differindex 6d410a4c26..a8cc10a03b 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 a077f67736..52af10d72b 100644 --- a/macros/luatex/generic/luamplib/test-luamplib-latex.tex +++ b/macros/luatex/generic/luamplib/test-luamplib-latex.tex @@ -197,6 +197,10 @@ fill unitsquare xyscaled (\mpdim\textwidth,1cm) ; endfig; \end{mplibcode}% +\leavevmode +\everymplib[@mpfig]{ drawoptions(withcolor red); }% +\mpfig* input boxes \endmpfig +\mpfig circleit.a(btex\tracingcommands0 Box 1 etex); drawboxed(a); \endmpfig \tracingcommands0 \vskip 2\baselineskip diff --git a/macros/luatex/generic/luamplib/test-luamplib-plain.tex b/macros/luatex/generic/luamplib/test-luamplib-plain.tex index 20773b280f..84d7041a8d 100644 --- a/macros/luatex/generic/luamplib/test-luamplib-plain.tex +++ b/macros/luatex/generic/luamplib/test-luamplib-plain.tex @@ -163,4 +163,83 @@ diameter:\Dia bp.% rotatedlabel.top(textext("Rotated!"), origin, 45); endfig; \endmplibcode +\par +\mplibsetformat{metafun}% +\mplibcode +beginfig(1) +fill unitsquare xyscaled (\mpdim\hsize, 1cm) + withshademethod "linear" + withshadevector (0,1) + withshadestep ( + withshadefraction .5 + withshadecolors (red,blue) + ) + withshadestep ( + withshadefraction 1 + withshadecolors (blue,green) + ) + ; +endfig; +\endmplibcode +\everymplib[@mpfig]{ drawoptions(withcolor red); }% +\mpfig* input boxes \endmpfig +\mpfig circleit.a(btex\tracingcommands0 Box 1 etex); drawboxed(a); \endmpfig +\tracingcommands0 + +\vskip 2\baselineskip +\mplibcodeinherit{disable} +\everymplib[instanceOne]{beginfig(1);} +\everyendmplib[instanceOne]{endfig;} + +\mplibcode[instanceOne] + picture TeX; + TeX := btex \TeX etex; +a := 1cm; +draw fullcircle scaled a; +draw btex a circle with $d=a$ etex shifted (a,0); +draw TeX; +\endmplibcode +Current instance name is: \currentmpinstancename \vskip 2\baselineskip + +\mplibcode[instanceTwo] +beginfig(1); +if not known a: + draw btex code is not inherited from an instance with a different name etex; +else: + errmessage("Variable was inherited from a different instance"); +fi; +endfig; +\endmplibcode +Current instance name is: \currentmpinstancename \vskip 2\baselineskip + +\mplibcode +beginfig(1); +if not known a: + draw btex code is not inherited if instance name is not listed etex; +else: + errmessage("Variable was inherited from a different instance"); +fi; +a := 1cm; +endfig; +\endmplibcode +Current instance name is: \currentmpinstancename (should be empty) \vskip 2\baselineskip + +\mplibcode +beginfig(1); +if not known a: + draw btex code is not inherited if mplibcodeinherit is disabled and instance name is not explicitly set etex; +else: + errmessage("Variable was inherited when code inheritance is turned off and instance name is not set"); +fi; +endfig; +\endmplibcode +Current instance name is: \currentmpinstancename (should be empty) \vskip 2\baselineskip + +\mplibcode[instanceOne] +draw unitsquare scaled a; +draw btex a square with side $=a$, inherited from the same instance etex shifted (3/2a, 1/2a); + draw TeX; +\endmplibcode +Current instance name is: \currentmpinstancename \vskip 2\baselineskip + \bye |