diff options
author | Norbert Preining <norbert@preining.info> | 2022-06-09 03:01:00 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-06-09 03:01:00 +0000 |
commit | 16559ce13a74c7a182875559b379cac00b07efda (patch) | |
tree | 6ee63e6aadfabf9a7334e6667fa32646fd812667 /macros/latex/required/graphics | |
parent | b3aac3ae7b628835121d1f485fd49998308170e7 (diff) |
CTAN sync 202206090300
Diffstat (limited to 'macros/latex/required/graphics')
26 files changed, 530 insertions, 46 deletions
diff --git a/macros/latex/required/graphics/README.md b/macros/latex/required/graphics/README.md index e58a421c93..5ccff78a3b 100644 --- a/macros/latex/required/graphics/README.md +++ b/macros/latex/required/graphics/README.md @@ -1,7 +1,7 @@ The LaTeX `graphics` bundle =========================== -Release 2021-12-14 +Release 2022-06-01 Overview -------- @@ -61,4 +61,4 @@ of the package. ----- -<p>Copyright (C) 1993-2021 The LaTeX Project <br /> +<p>Copyright (C) 1993-2022 The LaTeX Project <br /> diff --git a/macros/latex/required/graphics/changes.txt b/macros/latex/required/graphics/changes.txt index eb95865d2f..616f56230f 100644 --- a/macros/latex/required/graphics/changes.txt +++ b/macros/latex/required/graphics/changes.txt @@ -9,6 +9,26 @@ All changes above are only part of the development branch for the next release. ================================================================================ ######################### +# 2022-06-01 Release +######################### + +2022-03-10 Phelype Oleinik <phelype.oleinik@latex-project.org> + + * graphics.dtx: + Use \set@curr@file@nosearch to avoid premature inclusion of path + from \cs{graphicspath} (gh/776). + +2022-01-06 Frank Mittelbach <Frank.Mittelbach@latex-project.org> + + * mathcolor.dtx: + Support \mathcolor to correctly color parts of formulas without + spacing problems. This command is *only* supported in math mode. + +2021-12-07 Ulrike Fischer <Ulrike.Fischer@latex-project.org> + + * color.dtx: Remove stray spaces after change for xcolor/gh/10} + +######################### # 2021-12-14 Release ######################### diff --git a/macros/latex/required/graphics/color.dtx b/macros/latex/required/graphics/color.dtx index b4b0ad1091..cf3a7efbcf 100644 --- a/macros/latex/required/graphics/color.dtx +++ b/macros/latex/required/graphics/color.dtx @@ -2,7 +2,7 @@ % \iffalse % %% color.dtx Copyright (C) 1994--1999 David Carlisle -%% Copyright (C) 2005-2021 +%% Copyright (C) 2005-2022 LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -21,7 +21,7 @@ %<driver> \ProvidesFile{color.drv} % \fi % \ProvidesFile{color.dtx} - [2021/12/07 v1.3c Standard LaTeX Color (DPC)] + [2022/01/06 v1.3d Standard LaTeX Color (DPC)] % % \iffalse %<*driver> @@ -56,7 +56,7 @@ % document \emph{Packages in the `graphics' bundle} in the file % \texttt{grfguide.tex}. % -% \StopEventually{} +% \MaybeStop{} % % % \section{Options} @@ -826,6 +826,13 @@ % \end{macrocode} % \end{macro} % +% \subsection{Providing \cs{mathcolor}} +% +% This is shared coded between different packages, so external. +% +% \begin{macrocode} +\input{mathcolor.ltx} +% \end{macrocode} % % \section{Extra Groups} % Turning on extra groups in the standard \LaTeX\ commands, so that diff --git a/macros/latex/required/graphics/color.pdf b/macros/latex/required/graphics/color.pdf Binary files differindex 540a4f2808..b3cca89de7 100644 --- a/macros/latex/required/graphics/color.pdf +++ b/macros/latex/required/graphics/color.pdf diff --git a/macros/latex/required/graphics/drivers.dtx b/macros/latex/required/graphics/drivers.dtx index 6704ad11c6..e1c19e0296 100644 --- a/macros/latex/required/graphics/drivers.dtx +++ b/macros/latex/required/graphics/drivers.dtx @@ -3,7 +3,7 @@ % %% drivers.dtx Copyright (C) 1994 David Carlisle Sebastian Rahtz %% Copyright (C) 1995 1996 1997 1998 1999 David Carlisle -%% Copyright (C) 2000-2021 +%% Copyright (C) 2000-2022 LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -77,7 +77,7 @@ % % % -% \StopEventually{} +% \MaybeStop{} % % % \section{Colour} diff --git a/macros/latex/required/graphics/drivers.pdf b/macros/latex/required/graphics/drivers.pdf Binary files differindex 0f83884b10..a9bfdac464 100644 --- a/macros/latex/required/graphics/drivers.pdf +++ b/macros/latex/required/graphics/drivers.pdf diff --git a/macros/latex/required/graphics/epsfig.dtx b/macros/latex/required/graphics/epsfig.dtx index a34aa6842e..b8927f2da5 100644 --- a/macros/latex/required/graphics/epsfig.dtx +++ b/macros/latex/required/graphics/epsfig.dtx @@ -2,7 +2,7 @@ % \iffalse % %% epsfig.dtx Copyright (C) 1994-1996 1999 Sebastian Rahtz -%% Copyright (C) 2000-2021 +%% Copyright (C) 2000-2022 LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -41,7 +41,7 @@ % \maketitle % % -% \StopEventually{} +% \MaybeStop{} % % \section{Preface} % \begin{macrocode} diff --git a/macros/latex/required/graphics/epsfig.pdf b/macros/latex/required/graphics/epsfig.pdf Binary files differindex f8af4c38ae..b72f727ebb 100644 --- a/macros/latex/required/graphics/epsfig.pdf +++ b/macros/latex/required/graphics/epsfig.pdf diff --git a/macros/latex/required/graphics/graphics.dtx b/macros/latex/required/graphics/graphics.dtx index cec35559ef..92b3c8f335 100644 --- a/macros/latex/required/graphics/graphics.dtx +++ b/macros/latex/required/graphics/graphics.dtx @@ -2,7 +2,7 @@ % \iffalse % %% graphics.dtx Copyright (C) 1994 David Carlisle Sebastian Rahtz -%% Copyright (C) 1995-2021 +%% Copyright (C) 1995-2022 LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -27,7 +27,7 @@ %<driver> \ProvidesFile{graphics.drv} % \fi % \ProvidesFile{graphics.dtx} - [2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR)] + [2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)] % % \iffalse %<*driver> @@ -276,7 +276,7 @@ % and |\rotatebox| commands that some people may prefer. It is provided % by the accompanying |graphicx| package. % -% \StopEventually{} +% \MaybeStop{} % % \section{The Graphics Kernel Functions} % @@ -1053,33 +1053,39 @@ % \edef{macrocode} % \end{macro} % -% \begin{macro}{\set@curr@file} +% \begin{macro}{\Gin@set@curr@file} % \begin{macro}{\quote@name} % \changes{v1.3c}{2019/10/08} % {Definitions added for old formats} +% \changes{v1.4e}{2022/03/10} +% {Use \cs{Gin@set@curr@file}, and define it appropriately} +% We have to cope with older formats (rollback as far as 2019-10-01) +% and Plain. Define a minimal \cs{Gin@set@curr@file} first: % \begin{macrocode} -\def\Gin@temp#1{% - \begingroup - \escapechar\m@ne - \xdef\@curr@file{\expandafter\string\csname #1\endcsname}% - \endgroup -} -\ifx\set@curr@file\@Gin@temp - \let\set@curr@file\@undefined -\fi -% \end{macrocode} -% -% \begin{macrocode} -\ifx\set@curr@file\@undefined -\def\set@curr@file#1{% +\def\Gin@set@curr@file#1{% \begingroup \escapechar\m@ne \xdef\@curr@file{\expandafter\string\csname\@firstofone#1\@empty\endcsname}% - \endgroup -} -\def\quote@name#1{"\quote@@name#1\@gobble""} -\def\quote@@name#1"{#1\quote@@name} -\def\unquote@name#1{\quote@@name#1\@gobble"} + \endgroup} +% \end{macrocode} +% Then, if \cs{set@curr@file@nosearch} is undefined, we're before +% 2022-06-01, and if \cs{set@curr@file} is undefined, we're before +% 2019-10-01 (aka Plain, as far as these tests are concerned). Make +% \cs{Gin@set@curr@file} be a copy of the most recent macro: +% \cs{set@curr@file@nosearch} if it exists, and \cs{set@curr@file} +% otherwise. If neither exist, we also need to define +% \cs{quote@name} et~al. +% \begin{macrocode} +\ifx\set@curr@file@nosearch\@undefined + \ifx\set@curr@file\@undefined + \def\quote@name#1{"\quote@@name#1\@gobble""} + \def\quote@@name#1"{#1\quote@@name} + \def\unquote@name#1{\quote@@name#1\@gobble"} + \else + \let\Gin@set@curr@file\set@curr@file + \fi +\else + \let\Gin@set@curr@file\set@curr@file@nosearch \fi % \end{macrocode} % \end{macro} @@ -1114,8 +1120,11 @@ % % \changes{v1.3d}{2019/11/01} % {\cs{curr@name} now unquoted} +% \changes{v1.4e}{2022/03/10} +% {Use \cs{set@curr@file@nosearch} to avoid premature inclusion of +% path from \cs{graphicspath}} % \begin{macrocode} - \set@curr@file{#1}% + \Gin@set@curr@file{#1}% \expandafter\filename@parse\expandafter{\@curr@file}% % \end{macrocode} % If extension is |.gz| tack on to previous extension, eg |.eps.gz| if available. diff --git a/macros/latex/required/graphics/graphics.ins b/macros/latex/required/graphics/graphics.ins index 95e190c9ec..09c37e7c38 100644 --- a/macros/latex/required/graphics/graphics.ins +++ b/macros/latex/required/graphics/graphics.ins @@ -40,4 +40,6 @@ reports for it can be opened at https://latex-project.org/bugs/ \generate{\file{rotating.sty}{\from{rotating.dtx}{package}}} +\generate{\file{mathcolor.ltx}{\from{mathcolor.dtx}{code}}} + \endbatchfile diff --git a/macros/latex/required/graphics/graphics.pdf b/macros/latex/required/graphics/graphics.pdf Binary files differindex a50ff186fd..5cdae79b24 100644 --- a/macros/latex/required/graphics/graphics.pdf +++ b/macros/latex/required/graphics/graphics.pdf diff --git a/macros/latex/required/graphics/graphicx.dtx b/macros/latex/required/graphics/graphicx.dtx index 29e0db5b12..8c20091585 100644 --- a/macros/latex/required/graphics/graphicx.dtx +++ b/macros/latex/required/graphics/graphicx.dtx @@ -2,7 +2,7 @@ % \iffalse % %% graphicx.dtx Copyright (C) 1994 David Carlisle Sebastian Rahtz -%% Copyright (C) 1995-2021 +%% Copyright (C) 1995-2022 LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -211,7 +211,7 @@ % which rotates around the reference point on the baseline, thus % producing a box that is mainly \emph{below} the baseline. % -% \StopEventually{} +% \MaybeStop{} % % % \section{Implementation} diff --git a/macros/latex/required/graphics/graphicx.pdf b/macros/latex/required/graphics/graphicx.pdf Binary files differindex 88ef6488c2..2a02092804 100644 --- a/macros/latex/required/graphics/graphicx.pdf +++ b/macros/latex/required/graphics/graphicx.pdf diff --git a/macros/latex/required/graphics/grfguide.pdf b/macros/latex/required/graphics/grfguide.pdf Binary files differindex 95e7c76295..419ea295ed 100644 --- a/macros/latex/required/graphics/grfguide.pdf +++ b/macros/latex/required/graphics/grfguide.pdf diff --git a/macros/latex/required/graphics/grfguide.tex b/macros/latex/required/graphics/grfguide.tex index 3b679ea382..585e87adc7 100644 --- a/macros/latex/required/graphics/grfguide.tex +++ b/macros/latex/required/graphics/grfguide.tex @@ -243,12 +243,27 @@ to the font commands such as |\textbf|: So the above is essentially equivalent to |{\color|\arg{name}\emph{text}|}|. +\subsection{Using Colours in math formulas} + +While |\color| and to some extent |\textcolor| can be used in +formulas, this is cumbersome, may lead to bad spacing, and in some +situations is simply not possible. For this reason we also introduce +|\mathcolor| which will help in this respect. The basic syntax is: + +\begin{decl} +|\mathcolor|\arg{name}\arg{math} +\end{decl} + +See \texttt{mathcolor.pdf} for details on this command. + + \subsubsection{Using colour specifications directly} \begin{decl} |\color|\oarg{model}\arg{specification}\\ -|\textcolor|\oarg{model}\arg{specification}\arg{text} +|\textcolor|\oarg{model}\arg{specification}\arg{text}\\ +|\mathcolor|\oarg{model}\arg{specification}\arg{math} \end{decl} Normally one would predeclare all the colours used in a package, or in diff --git a/macros/latex/required/graphics/keyval.dtx b/macros/latex/required/graphics/keyval.dtx index 58664b8f03..9fce6267e0 100644 --- a/macros/latex/required/graphics/keyval.dtx +++ b/macros/latex/required/graphics/keyval.dtx @@ -1,7 +1,7 @@ % % \iffalse %% keyval.dtx Copyright (C) 1993 1994 1995 1997 1998 1999 David Carlisle -%% Copyright (C) 2000-2021 David Carlisle, LaTeX Project +%% Copyright (C) 2000-2022 David Carlisle, LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -20,7 +20,7 @@ %<driver> \ProvidesFile{keyval.drv} % \fi % \ProvidesFile{keyval.dtx} - [2014/10/28 v1.15 key=value parser (DPC)] + [2022/05/29 v1.15 key=value parser (DPC)] % % \iffalse %</!plain> @@ -177,7 +177,7 @@ % \section{The Internal Interface} % A declaration of the form:\\ % |\define@key{family}{key}{...}|\\ -% Defines a macro |\KV@prefix@key| with one argument. When used in a +% Defines a macro |\KV@family@key| with one argument. When used in a % keyval list, the macro receives the value as its argument. % % A declaration of the form:\\ @@ -202,7 +202,7 @@ % package do not break styles making use of these `low level' % definitions. % -% \StopEventually{} +% \MaybeStop{} % % \section{The Macros} % diff --git a/macros/latex/required/graphics/keyval.pdf b/macros/latex/required/graphics/keyval.pdf Binary files differindex 8746550d0e..5b1bd6a06e 100644 --- a/macros/latex/required/graphics/keyval.pdf +++ b/macros/latex/required/graphics/keyval.pdf diff --git a/macros/latex/required/graphics/lscape.dtx b/macros/latex/required/graphics/lscape.dtx index 969c94ae7a..d173af6468 100644 --- a/macros/latex/required/graphics/lscape.dtx +++ b/macros/latex/required/graphics/lscape.dtx @@ -2,7 +2,7 @@ % \iffalse % %% lscape.dtx Copyright (C) 1994 1999-2000 David Carlisle -%% Copyright (C) 2000-2021 +%% Copyright (C) 2000-2022 LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -54,7 +54,7 @@ % page before the page head and foot are added. % % -% \StopEventually{\end{landscape}} +% \MaybeStop{\end{landscape}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \changes{v1.00}{1992/04/28}{Initial release} diff --git a/macros/latex/required/graphics/lscape.pdf b/macros/latex/required/graphics/lscape.pdf Binary files differindex 178ffb231d..cc6e113a01 100644 --- a/macros/latex/required/graphics/lscape.pdf +++ b/macros/latex/required/graphics/lscape.pdf diff --git a/macros/latex/required/graphics/mathcolor.dtx b/macros/latex/required/graphics/mathcolor.dtx new file mode 100644 index 0000000000..2341e71e28 --- /dev/null +++ b/macros/latex/required/graphics/mathcolor.dtx @@ -0,0 +1,431 @@ +% \iffalse meta-comment +% +%% File: mathcolor.dtx (C) Copyright 2021-2022 +% Frank Mittelbach, LaTeX Team +% +% It may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is in the file +% +% https://www.latex-project.org/lppl.txt +% +% +%%% From File: mathcolor.dtx +% +% \begin{macrocode} +\def\mathcolorversion{v1.0b} +\def\mathcolordate{2022/01/28} +% \end{macrocode} +%<*driver> +\documentclass{l3doc} + +%\makeatletter \input{mathcolor.ltx} \makeatother + +\usepackage{color} + +% Fixing footnotes in functions and variables: this should be in l3doc! + +\newcommand\fixfootnote[2]{\footnotemark + \AddToHookNext{env/#1/after}{\footnotetext{#2}}} +\AddToHook{env/function/begin}{\def\footnote{\fixfootnote{function}}} +\AddToHook{env/variable/begin}{\def\footnote{\fixfootnote{variable}}} + +\EnableCrossrefs +\CodelineIndex +\begin{document} + \DocInput{mathcolor.dtx} +\end{document} +%</driver> +% +% \fi + + + +% +% \title{Providing color in math\thanks{This file has version +% \mathcolorversion\ dated \mathcolordate, \copyright\ \LaTeX\ +% Project.}} +% \author{Frank Mittelbach} +% +% \maketitle +% +% +% \section{Introduction} +% +% It is possible to use the \cs{color} command in math formulas but +% doing that has a number of restrictions and often leads to rather +% unreadable input. For example, to color the summation sign in red +% in the following formula +% \[ +% X = \color{red} \sum_{{\color{black} i=1}}^{{\color{black} n}} \color{black} x_i +% \] +% A total of four color commands and a number of seemingly +% unnecessary extra braces in the sub and superscript are needed: +%\begin{verbatim} +% \[ X = \color{red} \sum +% _{{\color{black} i=1}} % without {{ the superscript is misplaced +% ^{{\color{black} n}} % without {{ the \sum is black +% \color{black} % without the x_i is red +% x_i \] +%\end{verbatim} +% While this is ugly but at least works, other things are simply +% impossible, e.g., +% \[ \left\{ \frac{1}{2} \mathcolor{red}{\right\}} \] +% are not achievable at all because of the fact that \cs{left} and +% \cs{right} form a group. Thus, a \cs{color} command immediately +% before the \cs{right} has no effect and \verb=\}= remains black. +% Putting the color change before the \cs{left} and then resetting +% the color inside would work if you want to color both braces, but +% the above combination or the attempt to color only the left brace +% fails always. +% +% Using \cs{textcolor} in formulas appears to work on first glance, +% but it produces spacing problems that are not easy to overcome +% either, because it generates a single \cs{mathord} and no +% longer reflects its input, thus +% \verb/\[ a = b \textcolor{red}{\neq} c \]/ +% produces +% \[ a = b \textcolor{red}{\neq} c \] +% This is a case one could mend by wrapping the +% \cs{textcolor} and its arguments in a \cs{mathrel}, but even when +% that is possible, the resulting formula source is difficult to +% maintain and in other situations the solutions are even more +% complicated or there is no solution at all. +% +% We therefore offer now a dedicated math coloring command named +% \cs{mathcolor}. +% +% \begin{function}{\mathcolor} +% \begin{syntax} +% \cs{mathcolor} \oarg{model} \Arg{color-spec} \Arg{math material} +% \end{syntax} +% It has the same arguments as \cs{textcolor} but is intended for +% use in formulas. The command does not generate a group and the +% \meta{math material} retains its math atom states and it correctly +% handles sub and superscripts that follow. +% \end{function} +% +% The command can also be used to color a single opening or closing +% symbol, e.g., the correct input to our earlier example is +%\begin{verbatim} +% \[ \left\{ \frac{1}{2} \mathcolor{red}{\right\}} \] +%\end{verbatim} +% which is how it was produced. +% +% If you attempt to color large operators that use explicit +% \cs{limits}, \cs{nolimits}, or \cs{displaylimits}, then these +% limit controls need to immediately follow the operator. However, +% \cs{mathcolor} is written in a way that it is possible write +%\begin{verbatim} +% \[ \mathcolor{red}{\int}\limits_0^1 \textrm{ or } +% \mathcolor{red}{\int\limits}_0^1 \] +%\end{verbatim} +% and achieve the same effect: +% \[ \mathcolor{red}{\int}\limits_0^1 \textrm{ or } +% \mathcolor{red}{\int\limits}_0^1 \] + +% +% +% \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex } +% +% +% \section{The Implementation} +% +% The code is called inside of the \pkg{color} or \pkg{xcolor} +% packages, so \texttt{@} is already a letter, but the +% coding here is done in the L3 programming layer, so we need to +% activate that. But first we check if this file was loaded before, +% e.g., when both \pkg{color} and \pkg{xcolor} are in the preamble +% and in that case we stop immediately. +% \begin{macrocode} +%<*code> +\ifcsname mathcolor\endcsname \endinput \fi +% \end{macrocode} +% +% \begin{macrocode} +\ExplSyntaxOn +%<@@=mathcolor> +% \end{macrocode} +% +% \begin{macro}{\g_@@_seq} +% We need to keep our own stack of color commands, so we allocate a +% sequence for that. +% \begin{macrocode} +\seq_new:N \g_@@_seq +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\mathcolor} +% The document-level command which expects a color (if unnamed then +% the optional argument is the model) and colors the content of the +% second argument (like \cs{textcolor}, but without spacing +% problems in math). +% \begin{macrocode} +\DeclareDocumentCommand \mathcolor { o m m } { +% \end{macrocode} +% The \cs{mathcolor} is only supported in math mode because in text +% mode it has problems scanning away a space after it, for example. +% We therefore raise an error if it executes +% anywhere else. The \LaTeXe{} error command is a +% bit strangely named, because in the kernel it is only used for +% math alphabets, but the message it gives is fine. +% \changes{v1.0b}{2022/01/28}{Restrict command to math mode} +% \begin{macrocode} + \mode_if_math:F { \non@alpherr {\mathcolor\space} } +% \end{macrocode} +% First real action is to save the current color value on a stack +% (needed if the command is nested or contains some further color +% changes with \cs{color} inside). +% \begin{macrocode} + \seq_gpush:No \g_@@_seq \current@color +% \end{macrocode} +% Then we switch to the new color, but we do not want to reset the +% color after the group (which is done by \cs{color} using +% \cs{aftergroup}\cs{reset@color}). The best solution here would be +% if the color packages would provide a command doing just the +% color switching, but for now we simply undo that part by pushing +% \cs{use_none:n} which gobbles the \cs{reset@color} added by +% \cs{color} with \cs{aftergroup}. +% \begin{macrocode} + \group_insert_after:N \use_none:n +% \end{macrocode} +% Switching the color is also slightly suboptimal, because +% depending on whether or not we have a \meta{model} argument, we +% have to call \cs{color} with or without the optional argument. But +% going low-level here is not an option as we need to support +% different color packages and their internals are not identical. +% \begin{macrocode} + \IfValueTF{#1} { \color[#1]{#2} }{ \color{#2} } +% \end{macrocode} +% Then comes the math material we want to see colored: +% \begin{macrocode} + #3 +% \end{macrocode} +% After that we need to reset the color ourselves (without a group +% that does it for us), i.e., popping the saved color from our +% stack, but there are some twists to that so we do this in a +% separate command (which in fact needs to be called several times, +% so inlining the code wouldn't be possible. +% \begin{macrocode} + \@@_scan_for_scripts:w +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@@_scan_for_scripts:w} +% The complication when changing the color back is due to the fact +% that the \cs{mathcolor} may be followed by \verb=^= or \verb=_= +% or the hidden superscript \texttt{'} and its argument may end in a +% \cs{mathop} in which case the sub and superscripts may be +% attached as \cs{limits} instead of after the material. All cases +% need separate treatment. +% \begin{macrocode} +\cs_new_protected:Npn \@@_scan_for_scripts:w { +% \end{macrocode} +% We therefore first parse for a \cs{c_math_subscript_token} +% ignoring (dropping) any spaces and \cs{relax} as \TeX{} would +% do. We do this with expansion so that hidden sub or superscripts +% in macros are still found as long as the macros are expandable. +% \begin{macrocode} + \@@_peek_catcode_ignore_filler_expand:NTF \c_math_subscript_token +% \end{macrocode} +% If we found that character we call a function that handles sub or +% superscripts. +% \begin{macrocode} + { \@@_handle_scripts:Nw } +% \end{macrocode} +% Otherwise check if this token we peeked at (which is now stored +% in \cs{l_peek_token} is a superscript token. +% \begin{macrocode} + { \token_if_math_superscript:NTF \l_peek_token +% \end{macrocode} +% If found we call the sub/superscript handler. +% \begin{macrocode} + { \@@_handle_scripts:Nw } +% \end{macrocode} +% Otherwise we check if it was any of the limit operation +% primitives. If that is the case, e.g., if we have a situation +% such as +%\begin{verbatim} +% \mathcolor{red}{\int}\limits_1 +%\end{verbatim} +% we have to move it directly after the \cs{int} to ensure there +% is no color reset between the operator and the \cs{limits} command. +% \begin{macrocode} + { \token_case_meaning:NnTF \l_peek_token + { + \limits { \limits } + \nolimits { \nolimits } + \displaylimits { \displaylimits } + } +% \end{macrocode} +% Once that is done, we have to get rid of the token we peeked at +% and then restart scanning for sub or superscripts. Given that +% \cs{@@_scan_for_scripts:w} expands while scanning the simplest +% solution is to add \cs{use_none:n} in front of the peeked at token. +% \begin{macrocode} + { \@@_scan_for_scripts:w \use_none:n } +% \end{macrocode} +% If it was one of these we look for a \texttt{'} and if found remove it and +% replace it by its expansion. The reason we have to do this (and +% not rely on the earlier peeking to expand for us is the fact +% that \texttt{'} is only ``math active'' and that doesn't expand +% under \cs{expanded} or \cs{expandafter}. +% \begin{macrocode} + { \peek_meaning_remove:NTF ' + { \@@_handle_scripts:Nw ^\c_group_begin_token \prim@s } +% \end{macrocode} +% If it is anything else we finish off which means we reset the +% color (because we prevented that before to happen automatically +% after the next group) and pop the color stack setting \cs{current@color}. +% \begin{macrocode} + { \reset@color + \seq_gpop:NN \g_@@_seq \current@color + } + } + } + } +} +% \end{macrocode} +% \end{macro} + + + +% \begin{macro}{\@@_handle_scripts:Nw} +% The tricky part of handling sub and superscripts is that we have +% to reset color to the one that is on the stack but reset it back +% to what it was before to allow for cases like +%\begin{verbatim} +% \[ \mathcolor{red}{a+\sum}_{i=1}^n \] +%\end{verbatim} +% Here, \TeX{} constructs a \cs{vbox} stacking subscript, summation +% sign, and superscript. So technically the superscript comes first +% and the \cs{sum} that should get colored red is the middle. +% \begin{macrocode} +\cs_new_protected:Npn \@@_handle_scripts:Nw #1 { +% \end{macrocode} +% The argument is either \verb=^= or \verb=_=, so we execute it and +% explicitly open two \verb={= groups. We need two because color +% resets are always done after a group, so the first group is for +% script material (in case it was just something like \verb=_i=) +% and the second is needed for the color reset to keep it within +% the super or subscript. If that reset would happen after it then +% the color \cs{special} would interfere with \TeX{} math spacing. +% \begin{macrocode} + #1 \c_group_begin_token \c_group_begin_token +% \end{macrocode} +% Now it is time to change the color back to the one on the stack. +% \begin{macrocode} + \seq_get:NN \g_@@_seq \current@color + \set@color +% \end{macrocode} +% \cs{set@color} adds \cs{aftergroup}\cs{reset@color}. We now a add +% bit more so that the code executed after the current (inner) group +% looks like this: +%\begin{verbatim} +% \reset@color } \@@_scan_for_scripts:w +%\end{verbatim} +% The \cs{_@@_scan_for_scripts:w} then retakes control and initiates +% parsing for another sub or superscript. +% \begin{macrocode} + \group_insert_after:N \c_group_end_token + \group_insert_after:N \@@_scan_for_scripts:w +% \end{macrocode} +% Before we give control to \TeX{} to process the sub or +% superscript some final adjustment is necessary: if the input was +% \verb=^{...}= then we have one \verb={= too many, because we +% already supplied the outer one already. In that case we drop +% it. Otherwise we have an unbraced single token sub or superscript +% which means we are missing a closing \verb=}= at the end and need +% to account for that: this is done in \cs{_@@_handle_unbraced_script:N}. +% \begin{macrocode} + \@@_peek_catcode_ignore_filler_expand:NTF \c_group_begin_token + { \peek_catcode_remove:NT \c_group_begin_token { } } + { \@@_handle_unbraced_script:N } + }% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\@@_handle_unbraced_script:N} +% All we have to do here is to add the final closing brace. +% \begin{macrocode} +\cs_new_protected:Npn \@@_handle_unbraced_script:N #1 { + #1 \c_group_end_token } +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{Utility function for the peek module} +% +% This peek is expanding and ignores spaces and \cs{relax} (even +% though the name doesn't say so) +% but \cs{relax} is usually allowed in such places where we so it +% may not be bad to have it in this way in general --- maybe this +% should move to expl3 peek functions (or otherwise the naming +% should perhaps be adjusted). +% +% +% \begin{macrocode} +\tl_new:N \l_@@_peek_tmp_tl +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_peek_catcode_ignore_filler_expand:NTF #1#2#3 + { + \tl_set:Nn \l_@@_peek_tmp_tl + { \token_if_eq_catcode:NNTF \l_peek_token #1 {#2} {#3} } + \@@_peek_expand:w + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_peek_expand:w + { + \exp_after:wN \peek_catcode_remove:NTF + \exp_after:wN \c_space_token + \exp_after:wN \@@_peek_test_expand:w + \exp_after:wN \@@_peek_test_relax:w + \exp:w \exp_end_continue_f:w + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_peek_test_expand:w + { + \token_if_expandable:NTF \l_peek_token + { \@@_peek_expand:w } + { \l_@@_peek_tmp_tl } + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_peek_test_relax:w + { + \peek_meaning_remove:NTF \scan_stop: + { \@@_peek_expand:w } + { \@@_peek_test_expand:w } + } +% \end{macrocode} +% +% \begin{macrocode} +%<@@=> +% \end{macrocode} +% +% \begin{macrocode} +\ExplSyntaxOff +%</code> +% \end{macrocode} +% +% \Finale +% +% + +%%%%%%%%%%%%%%%% +\endinput +%%%%%%%%%%%%%%%% + diff --git a/macros/latex/required/graphics/mathcolor.pdf b/macros/latex/required/graphics/mathcolor.pdf Binary files differnew file mode 100644 index 0000000000..1940791f90 --- /dev/null +++ b/macros/latex/required/graphics/mathcolor.pdf diff --git a/macros/latex/required/graphics/rotating.dtx b/macros/latex/required/graphics/rotating.dtx index c6db1273a4..ac64086082 100644 --- a/macros/latex/required/graphics/rotating.dtx +++ b/macros/latex/required/graphics/rotating.dtx @@ -5,7 +5,7 @@ % File: rotating.dtx %% Copyright (C) 1995-1999 Sebastian Rahtz and Leonor Barroca %% Copyright (C) 2001-2003,2007-2009 Robin Fairbairns -%% Copyright (C) 2016-2021 LaTeX Project +%% Copyright (C) 2016-2022 LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. % @@ -157,7 +157,7 @@ % top does % \end{tabular} % -% \StopEventually{} +% \MaybeStop{} % % \section{Setup} % Now we present the documented code. First, package options. diff --git a/macros/latex/required/graphics/rotating.pdf b/macros/latex/required/graphics/rotating.pdf Binary files differindex 94fab64ec2..3352fd8fd1 100644 --- a/macros/latex/required/graphics/rotating.pdf +++ b/macros/latex/required/graphics/rotating.pdf diff --git a/macros/latex/required/graphics/rotex.pdf b/macros/latex/required/graphics/rotex.pdf Binary files differindex 3ca96254af..6027e6cb08 100644 --- a/macros/latex/required/graphics/rotex.pdf +++ b/macros/latex/required/graphics/rotex.pdf diff --git a/macros/latex/required/graphics/trig.dtx b/macros/latex/required/graphics/trig.dtx index 533f3b0648..4b673494af 100644 --- a/macros/latex/required/graphics/trig.dtx +++ b/macros/latex/required/graphics/trig.dtx @@ -1,6 +1,6 @@ % \iffalse %% File: trig.dtx Copyright (C) 1993-1999 David Carlisle -%% Copyright (C) 2000-2021 +%% Copyright (C) 2000-2022 LaTeX Project %% The LaTeX Project and any individual authors listed elsewhere %% in this file. %% @@ -78,7 +78,7 @@ % |\dimen2=\UseSin{30}\dimen0|. Which means that |\UseSin| must % \emph{expand} to a \meta{factor}. % -% \StopEventually{} +% \MaybeStop{} % % \section{The Macros} % diff --git a/macros/latex/required/graphics/trig.pdf b/macros/latex/required/graphics/trig.pdf Binary files differindex cc9bbe3bcf..8521167f77 100644 --- a/macros/latex/required/graphics/trig.pdf +++ b/macros/latex/required/graphics/trig.pdf |