diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/overarrows/README.md | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/overarrows/overarrows-doc.sty | 41 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/overarrows/overarrows.pdf | bin | 554421 -> 597885 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/overarrows/overarrows.dtx | 1142 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/overarrows/overarrows.sty | 456 |
5 files changed, 1119 insertions, 524 deletions
diff --git a/Master/texmf-dist/doc/latex/overarrows/README.md b/Master/texmf-dist/doc/latex/overarrows/README.md index f2139d64993..a70fd1601cb 100644 --- a/Master/texmf-dist/doc/latex/overarrows/README.md +++ b/Master/texmf-dist/doc/latex/overarrows/README.md @@ -13,11 +13,11 @@ Julien Labbé <Julien.Labbe@univ-grenoble-alpes.fr> Université Grenoble-Alpes ## Repository -https://gricad-gitlab.univ-grenoble-alpes.fr/labbeju/latex-packages/-/tree/main/overarrows +https://github.com/julienlabbe/latex-packages/tree/main/overarrows ## Licence -Copyright (C) 2023 by Julien Labbé +Copyright (C) 2023-2024 by Julien Labbé This file 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 diff --git a/Master/texmf-dist/doc/latex/overarrows/overarrows-doc.sty b/Master/texmf-dist/doc/latex/overarrows/overarrows-doc.sty index df8e30f7930..9fc29228d18 100644 --- a/Master/texmf-dist/doc/latex/overarrows/overarrows-doc.sty +++ b/Master/texmf-dist/doc/latex/overarrows/overarrows-doc.sty @@ -32,6 +32,7 @@ \lstdefinestyle{lstovardoc}{% language = [LaTeX]TeX, columns = flexible, + keepspaces = true, keywordstyle = {\bfseries\color{ovar_darkblue}}, texcsstyle = *{\bfseries\color{ovar_darkblue}}, commentstyle = {\color{gray}}, @@ -126,7 +127,7 @@ actual '=' name=macrocode, firstnumber=auto, style = lstovarcode, - showlines=false, + showlines = false, texcs = [2]{% commands DeclareOverArrowCommand, ProvideOverArrowCommand,% NewOverArrowCommand, RenewOverArrowCommand,% @@ -147,8 +148,9 @@ actual '=' indexstyle = [3]\indexlength,% texcs = [4]{% internal macros ovar@rightarrow, ovar@leftarrow, ifovar@option@oldarrows@, - ifovar@option@esvect@, ifovar@option@tikz@, ifovar@option@pstarrows@, - ifovar@detectsubscripts@, ifovar@option@debug@, + ifovar@option@esvect@, ifovar@option@tikz@, ifovar@option@pstricks@, + ifovar@option@pstarrows@, ifovar@detectsubscripts@, + ifovar@option@subother@, ifovar@option@subactive@, ifovar@option@debug@, ifovar@option@overrightarrow@, ifovar@option@underrightarrow@, ifovar@option@overleftarrow@, ifovar@option@underleftarrow@, ifovar@option@overleftrightarrow@, ifovar@option@underleftrightarrow@, @@ -156,26 +158,29 @@ actual '=' ifovar@option@overrightharpoondown@, ifovar@option@underrightharpoondown@, ifovar@option@overleftharpoonup@, ifovar@option@underleftharpoonup@, ifovar@option@overleftharpoondown@, ifovar@option@underleftharpoondown@, - ifovar@option@overbar@, ifovar@option@underbar@, ovar@set, ovar@length@min, + ifovar@option@overbar@, ifovar@option@underbar@, ovar@auto@middle, + ovar@auto@trim@middle, ovar@subcmd, ovar@set, ovar@length@min, ovar@before@arrow, ovar@after@arrow, ovar@macro@stack, ovar@macro@arrow, - ovar@set@, ovar@shift@left, ovar@shift@right, ovar@stack@fill, - ovar@stackunder@fill, ovar@stack@lens, ovar@stackunder@lens, - ovar@macro@arrowfill, ovar@arrow@fill, ovar@arrow@start, ovar@trim@start, - ovar@trim@middle, ovar@arrow@middle, ovar@trim@end, ovar@arrow@end, - ovar@tikz@command, ovar@tikz@pathoptions, ovar@tikz@path, - ovar@tikz@options, ovar@picture@geometry, ovar@picture@linethickness, - ovar@picture@command, ovar@extralength, ovar@tempdim, ovar@set@arrowlength, - ovar@set@arrowthickness, ovar@stackover@@, ovar@stackunder@@, - ovar@stackover@, ovar@stackunder@, ovar@stackover@fill, - ovar@stackover@lens, ovar@set@common, ovar@starversion, - ovar@testmathstyles, ovar@row@teststyle,% - ifovar@option@subother@,ifovar@option@subactive@,ovar@subcmd,ovar@testkerning,% + ovar@shift@left, ovar@shift@right, ovar@stack@fill, ovar@stackunder@fill, + ovar@stack@lens, ovar@stackunder@lens, ovar@macro@arrowfill, + ovar@arrow@fill, ovar@arrow@start, ovar@trim@start, ovar@trim@middle, + ovar@arrow@middle, ovar@trim@end, ovar@arrow@end, ovar@tikz@command, + ovar@tikz@pathoptions, ovar@tikz@path, ovar@tikz@options, + ovar@pstricks@geometry, ovar@pstricks@linethickness, ovar@pstricks@psset, + ovar@pstricks@command, ovar@picture@geometry, ovar@picture@linethickness, + ovar@picture@command, ovar@tempdim, ovar@set@arrowlength, + ovar@set@arrowthickness, ovar@set@arrowthickness@UM@lua, + ovar@rulethickness@fontdimen, ovar@rulethickness@family, ovar@stackover@@, + ovar@stackunder@@, ovar@stackover@, ovar@stackunder@, ovar@stackover@fill, + ovar@stackover@lens, ovar@cmdname@processor, ovar@set@common, + ovar@starversion, ovar@tempbox, ovar@testmathstyles, ovar@row@teststyle, + ovar@testkerning% }, index = [4][texcs4],% indexstyle = [4]\indexmacrointernal,% moretexcs = [5]{% other macros - Relbar, relbareda, relbaredd, rightarrow, Rightarrow, varleftarrow, - varrightarrow, twoheadrightarrow,% + relbar, Relbar, relbareda, relbaredd, harrowextender, rightarrow, + Rightarrow, varleftarrow, varrightarrow, twoheadrightarrow,% }, } \csname\@lst @SetFirstNumber\endcsname diff --git a/Master/texmf-dist/doc/latex/overarrows/overarrows.pdf b/Master/texmf-dist/doc/latex/overarrows/overarrows.pdf Binary files differindex 7203b11bb3d..701f3ec02fa 100644 --- a/Master/texmf-dist/doc/latex/overarrows/overarrows.pdf +++ b/Master/texmf-dist/doc/latex/overarrows/overarrows.pdf diff --git a/Master/texmf-dist/source/latex/overarrows/overarrows.dtx b/Master/texmf-dist/source/latex/overarrows/overarrows.dtx index 419593f5775..ff63a958c39 100644 --- a/Master/texmf-dist/source/latex/overarrows/overarrows.dtx +++ b/Master/texmf-dist/source/latex/overarrows/overarrows.dtx @@ -16,14 +16,17 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{overarrows} %<*package> -[2023/02/15 v1.1 Custom extensible arrows over math expressions] +[2024/07/11 v1.2 Custom extensible arrows over math expressions] %</package> % %<*driver> \documentclass[nohyperref]{ltxdoc} +\usepackage{metalogo} +\usepackage{enumitem} +\usepackage{array} \usepackage{overarrows-doc} %^^A defined at end of this file, with guard <docstyle> -\usepackage[old-arrows, esvect, tikz, pstarrows, allcommands]{overarrows} +\usepackage[old-arrows, esvect, tikz, pstricks, pstarrows, allcommands]{overarrows} \EnableCrossrefs \PageIndex @@ -36,8 +39,8 @@ %% Arrows used in doc \usepackage{amssymb}% for \twoheadrightarrow -\NewOverArrowCommand{amsoverrightarrow}{amsmath=strict, end={\rightarrow}} -\NewOverArrowCommand{overrightnewarrow}{% +\NewOverArrowCommand{\amsoverrightarrow}{amsmath=strict, end={\rightarrow}} +\NewOverArrowCommand{\overrightnewarrow}{% amsmath, middle config=relbar, end=\rightarrow, right arrow, } @@ -49,22 +52,22 @@ \DeclareMathSymbol{\fldrf}{\mathrel}{esvector}{'026} \DeclareMathSymbol{\fldrg}{\mathrel}{esvector}{'027} \DeclareMathSymbol{\fldrh}{\mathrel}{esvector}{'030} -\NewOverArrowCommand{esveca}{esvect=strict, end={\fldra}} -\NewOverArrowCommand{esvecb}{esvect=strict, end={\fldrb}} -\NewOverArrowCommand{esvecc}{esvect=strict, end={\fldrc}} -\NewOverArrowCommand{esvecd}{esvect=strict, end={\fldrd}} -\NewOverArrowCommand{esvece}{esvect=strict, end={\fldre}} -\NewOverArrowCommand{esvecg}{esvect=strict, end={\fldrg}} -\NewOverArrowCommand{esvech}{esvect=strict, end={\fldrh}} -\NewOverArrowCommand{vva}{esvect, middle config=auto, end=\fldra} -\NewOverArrowCommand{esvecf}{esvect=strict, end={\fldrf}} -\NewOverArrowCommand{vvb}{esvect, middle config=auto, end=\fldrb} -\NewOverArrowCommand{vvc}{esvect, middle config=auto, end=\fldrc} -\NewOverArrowCommand{vvd}{esvect, middle config=auto, end=\fldrd} -\NewOverArrowCommand{vve}{esvect, middle config=auto, end=\fldre} -\NewOverArrowCommand{vvf}{esvect, middle config=auto, end=\fldrf} -\NewOverArrowCommand{vvg}{esvect, middle config=auto, end=\fldrg} -\NewOverArrowCommand{vvh}{esvect, middle config=auto, end=\fldrh} +\NewOverArrowCommand{\esveca}{esvect=strict, end={\fldra}} +\NewOverArrowCommand{\esvecb}{esvect=strict, end={\fldrb}} +\NewOverArrowCommand{\esvecc}{esvect=strict, end={\fldrc}} +\NewOverArrowCommand{\esvecd}{esvect=strict, end={\fldrd}} +\NewOverArrowCommand{\esvece}{esvect=strict, end={\fldre}} +\NewOverArrowCommand{\esvecg}{esvect=strict, end={\fldrg}} +\NewOverArrowCommand{\esvech}{esvect=strict, end={\fldrh}} +\NewOverArrowCommand{\vva}{esvect, middle config=auto, end=\fldra} +\NewOverArrowCommand{\esvecf}{esvect=strict, end={\fldrf}} +\NewOverArrowCommand{\vvb}{esvect, middle config=auto, end=\fldrb} +\NewOverArrowCommand{\vvc}{esvect, middle config=auto, end=\fldrc} +\NewOverArrowCommand{\vvd}{esvect, middle config=auto, end=\fldrd} +\NewOverArrowCommand{\vve}{esvect, middle config=auto, end=\fldre} +\NewOverArrowCommand{\vvf}{esvect, middle config=auto, end=\fldrf} +\NewOverArrowCommand{\vvg}{esvect, middle config=auto, end=\fldrg} +\NewOverArrowCommand{\vvh}{esvect, middle config=auto, end=\fldrh} \makeatletter \newcommand{\unsetoldarrows}{ @@ -94,7 +97,7 @@ % % \title{The \pkg{overarrows} package\thanks{This document % corresponds to \pkg{overarrows}~\fileversion, dated \filedate.}} -% \author{Julien Labb\'e \\ \texttt{Julien.Labbe@univ-grenoble-alpes.fr}} +% \author{Julien Labb\'e \\ {\small \url{https://github.com/julienlabbe/latex-packages}}} % % \maketitle % @@ -111,7 +114,7 @@ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{overrightharpoon}{% +\NewOverArrowCommand{\overrightharpoon}{% end=\rightharpoonup } @@ -188,9 +191,9 @@ % % The \pkg{overarrows} package was primitively written for vectors, but in % a highly customisable way. It can be used to define a large variety of arrows, -% using math symbols, or PGF/TikZ commands. It's also possible to create -% commands that draw the arrows under. Some predefined commands are provided, -% giving\footnotemark{}, for arrow over: +% using math symbols, or drawing commands from PGF/TikZ or PSTricks. It's also +% possible to create commands that draw the arrows under. Some predefined +% commands are provided, giving\footnotemark{}, for arrow over: % \footnotetext{Displayed here with the \refOpt{old-arrows} option.} % \begin{align*} % \overrightarrow{\alpha+\beta} @@ -222,34 +225,42 @@ % above\footnotemark{}. For this second convention, \TeX/\LaTeX provides the % command \cs{vec}, which accents its content (using the \cs{mathaccent} % command) with the character~\symb{\mathchar "017E\relax} -% (\cs{mathchar}|"017E| in Computer Modern font). -% But \symb{\mathchar "017E\relax} isn't extensible, and gives: $\vec{v}$, -% $\vec{AB}$ or $\vec{\text{grad}}$ (there's no command \cs{widevec} analogous -% to \cs{widehat}). +% (\cs{mathchar}|"017E| in Computer Modern font). But \symb{\mathchar +% "017E\relax} isn't extensible\footnotemark{}, and gives: $\vec{v}$, $\vec{AB}$ +% or $\vec{\text{grad}}$ (there's no command \cs{widevec} analogous to +% \cs{widehat}). % +% \addtocounter{footnote}{-2}%^^A two footnotemarks +% +% \stepcounter{footnote} % \footnotetext{See, for example: International Organization for % Standardization. (2019). \emph{Quantities and units -- Part 2: Mathematics} % (ISO Standard No. 80000-2:2019). % \url{https://www.iso.org/standard/64973.html}.} % +% \stepcounter{footnote} +% \footnotetext{In fact, with the unicode engines \LuaTeX{} and \XeTeX{}, the +% command \cs{Umathaccent} can now define extensible accents. This is used by +% the \pkg{unicode-math} package, which also set the arrows displayed by \cs{vec} +% and \cs{overrightarrow} in a coherent manner.} +% % An extensible alternative is given by the command \cs{overrightarrow}, % available in \TeX/\LaTeX, and which is redefined by the commonly used % \pkg{amsmath} package. But its arrow, built with the \cs{rightarrow} symbol -% \symb{\rightarrow}, is too large with the default \emph{Computer Modern} font: -% $\amsoverrightarrow{AB}$. Another alternative is the \pkg{esvect} package, -% which provides the \cs{vv} command and a set of custom arrows: $\esveca{AB}$, -% $\esvecb{AB}$, $\esvecc{AB}$, $\esvecd{AB}$, $\esvece{AB}$, $\esvecf{AB}$, -% $\esvecg{AB}$, $\esvech{AB}$. +% \symb{\rightarrow}, is too large, using the default \emph{Computer Modern} +% font: $\amsoverrightarrow{AB}$. Another alternative is the \pkg{esvect} +% package, which provides the \cs{vv} command and a set of custom arrows: +% $\esveca{AB}$, $\esvecb{AB}$, $\esvecc{AB}$, $\esvecd{AB}$, $\esvece{AB}$, +% $\esvecf{AB}$, $\esvecg{AB}$, $\esvech{AB}$. % % \subsection{Stack and arrow macros} % % It's worth looking at the definition of \pkg{amsmath} \cs{overrightarrow} -% command: -% \iffalse +% command: \iffalse %<*example> % \fi \begin{dispListing} - \long macro:->\mathpalette {\overarrow@ \rightarrowfill@ } +\long macro:->\mathpalette {\overarrow@ \rightarrowfill@ } \end{dispListing} % \iffalse %</example> @@ -314,7 +325,7 @@ % The \pkg{overarrows} package also provides an alternative mechanism. % When used, the length \cs{overarrowlength} is set, according to the arrow % command content, and can be employed, for example, to draw arrows using -% PGF/TikZ or the \LaTeX{} picture environment. +% PGF/TikZ, PSTricks or the \LaTeX{} picture environment. % % \section{Quick start} % @@ -382,14 +393,13 @@ % \subsection{Commands creation} % % Commands are created with \refCom{NewOverArrowCommand}. This macro take two -% mandatory arguments : the name of the command (without backslash), and the -% arrow configuration as comma-separated list of key-values. By default, a right -% arrow is set: +% mandatory arguments : the name of the command and the arrow configuration as +% comma-separated list of key-values. By default, a right arrow is set: % \iffalse %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{myovercmd}{} +\NewOverArrowCommand{\myovercmd}{} $\myovercmd{test}$ \end{dispExample} % \iffalse @@ -417,7 +427,7 @@ $ v_{sub} \qquad \myovercmd{v}_{sub} \qquad \myovercmd*{v}_{sub} $ %<*example> % \fi \begin{dispListing} -\NewOverArrowCommand{overhooktwoheadrightarrow}{% +\NewOverArrowCommand{\overhooktwoheadrightarrow}{% start=\lhook, end=\twoheadrightarrow, } \end{dispListing} @@ -436,12 +446,12 @@ $ v_{sub} \qquad \myovercmd{v}_{sub} \qquad \myovercmd*{v}_{sub} $ % \iffalse %</example> % \fi -% With the previous definition, the result of the command +% But with the previous definition, the result of the command % \cs{overhooktwoheadrightarrow} is faulty: % \iffalse %<*example> % \fi -\NewOverArrowCommand{overhooktwoheadrightarrow}{% +\NewOverArrowCommand{\overhooktwoheadrightarrow}{% start=\lhook, end=\twoheadrightarrow, } \begin{dispExample} @@ -459,7 +469,7 @@ $ \overhooktwoheadrightarrow{v} \qquad \overhooktwoheadrightarrow{AB} $ % \fi \csundef{overhooktwoheadrightarrow} \begin{dispExample} -\NewOverArrowCommand{overhooktwoheadrightarrow}{% +\NewOverArrowCommand{\overhooktwoheadrightarrow}{% start=\lhook, end=\twoheadrightarrow, trim start=1.5, trim end=2, } @@ -474,16 +484,18 @@ $ \overhooktwoheadrightarrow{v} \qquad \overhooktwoheadrightarrow{AB} $ % If the math font differs from the default \emph{Computer Modern}, the central % part of the arrow may have inappropriate position or line width. This is % because the default symbol used for the arrow line is \cs{relbareda} -% \symb{\relbareda} from the \pkg{esvect} package. If needed, try to set the -% \refKey{middle} key with the symbol \cs{relbar} \symb{\relbar}. The trimming -% should also be adapted: +% \symb{\relbareda} from the \pkg{esvect} package\footnote{Except if the +% \pkg{unicode-math} package is used with a math font that provides the +% \cs{harrowextender} symbol (see the \refKey*{middle config}|=auto| key).}. +% If needed, try to set the \refKey{middle} key with the symbol \cs{relbar} +% \symb{\relbar}. The trimming should also be adapted: % \iffalse %<*example> % \fi \csundef{overhooktwoheadrightarrow} \begin{dispExample} -\NewOverArrowCommand{overhooktwoheadrightarrow}{% - start=\lhook, end=\twoheadrightarrow, middle=\relbar, % +\NewOverArrowCommand{\overhooktwoheadrightarrow}{% + start=\lhook, end=\twoheadrightarrow, middle=\relbar, trim start=0, trim end=3, trim middle=5, } $ \overhooktwoheadrightarrow{v} \qquad \overhooktwoheadrightarrow{AB} $ @@ -500,7 +512,7 @@ $ \overhooktwoheadrightarrow{v} \qquad \overhooktwoheadrightarrow{AB} $ %<*example> % \fi \begin{dispExample} -\TestOverArrow{overhooktwoheadrightarrow} +\TestOverArrow{\overhooktwoheadrightarrow} \end{dispExample} % \iffalse %</example> @@ -514,7 +526,7 @@ $ \overhooktwoheadrightarrow{v} \qquad \overhooktwoheadrightarrow{AB} $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{OverRightarrow}{% +\NewOverArrowCommand{\OverRightarrow}{% start=\Relbar, middle=\Relbar, end=\Rightarrow, @@ -535,7 +547,7 @@ $ \OverRightarrow{v} \qquad \OverRightarrow{AB} $ % \fi \csundef{OverRightarrow} \begin{dispExample} -\NewOverArrowCommand{OverRightarrow}{% +\NewOverArrowCommand{\OverRightarrow}{% start={\smallermathstyle\Relbar}, middle={\smallermathstyle\Relbar}, end=\Rightarrow, @@ -557,7 +569,7 @@ $ \OverRightarrow{v} \qquad \OverRightarrow{AB} $ % \fi \csundef{OverRightarrow} \begin{dispExample} -\NewOverArrowCommand{OverRightarrow}{% +\NewOverArrowCommand{\OverRightarrow}{% start={\smallermathstyle\Relbar}, middle={\smallermathstyle\Relbar}, end=\Rightarrow, @@ -579,7 +591,7 @@ $ \OverRightarrow{v} \qquad \OverRightarrow{AB} $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{OverLeftarrow}{% +\NewOverArrowCommand{\OverLeftarrow}{% start={\smallermathstyle\Leftarrow}, middle={\smallermathstyle\Relbar}, end=\Relbar, @@ -601,7 +613,7 @@ $ \OverLeftarrow{v} \qquad \OverLeftarrow{AB} $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{OverLeftRightarrow}{% +\NewOverArrowCommand{\UnderLeftRightarrow}{% start={\smallermathstyle\Leftarrow}, middle={\smallermathstyle\Relbar}, end=\Rightarrow, @@ -610,7 +622,7 @@ $ \OverLeftarrow{v} \qquad \OverLeftarrow{AB} $ space before arrow=0.5ex, shift left=0, shift right=0, } -$ \OverLeftRightarrow{v} \qquad \OverLeftRightarrow{AB} $ +$ \UnderLeftRightarrow{v} \qquad \UnderLeftRightarrow{AB} $ \end{dispExample} % \iffalse %</example> @@ -650,7 +662,7 @@ $ \tttail $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{overtttailrightarrow}{% +\NewOverArrowCommand{\overtttailrightarrow}{% start={\tttail}, end={\rightarrow}, trim start=12, @@ -683,7 +695,7 @@ $ \overtttailrightarrow{v} \qquad \overtttailrightarrow{AB} $ % \fi \csundef{overtttailrightarrow} \begin{dispExample} -\NewOverArrowCommand{overtttailrightarrow}{% +\NewOverArrowCommand{\overtttailrightarrow}{% start={\vcenter{\hbox{$\smallermathstyle\tttail$}}}, end={\rightarrow}, trim start=12, @@ -710,7 +722,7 @@ $ \overtttailrightarrow{v} \qquad \overtttailrightarrow{AB} $ \begin{dispExample} \newcommand*{\leftarrowhead}{\usefont{U}{lasy}{m}{n}\symbol{40}} \newcommand*{\righttarrowhead}{\usefont{U}{lasy}{m}{n}\symbol{41}} -\NewOverArrowCommand{overrightleftarrow}{% +\NewOverArrowCommand{\overrightleftarrow}{% start=\text{\righttarrowhead}, end=\text{\leftarrowhead}, trim start=0.7, trim end=0.7, @@ -751,7 +763,7 @@ $ \overrightleftarrow{AB} \qquad \scriptstyle\overrightleftarrow{AB} $ % \medskip % % To use PGF/TikZ language, the optional argument |tikz| must be passed to -% \refCom{NewOverArrowCommand} . TikZ picture are not extensible. That's why the +% \refCom{NewOverArrowCommand}. TikZ pictures are not extensible. That's why the % \pkg{overarrows} package provides three lengths that can be used in TikZ % commands: % \begin{itemize} @@ -767,7 +779,7 @@ $ \overrightleftarrow{AB} \qquad \scriptstyle\overrightleftarrow{AB} $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand[tikz]{overtikzarrow}{} +\NewOverArrowCommand[tikz]{\overtikzarrow}{} $ \overtikzarrow{v} \qquad \overtikzarrow{AB} $ \end{dispExample} % \iffalse @@ -791,7 +803,7 @@ $ \overtikzarrow{v} \qquad \overtikzarrow{AB} $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand[tikz]{overarchedleftrightarrow}{% +\NewOverArrowCommand[tikz]{\overarchedleftrightarrow}{% add tikz options={y=\overarrowlength}, add tikz options={line width={\overarrowsmallerthickness}}, path options={arrows={<[scale=0.5]->[scale=0.5]}}, @@ -807,20 +819,72 @@ $ \overarchedleftrightarrow{v} \qquad \overarchedleftrightarrow{ABCD} $ %</example> % \fi % +% \subsection{Drawing the arrow with PSTricks} +% +% In addition to PGF/TikZ, the arrow can be drawn with PSTricks macros. +% For this, the optional argument |pstricks| must be passed to +% \refCom{NewOverArrowCommand}. Like with +% |tikz|, the three lengths \refCom{overarrowlength}, \refCom{overarrowthickness} +% and \refCom{overarrowsmallerthickness} can be used in PSTricks commands. +% By default, a right arrow is drawn: +% \iffalse +%<*example> +% \fi +\begin{dispExample} +\NewOverArrowCommand[pstricks]{\overpstarrow}{} +$ \overpstarrow{v} \qquad \overpstarrow{AB} $ +\end{dispExample} +% \iffalse +%</example> +% \fi +% \noindent The \pkg{pstricks} package has to be loaded (for example, using the +% \refOpt{pstricks} option of the \pkg{overarrows} package) +% +% Keys to use PSTricks commands are described in section~\ref{sec:pstricks-keys}, +% page~\pageref{sec:pstricks-keys}. The main keys are \refKey{pstricks command}, +% \refKey{psset}, \refDoc{key:pstricks}{arrow}, \refDoc{key:pstricks}{geometry} +% an \refDoc{key:pstricks}{line thickness}. Examples: +% \iffalse +%<*example> +% \fi +\begin{dispExample} +\NewOverArrowCommand[pstricks]{\overreddisks}{% + psset={linecolor=red}, arrow=*-*, center arrow, +} +$ \overreddisks{v} \qquad \overreddisks{AB} $ +\end{dispExample} +\begin{dispExample} +\NewOverArrowCommand[pstricks]{\ellipticarrow}{% + pstricks command={% + \psellipticarcn{->}%^^A avoid space before coordinates + (0.5\overarrowlength,0.2\overarrowlength)%^^A avoid space before coordinates + (0.5\overarrowlength,0.2\overarrowlength) + {170}{10} + }, + geometry={(0,0.2\overarrowlength)(\overarrowlength,0.4\overarrowlength)}, + line thickness={\overarrowsmallerthickness}, + center arrow, +} +$ \ellipticarrow{v} \qquad \ellipticarrow{AB} $ +\end{dispExample} +% \iffalse +%</example> +% \fi +% % \subsection{Drawing the arrow with \LaTeX{} picture environment} % -% As well as TikZ, the \LaTeX{} |picture| environment can be used to draw the -% arrow. For this, the optional argument |picture| must be passed to -% \refCom{NewOverArrowCommand}. Like for TikZ, the three lengths -% \refCom{overarrowlength}, \refCom{overarrowthickness} and -% \refCom{overarrowsmallerthickness} can be used in |picture| commands. -% By default, a right vector is drawn: +% Without any other package, arrows can also be drawn with the \LaTeX{} +% |picture| environment. In this case, the optional argument |picture| must be +% passed to \refCom{NewOverArrowCommand}. As with |tikz| or |pstricks|, the +% three lengths \refCom{overarrowlength}, \refCom{overarrowthickness} and +% \refCom{overarrowsmallerthickness} are available and can be used in +% |picture| drawing commands. By default, a right vector is drawn: % \iffalse %<*example> % \fi \ltxarrows%^^A classic arrows \begin{dispExample} -\NewOverArrowCommand[picture]{overpictarrow}{} +\NewOverArrowCommand[picture]{\overpictarrow}{} $ \overpictarrow{v} \qquad \overpictarrow{AB} $ \end{dispExample} % \iffalse @@ -835,7 +899,7 @@ $ \overpictarrow{v} \qquad \overpictarrow{AB} $ \pstarrows%^^A pst arrows \csundef{overpictarrow} \begin{dispExample} -\NewOverArrowCommand[picture]{overpictarrow}{} +\NewOverArrowCommand[picture]{\overpictarrow}{} $ \overpictarrow{v} \qquad \overpictarrow{AB} $ \end{dispExample} % \iffalse @@ -844,13 +908,13 @@ $ \overpictarrow{v} \qquad \overpictarrow{AB} $ % % Keys to use \LaTeX{} |picture| environment are described in % section~\ref{sec:picture-keys}, page~\pageref{sec:picture-keys}. The main keys -% are \refKey{picture command}, \refKey{geometry} an \refDoc{key:picture}{line -% thickness}. Here is an example: +% are \refKey{picture command}, \refDoc{key:picture}{geometry} an +% \refDoc{key:picture}{line thickness}. Here is an example: % \iffalse %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand[picture]{overbandedarrow}{ +\NewOverArrowCommand[picture]{\overbandedarrow}{ picture command={% \qbezier (0.0\overarrowlength,0) @@ -875,7 +939,6 @@ $ \overbandedarrow{v} \qquad \overbandedarrow{AB} $ % \subsection{Package options} % \label{sec:package-options} % -% % The \pkg{overarrows} package accepts many options, given as a comma-separated % list \meta{options} at package loading: % \cs{usepackage}|[|\meta{options}|]{overarrows}|. @@ -889,7 +952,8 @@ $ \overbandedarrow{v} \qquad \overbandedarrow{AB} $ % \begin{docOption}{esvect} % Loads the \pkg{esvect} package and redefines its vector commands \refCom{vv} % through the \pkg{overarrows} mechanism. Original \pkg{esvect} \cs{vv} macro -% is still available with \refCom{esvectvv}. +% is still available with \refCom{esvectvv}. The \pkg{esvect} font description +% is fixed to allow any font sizes. % % The \pkg{esvect} package provides the symbol \cs{relbareda} \symb{\relbareda} % which is smaller and often more flexible than the classic one \cs{relbar} @@ -1098,6 +1162,16 @@ $ \overbandedarrow{v} \qquad \overbandedarrow{AB} $ % library are loaded independently. % \end{docOption} % +% \begin{docOption}{pstricks} +% Loads the package \pkg{pstricks-add}. +% +% Note that, as it, this will compile with \LaTeX{}, \LuaLaTeX{} and +% \XeLaTeX{}, but not with \makebox{pdf\LaTeX} (see the PSTricks +% documentation). PSTricks arrows, drawn with the |pstricks| method, are +% always available, even if this option is not set, provided the +% \pkg{pstricks} package is loaded independently. +% \end{docOption} +% % \begin{docOption}{pstarrows} % Loads the \pkg{pict2e} package, with its option |pstarrows|. Vectors using % \LaTeX{} |picture| environment gives then \pstarrows$\overpictarrow{AB}$ @@ -1117,6 +1191,7 @@ $ \overbandedarrow{v} \qquad \overbandedarrow{AB} $ % \end{docOption} % % \begin{docOption}{subother} +% \tcbdocmarginnote{\tcbdocnew{v1.1 2023/02/15}} % Sets to 12 (\emph{other} catcode category) the catcode of the ``|_|" symbol % used for subscript detection, when this is enabled by the key \refKey{detect % subscripts} (see the section~\ref{sec:non-standard-subscripts}, @@ -1124,6 +1199,7 @@ $ \overbandedarrow{v} \qquad \overbandedarrow{AB} $ % \end{docOption} % % \begin{docOption}{subactive} +% \tcbdocmarginnote{\tcbdocnew{v1.1 2023/02/15}} % Sets to 13 (\emph{active} catcode category) the catcode of the ``|_|" symbol % used for subscript detection, when this is enabled by the key \refKey{detect % subscripts} (see the section~\ref{sec:non-standard-subscripts}, @@ -1142,45 +1218,51 @@ $ \overbandedarrow{v} \qquad \overbandedarrow{AB} $ % \begin{docCommands}{% % { % doc name=NewOverArrowCommand, -% doc parameter=\oarg{method}\marg{name}\marg{keys}, +% doc parameter=\oarg{method}\marg{command}\marg{keys}, % }, % { % doc name=RenewOverArrowCommand, -% doc parameter=\oarg{method}\marg{name}\marg{keys}, +% doc parameter=\oarg{method}\marg{command}\marg{keys}, % }, % { % doc name=ProvideOverArrowCommand, -% doc parameter=\oarg{method}\marg{name}\marg{keys}, +% doc parameter=\oarg{method}\marg{command}\marg{keys}, % }, % { % doc name=DeclareOverArrowCommand, -% doc parameter=\oarg{method}\marg{name}\marg{keys}, +% doc parameter=\oarg{method}\marg{command}\marg{keys}, % }, % } -% Creates the command \cs{\meta{name}} and its starred variant -% \cs{\meta{name}*}. The starred variant \cs{\meta{name}*} removes the extra +% Creates the command \meta{command} and its starred variant +% \meta{command}|*|. The starred variant \meta{command}|*| removes the extra % end space generated by the arrow, which is suitable, as example, when % a subscript follows. % +% \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}} +% \meta{command} can be given with or without backslash (prior to the version +% 1.2, only the name, without backslash, was accepted). +% % \begin{description} -% \item[\cs{NewOverArrowCommand}] raises an error if \cs{\meta{name}} is -% already defined. +% \item[\cs{NewOverArrowCommand}] raises an error if \meta{command} is +% already defined. % -% \item[\cs{RenewOverArrowCommand}] raises an error if \cs{\meta{name}} is undefined. +% \item[\cs{RenewOverArrowCommand}] raises an error if \meta{command} +% is undefined. % -% \item[\cs{ProvideOverArrowCommand}] sets \cs{\meta{name}} if the command is -% undefined and does nothing if it is already defined, without raising -% any error. +% \item[\cs{ProvideOverArrowCommand}] sets \meta{command} if the command is +% undefined and does nothing if it is already defined, without raising +% any error. % -% \item[\cs{DeclareOverArrowCommand}] sets \cs{\meta{name}}, whether the -% command is already defined -% or not, without raising any error. +% \item[\cs{DeclareOverArrowCommand}] sets \meta{command}, whether the command +% is already defined or not, without raising any error. % \end{description} % % The \meta{method} used to draw the arrow must be: % \begin{description} % \item[|symb|] to draw the arrow by symbols assemblage (default); % \item[|tikz|] to draw the arrow with PGF/TikZ; +% \item[|pstricks|] to draw the arrow with PSTricks; +% \tcbdocmarginnote{\tcbdocnew{v1.2 2024/07/11}} % \item[|picture|] to draw the arrow with the \LaTeX{} % |picture| environment. % \end{description} @@ -1196,7 +1278,7 @@ $ \overbandedarrow{v} \qquad \overbandedarrow{AB} $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand[tikz]{myoverarrow}{arrows={Bar-Bar}, center arrow} +\NewOverArrowCommand[tikz]{\myoverarrow}{arrows={Bar-Bar}, center arrow} $ \myoverarrow{v} \qquad \myoverarrow{ABCD} $ \end{dispExample} % \iffalse @@ -1207,19 +1289,23 @@ $ \myoverarrow{v} \qquad \myoverarrow{ABCD} $ % \begin{docCommands}{% % { % doc name=TestOverArrow, -% doc parameter=\oarg{pattern}\marg{name}, +% doc parameter=\oarg{pattern}\marg{command}, % }, % { % doc name=TestOverArrow*, -% doc parameter=\oarg{pattern}\marg{name}, +% doc parameter=\oarg{pattern}\marg{command}, % }, % } -% Displays the result of the command \meta{name} for patterns of various +% Displays the result of the command \meta{command} for patterns of various % lengths and for the four math styles. A custom \meta{pattern} can be added % to the predefined ones. % % The starred variant \cs{TestOverArrow*} displays a full report, including -% kerning tests of the commands \cs{\meta{name}} and \cs{\meta{name}*} . +% kerning tests of the commands \meta{command} and \meta{command}|*|. +% +% \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}} +% \meta{command} can be given with or without backslash (prior to the version +% 1.2, only the name, without backslash, was accepted). % % \iffalse %<*example> @@ -1261,9 +1347,9 @@ $ \myoverarrow{v} \qquad \myoverarrow{ABCD} $ % \begin{docCommand}{smallermathstyle}{} % Applies the next math style, smaller than the current. That is: % \begin{itemize} -% \item sets \cs{scriptstyle} if the current math style is \cs{displaystyle} +% \item uses \cs{scriptstyle} if the current math style is \cs{displaystyle} % or \cs{textstyle}; -% \item sets \cs{scriptscriptstyle} if the current math style is +% \item uses \cs{scriptscriptstyle} if the current math style is % \cs{scriptstyle}; % \item does nothing if the current math style is \cs{scriptscriptstyle}. % \end{itemize} @@ -1283,19 +1369,20 @@ $ \displaystyle AB \quad \smallermathstyle AB % % \end{docCommand} % -% \subsubsection{Useful lengths for TikZ or \texttt{picture} environment} +% \subsubsection{Useful lengths for TikZ, PSTricks or \texttt{picture} environment} % -% Arrows drawn with graphic languages, like PGF/TikZ or the \LaTeX{} |picture| -% environment, are not extensible. The three lengths \refLen*{overarrowlength}, -% \refLen*{overarrowthickness} and \refLen*{overarrowsmallerthickness} are -% computed at each utilisation of a command set with the |tikz| or |picture| -% method, so they can be used in drawing commands. +% Arrows drawn with graphic languages, like PGF/TikZ, PSTricks or the \LaTeX{} +% |picture| environment, are not extensible. The three lengths +% \refLen*{overarrowlength}, \refLen*{overarrowthickness} and +% \refLen*{overarrowsmallerthickness} are computed at each utilisation of +% a command set with the |tikz|, |pstricks| or |picture| method, so they can be +% used in drawing commands. % % \iffalse %<*example> % \fi \begin{dispExample*}{grow to left by=-2em} -\NewOverArrowCommand[tikz]{overparabola}{% +\NewOverArrowCommand[tikz]{\overparabola}{% path options={x=\overarrowlength, line width=\overarrowsmallerthickness}, path={(0,0) parabola[parabola height=0.2\overarrowlength] (1,0)}, arrows={-}, center arrow, min length=30, @@ -1320,8 +1407,13 @@ $\scriptstyle \overparabola{v} \qquad \overparabola{ABCD} $ \par % \item |\fontdimen 8 \scriptscriptfont 3| in % \cs{scriptscriptstyle}. % \end{itemize} +% +% \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}} +% Theses settings are adapted when the package \pkg{unicode-math} is loaded +% (using \cs{Umathoverbarrule} with \LuaLaTeX{} or |\fontdimen 54|, family~2 +% with \XeLaTeX{} --- see the manual of \pkg{unicode-math}). % \end{docLength} -% +% % \begin{docLength}{overarrowsmallerthickness} % Is set to the default rule thickness of the next smaller math style. % That is: @@ -1330,6 +1422,11 @@ $\scriptstyle \overparabola{v} \qquad \overparabola{ABCD} $ \par % \item |\fontdimen 8 \scriptscriptfont 3| in \cs{scriptstyle} or % \cs{scriptscriptstyle}. % \end{itemize} +% +% \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}} +% Theses settings are adapted when the package \pkg{unicode-math} is loaded +% (using \cs{Umathoverbarrule} with \LuaLaTeX{} or |\fontdimen 54|, family~2 +% with \XeLaTeX{} --- see the manual of \pkg{unicode-math}). % \end{docLength} % % \subsubsection{Vectors macros} @@ -1507,8 +1604,9 @@ $ \esvectvv*{\imath}{0} \quad \esvectvv*{e}{r} \quad \esvectvv*{L}{\Delta} $ % page~\pageref{sec:macro-for-commands-creation} for the documentation of % commands creation): % \begin{itemize} -% \item \meta{number}| = 0 | for the |symb| method (default); +% \item \meta{number}| = 0 | for the |symb| method (method by default); % \item \meta{number}| = 12| for the |tikz| method; +% \item \meta{number}| = 12| for the |pstricks| method; % \item \meta{number}| = 18| for the |picture| method. % \end{itemize} % @@ -1516,7 +1614,7 @@ $ \esvectvv*{\imath}{0} \quad \esvectvv*{e}{r} \quad \esvectvv*{L}{\Delta} $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{overlongarrow}{min length=50} +\NewOverArrowCommand{\overlongarrow}{min length=50} $ \overlongarrow{v} \qquad \overlongarrow{ABCDEF} $ \end{dispExample} % \iffalse @@ -1550,7 +1648,7 @@ $ \overlongarrow{v} \qquad \overlongarrow{ABCDEF} $ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{underhooks}{% +\NewOverArrowCommand{\underhooks}{% start={\lhook}, end={\rhook}, trim=1, arrow under, shift leftright=-4, } @@ -1580,8 +1678,8 @@ $ \underhooks{v} \qquad \underhooks{AB} $ % page~\pageref{sec:macro-for-commands-creation} for the documentation of % commands creation): % \begin{itemize} -% \item \meta{number}| = 0 | for the |symb| method (default); -% \item \meta{number}| = -2| for the |tikz| and |picture| methods. +% \item \meta{number}| = 0 | for the |symb| method (method by default); +% \item \meta{number}| = -2| for the |tikz|, |pstricks| and |picture| methods. % \end{itemize} % %\end{docKey} @@ -1590,7 +1688,7 @@ $ \underhooks{v} \qquad \underhooks{AB} $ %<*example> % \fi \begin{dispExample*}{grow to left by=-2em} -\NewOverArrowCommand{lookback}{% +\NewOverArrowCommand{\lookback}{% start={\leftarrow}, end={\rightharpoondown}, shift left=-50, shift right=-10, } @@ -1658,7 +1756,7 @@ $ \lookback{\text{look back}} $ %<*example> % \fi \begin{dispExample*}{grow to left by=-2em} -\NewOverArrowCommand{overharpoonsdown}{% +\NewOverArrowCommand{\overharpoonsdown}{% start=\leftharpoondown, end=\rightharpoondown, center arrow, space before arrow=-0.2ex, space after arrow=0.3ex, } @@ -1693,7 +1791,7 @@ $ \dot{\overharpoonsdown{v}} \qquad \ddot{\overharpoonsdown{AB}}$ %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{autosub}{detect subscripts} +\NewOverArrowCommand{\autosub}{detect subscripts} $ \imath_0 \qquad \autosub{\imath}_0 \qquad {\autosub{\imath}}_0 \qquad {\autosub*{\imath}}_0 $ \end{dispExample} @@ -1745,7 +1843,7 @@ $ \imath_0 \qquad \autosub{\imath}_0 \qquad %<*example> % \fi \begin{dispExample} -\NewOverArrowCommand{smalleroverrightarrow}{% +\NewOverArrowCommand{\smalleroverrightarrow}{% start={\smallermathstyle\relbar}, middle={\smallermathstyle\relbareda}, end={\rightarrow}, @@ -1784,16 +1882,26 @@ $ \smalleroverrightarrow{v} \qquad \smalleroverrightarrow{AB} $ % Clears \refKey{trim start}, \refKey{trim middle} and \refKey{trim end}. % \end{docKey} % -%\begin{docKey}{middle config}{=auto\textbar relbar\textbar relbareda}{no default} -% Sets a suitable configuration for the keys \refKey{middle} and \refKey{trim middle}: +%\begin{docKey}{middle config}{=auto\textbar relbar\textbar relbareda\textbar harrowextender}{no default} +% Sets a suitable configuration for the keys \refKey{middle} and \refKey{trim +% middle}: % \begin{description} -% \item[For \refKey*{middle config}| = relbar|,] \refKey{middle} is set to -% \cs{relbar} \symb{\relbar} and \refKey{trim middle} to |2.5|. -% \item[For \refKey*{middle config}| = relbareda|,] \refKey{middle} is set to -% \cs{relbareda} \symb{\relbareda} and \refKey{trim middle} to |1|. -% \item[For \refKey*{middle config}| = auto|,] \refKey{middle} is set with -% \refKey*{middle config}| = relabareda| if the option \refOpt{esvect} is set -% (which is the default) and \refKey*{middle config}| = relabar| if not. +% \item[For \refKey*{middle config}| = relbar|,] \refKey{middle} is set to +% \cs{relbar} \symb{\relbar} and \refKey{trim middle} to |2.5|. +% \item[For \refKey*{middle config}| = relbareda|,] \refKey{middle} is set to +% \cs{relbareda} \symb{\relbareda} and \refKey{trim middle} to |1|. +% \item[For \refKey*{middle config}| = harrowextender|,] +% \tcbdocmarginnote{\tcbdocnew{v1.2 2024/07/11}} +% \refKey{middle} is set to \cs{harrowextender} and \refKey{trim middle} to +% |0|. +% \item[For \refKey*{middle config}| = auto|,] +% \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}} +% if \cs{harrowextender} is provided by the math font\footnote{See the +% documentation of the package \pkg{unicode-math}.}, \refKey{middle} is set +% with \refKey*{middle config}| = harrowextender|. If \cs{harrowextender} +% isn't availlable, \refKey{middle} is set with \refKey*{middle config}% +% | = relbareda| if the option \refOpt{esvect} is set (which is the +% default) and \refKey*{middle config}| = relabar| if not. % \end{description} %\end{docKey} % @@ -1880,14 +1988,14 @@ $ \smalleroverrightarrow{v} \qquad \smalleroverrightarrow{AB} $ % commands creation), the |tikz| method is chosen, then the arrow is drawn by % the command: % \begin{center} -% \cs{tikz}|[|\refKey*{tikz options}|]{|\refKey*{tikz command}|}| +% \cs{tikz}|[<|\refKey*{tikz options}|>]{<|\refKey*{tikz command}|>}| % \end{center} % \noindent where \refKey{tikz options} and \refKey{tikz command} are two keys % described below. When \refKey*{tikz command} is let unset, the drawing command % turns into: % \begin{center} -% \cs{tikz}|[|\refKey*{tikz options}|]{|\cs{draw}|[|\refKey*{path options}|]| -% \refKey*{path}|;}| +% \cs{tikz}|[<|\refKey*{tikz options}|>]{|\cs{draw}|[<|\refKey*{path options}|>]| +% |<|\refKey*{path}|>;}| % \end{center} % % The best way to customise |tikz| arrows is then to set the keys \refKey{tikz @@ -1899,7 +2007,7 @@ $ \smalleroverrightarrow{v} \qquad \smalleroverrightarrow{AB} $ %<*example> % \fi \begin{dispExample*}{grow to left by=-2em} -\NewOverArrowCommand[tikz]{overdotteddoublearrow}{% +\NewOverArrowCommand[tikz]{\overdotteddoublearrow}{% add tikz options={blue}, add path options={densely dotted}, arrows={->[scale=0.5]>[scale=0.5]}, thinner, min length=20, space after arrow={0.3ex}, @@ -1910,16 +2018,18 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ %</example> % \fi % +% \bigskip +% % The following keys are available when the |tikz| method is chosen. % -% \begin{docKey}[][before lower=\medskip\par] +% \begin{docKey}[][before lower=\bigskip\par] % {tikz options}{=\marg{TikZ options}} % {no default, initially |x=|\cs{overarrowlength}|, line % width=|\cs{overarrowthickness}} % Sets TikZ options to \meta{TikZ options}. %\end{docKey} % -% \begin{docKey}[][before lower=\medskip\par] +% \begin{docKey}[][before lower=\bigskip\par] % {path options}{=\marg{path options}} % {no default, initially |arrows={-Classical TikZ Rightarrow}, cap=round|} % Sets TikZ path options to \meta{path options}. @@ -1957,21 +2067,102 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % value \cs{draw}|[|\refKey*{path options}|] |\refKey*{path}|;| is used. %\end{docKey} % +% \subsubsection{PSTricks settings} +% \label{sec:pstricks-keys} +% +% \tcbdocmarginnote{\tcbdocnew{v1.2 2024/07/11}} +% If, at command creation (see section~\ref{sec:macro-for-commands-creation}, +% page~\pageref{sec:macro-for-commands-creation} for the documentation of +% commands creation), the |pstricks| method is chosen, then the arrow is drawn +% by: +% \begin{flushleft}\leftskip=3cm +% \cs{begin}|{pspicture}<|\refDoc{key:pstricks}*{geometry}|>%|\\ +% \quad\cs{psset}|{linewidth=<|\refDoc{key:pstricks}*{line thickness}|>}%|\\ +% \quad\cs{psset}|{<|\refKey*{psset}|>}%|\\ +% \quad|<|\refKey*{pstricks command}|>%|\par +% \cs{end}|{pspicture}%| +% \end{flushleft} +% \noindent where \refDoc{key:pstricks}{geometry}, \refDoc{key:pstricks}{line +% thickness} \refKey*{psset} and \refKey*{pstricks command} are four keys +% described below. +% +%\iffalse +%<*example> +% \fi +\begin{dispExample*}{grow to left by=-2em} +\NewOverArrowCommand[pstricks]{\overloopandarrow}{ + pstricks command={% + \pscurve{->}(0,0) + (0.6\overarrowlength,0.05\overarrowlength) + (0.5\overarrowlength,0.1\overarrowlength) + (0.4\overarrowlength,0.05\overarrowlength) + (\overarrowlength,0) + }, + geometry={(0,0)(\overarrowlength,0.2\overarrowlength)}, + space after arrow=2pt, min length=20, + geometry={(0,0)(\overarrowlength,0.2\overarrowlength)}, +} +$ \overloopandarrow{v} \qquad \overloopandarrow{AB} $ +\end{dispExample*} +% \iffalse +%</example> +% \fi +% +% \bigskip +% +% The following keys are available when the |pstricks| method is chosen. +% +% \begin{docKey}[][before lower=\bigskip\par] +% {pstricks command}{=\marg{pstricks command}} +% {no default, initially \cs{psline}|\{->\}(0,0)(|\refCom*{overarrowlength}|,0)|} +% Sets the |pspicture| command to \meta{pstricks command}. +% \end{docKey} +% +% \begin{docKey}[][doc label={pstricks:arrow}]%^^A same name as for TikZ +% {arrow}{=\marg{arrow}} +% {no default, initially |->|} +% Sets \refKey{pstricks command} with +% |\psline{|\meta{arrow}|}(0,0)(|\refCom*{overarrowlength}|,0)|. +% \end{docKey} +% +% \begin{docKey}[][] +% {psset}{=\marg{pstricks setting}} +% {no default, initially empty} +% Sets \meta{pstricks setting} with \cs{psset}. +% \end{docKey} +% +% \begin{docKey}[][before lower=\bigskip\par, doc label={pstricks:geometry}]%^^A same name as for picture +% {geometry}{=\marg{pstricks geometry specification}} +% {no default, initially |(0,-0.5ex)(|\refCom*{overarrowlength}|,1ex)|} +% Sets the |pspicture| geometry to \meta{pstricks geometry specification}. +% \end{docKey} +% +% \begin{docKey}[][doc label={pstricks:line thickness}]%^^A same name as for TikZ +% {line thickness}{=\marg{length}}{no default} +% Sets the line thickness to \meta{length}. +% \end{docKey} +% +% \begin{docKey}[][doc label={pstricks:thinner}]%^^A same name as for TikZ +% {thinner}{}{} +% Sets the keys \refDoc{key:pstricks}{line thickness} with +% \cs{overarrowsmallerthickness}. +% \end{docKey} +% % \subsubsection{Picture environment settings} % \label{sec:picture-keys} % % If, at command creation (see section~\ref{sec:macro-for-commands-creation}, % page~\pageref{sec:macro-for-commands-creation} for the documentation of % commands creation), the |picture| method is chosen, then the arrow is drawn -% with by: +% by: % \begin{flushleft}\leftskip=3cm -% \cs{begin}|{picture}|\refKey*{geometry}|%|\\ -% \quad\cs{linethickness}|{|\refDoc{key:picture}*{line thickness}|}%|\\ -% \quad\refKey*{picture command}|%|\par +% \cs{begin}|{picture}<|\refDoc{key:picture}*{geometry}|>%|\\ +% \quad\cs{linethickness}|{<|\refDoc{key:picture}*{line thickness}|>}%|\\ +% \quad|<|\refKey*{picture command}|>%|\par % \cs{end}|{picture}%| % \end{flushleft} -% \noindent where \refKey{geometry}, \refDoc{key:picture}{line thickness} and -% \refKey*{picture command} are three keys described below. +% \noindent where \refDoc{key:picture}{geometry}, \refDoc{key:picture}{line +% thickness} and \refKey*{picture command} are three keys described below. % %\iffalse %<*example> @@ -1979,7 +2170,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \begin{dispExample*}{grow to left by=-2em} % ^^A \arc and \roundcap commands are from the pict2e package % ^^A this example needs \usepackage{pict2e} in the preamble - \NewOverArrowCommand[picture]{overarc}{% + \NewOverArrowCommand[picture]{\overarc}{% picture command={% \roundcap \put(0.5\overarrowlength,0){\arc[180,0]{0.6\overarrowlength}} @@ -1994,15 +2185,18 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % \iffalse %</example> % \fi -% The following keys are available when the |picture| method is chosen. % -% \begin{docKey}[][before lower=\medskip\par] +% \bigskip +% +%The following keys are available when the |picture| method is chosen. +% +% \begin{docKey}[][before lower=\bigskip\par] % {picture command}{=\marg{picture command}} % {no default, initially \cs{put}|(0,0)\{|\cs{vector}|(1,0)\{|\refCom*{overarrowlength}|\}\}|} % Sets picture command to \meta{picture command}. % \end{docKey} % -% \begin{docKey}[][before lower=\medskip\par] +% \begin{docKey}[][before lower=\bigskip\par, doc label={picture:geometry}]%^^A same name as for pstricks % {geometry}{=\marg{picture geometry specification}} % {no default, initially |(|\refCom*{overarrowlength}|,1ex)(0,-0.5ex)|} % Sets picture geometry to \meta{picture geometry specification}. @@ -2029,6 +2223,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % \subsubsection{Advanced commands} % % \begin{docCommand}{SetOverArrowsSubscriptCommand}{\marg{command}} +% \tcbdocmarginnote{\tcbdocnew{v1.1 2023/02/15}} % Sets to \meta{command} the command used for subscript detection, when this % is enabled by the key \refKey{detect subscripts} (see the % section~\ref{sec:non-standard-subscripts}, @@ -2131,6 +2326,12 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % \symb{\relbareda} from the \pkg{esvect} package. This can be fixed with the % \refOpt{noesvect} option. % +% Depending of the math font, predefined commands may be faulty. For example, at +% the time of writing, hooks vertical position is incorrect with \emph{Asana +% Math} or \cs{harrowextender} is badly positioned with \emph{Stix two Math} +% (for the smallest math styles), \emph{Libertinus Math} and +% \emph{GFSNeohellenicMath}. +% % \subsubsection{Detection of non standard subscripts} % \label{sec:non-standard-subscripts} % @@ -2225,11 +2426,25 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \subsection{Changelog} % -% \begin{description} -% \item[v1.1] Support for non-standard subscripts -% \item[v1.0.1] Bug fix for under* options. -% \item[v1.0] Initial version. -% \end{description} +% \begingroup +% \renewcommand{\arraystretch}{2} +% \begin{tabular*}{\linewidth} +% {@{} l @{\extracolsep{\fill}} p{0.9\linewidth} @{}} +% v1.2 & \noindent\par\vspace{-\baselineskip} +% \begin{itemize}[left=0pt, topsep=0pt, partopsep=0pt] +% \item Fix compatibility issues with \pkg{unicode-math}. +% \item Allow to draw the arrow with PSTricks. +% \item Make \pkg{esvect} handle all font sizes. +% \item Rewrite starred variant for better performances. +% \end{itemize} +% \\ +% v1.1 & Support for non-standard subscripts. +% \\ +% v1.0.1 & Bug fix for under* options. +% \\ +% v1.0 & Initial version. +% \end{tabular*} +% \endgroup % % \StopEventually{} % @@ -2250,6 +2465,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \newif\ifovar@option@oldarrows@ \newif\ifovar@option@esvect@ \ovar@option@esvect@true \PassOptionsToPackage{f}{esvect} \newif\ifovar@option@tikz@ +\newif\ifovar@option@pstricks@ \newif\ifovar@option@pstarrows@ \newif\ifovar@detectsubscripts@ \newif\ifovar@option@subother@ @@ -2280,6 +2496,8 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \subsubsection*{Declaration of options} % +% \changes{v1.2}{2024/07/11}{Add option pstricks} +% % \begin{macrocode} \DeclareOption{esvect}{\ovar@option@esvect@true} \DeclareOption{noesvect}{\ovar@option@esvect@false} @@ -2293,6 +2511,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \DeclareOption{esvecth}{\ovar@option@esvect@true\PassOptionsToPackage{h}{esvect}} \DeclareOption{old-arrows}{\ovar@option@oldarrows@true} \DeclareOption{tikz}{\ovar@option@tikz@true} +\DeclareOption{pstricks}{\ovar@option@pstricks@true} \DeclareOption{pstarrows}{\ovar@option@pstarrows@true} \DeclareOption{subscripts}{\ovar@detectsubscripts@true} \DeclareOption{subother}{\ovar@option@subother@true} @@ -2381,23 +2600,42 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \RequirePackage{amsmath} \RequirePackage{etoolbox} % \end{macrocode} +% % Option \refOpt{old-arrows}. Configuration of arrows used for % predefined commands. +% \changes{v1.2}{2024/07/11}{Use \cs{def} instead of \cs{let} for +% \cs{ovar@rightarrow} and \cs{ovar@leftarrow}} % \begin{macrocode} -\let\ovar@rightarrow\rightarrow -\let\ovar@leftarrow\leftarrow +\def\ovar@rightarrow{\rightarrow} +\def\ovar@leftarrow{\leftarrow} \ifovar@option@oldarrows@ \RequirePackage[old]{old-arrows} - \let\ovar@rightarrow\varrightarrow - \let\ovar@leftarrow\varleftarrow + \def\ovar@rightarrow{\varrightarrow} + \def\ovar@leftarrow{\varleftarrow} \fi % \end{macrocode} +% % Option \refOpt{esvect}. % \begin{macrocode} \ifovar@option@esvect@ \RequirePackage{esvect} +% \end{macrocode} +% \changes{v1.2}{2024/07/11}{Fix esvect font sizes} +% Fix font description in |uesvect.fd| to allow any sizes (taken from Enrico +% Gregorio, \url{https://tex.stackexchange.com/a/689863/}) +% \begin{macrocode} + \DeclareFontFamily{U}{esvect}{} + \DeclareFontShape{U}{esvect}{m}{n}{ + <-5.5> vect5 + <5.5-6.5> vect6 + <6.5-7.5> vect7 + <7.5-8.5> vect8 + <8.5-9.5> vect9 + <9.5-> vect10 + }{} \fi % \end{macrocode} +% % Option \refOpt{tikz}. % \begin{macrocode} \ifovar@option@tikz@ @@ -2405,6 +2643,14 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \usetikzlibrary{arrows.meta} \fi % \end{macrocode} +% +% Option \refOpt{pstricks}. +% \begin{macrocode} +\ifovar@option@pstricks@ + \RequirePackage{pstricks-add} +\fi +% \end{macrocode} +% % Option \refOpt{pstarrows}. % \begin{macrocode} \ifovar@option@pstarrows@ @@ -2412,6 +2658,43 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \fi % \end{macrocode} % +% Add hook rules to apply settings after \pkg{unicode-math}. +% \begin{macrocode} +\DeclareHookRule{begindocument}{overarrows}{after}{unicode-math-luatex} +\DeclareHookRule{begindocument}{overarrows}{after}{unicode-math-xetex} +% \end{macrocode} +% +% \changes{v1.2}{2024/07/11}{Use \cs{harrowextender}, if availlable.} +% Set \cs{ovar@auto@middle} and \cs{ovar@auto@trim@middle}, used by +% configurations made with \refKey*{middle config}|=auto|. +% \begin{macrocode} +\AddToHook{begindocument}[overarrows] + {% + \ifdef{\relbareda} + {% + \gdef\ovar@auto@middle{\relbareda} + \gdef\ovar@auto@trim@middle{1} + } + {% + \gdef\ovar@auto@middle{\relbar} + \gdef\ovar@auto@trim@middle{2.5} + }% + \@ifpackageloaded{unicode-math} + {% +% \end{macrocode} +% Test of \cs{harrowextender} availability taken from Enrico Gregorio, +% (\url{https://tex.stackexchange.com/a/218407/}). +% \begin{macrocode} + \check@mathfonts + \iffontchar\textfont\tw@\string"23AF + \gdef\ovar@auto@middle{\mathrel\harrowextender} + \gdef\ovar@auto@trim@middle{0} + \fi + } + {}% + } +% \end{macrocode} +% % \subsection*{Configuration of subscripts detection} % % \changes{v1.1}{2023/02/15}{Support for non-standard subscripts} @@ -2424,6 +2707,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % \end{macro} % % Initial configuration. +% \changes{v1.2}{2024/07/11}{Remove useless \cs{AtBeginDocument}} % \begin{macrocode} \SetOverArrowsSubscriptCommand{_} % \end{macrocode} @@ -2432,7 +2716,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \ifovar@option@subother@ \begingroup \catcode `_=12 - \AddToHook{begindocument/end}{\SetOverArrowsSubscriptCommand{_}} + \SetOverArrowsSubscriptCommand{_}% \endgroup \fi % \end{macrocode} @@ -2441,7 +2725,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \ifovar@option@subactive@ \begingroup \catcode `_=13 - \AddToHook{begindocument/end}{\SetOverArrowsSubscriptCommand{_}} + \SetOverArrowsSubscriptCommand{_}% \endgroup \fi % \end{macrocode} @@ -2662,12 +2946,25 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ } } }, +% \end{macrocode} +% \changes{v1.2}{2024/07/11}{Add config \refKey*{middle config}|=harrowextender|} +% \begin{macrocode} + middle config/harrowextender/.code={% + \pgfkeysalso{% + middle={\harrowextender}, + trim middle={0}, + } + }, +% \end{macrocode} +% Set \refKey*{middle config} with (hopefully) a good configuration. It would be +% better to reuse the previous \refKey*{middle config} settings, but we have to +% wait for the |begindocument| hook to know which one to use. +% \begin{macrocode} middle config/auto/.code={% - \ifovar@option@esvect@ - \pgfkeysalso{middle config=relbareda} - \else - \pgfkeysalso{middle config=relbar} - \fi + \pgfkeysalso{% + middle={\ovar@auto@middle}, + trim middle={\ovar@auto@trim@middle}, + } }, % \end{macrocode} % \refKey{amsmath}. @@ -2775,6 +3072,59 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ } % \end{macrocode} % +% \subsubsection*{Keys for the \texttt{pstricks} method} +% +% \changes{v1.2}{2024/07/11}{Add the method pstricks} +% +% \begin{macrocode} +\SetOverArrowsMethod[lens]{pstricks}{% +% \end{macrocode} +% Arrow macro. +% \begin{macrocode} + no arrow macro hook/.code={% + \ovar@set{% + arrow macro/.expanded={% + $\noexpand\mkern \expandonce{\ovar@shift@left} mu\noexpand\relax$% + \noexpand\begin{pspicture}\expandonce{\ovar@pstricks@geometry}% + \noexpand\psset{linewidth=\expandonce{\ovar@pstricks@linethickness}}% + \noexpand\psset{\expandonce{\ovar@pstricks@psset}}% + \expandonce{\ovar@pstricks@command}% + \noexpand\end{pspicture}% + $\noexpand\mkern \expandonce{\ovar@shift@right} mu\noexpand\relax$% + } + } + }, +% \end{macrocode} +% Pstricks parts: \refKey{pstricks command}, \refKey{psset}, +% \refDoc{key:pstricks}{geometry}, \refDoc{key:pstricks}{line thickness}. +% \begin{macrocode} + pstricks command/.store in=\ovar@pstricks@command, + psset/.store in=\ovar@pstricks@psset, + geometry/.store in=\ovar@pstricks@geometry, + line thickness/.store in=\ovar@pstricks@linethickness, + pstricks command/.value required, + psset/.value required, + geometry/.value required, + line thickness/.value required, +% \end{macrocode} +% Pstricks handy key: \refDoc{key:pstricks}{arrow}, \refDoc{key:pstricks}{thinner}. +% \begin{macrocode} + arrow/.style={pstricks command={\psline{##1}(0,0)(\overarrowlength,0)}},% + arrow/.value required,% + thinner/.style={line thickness={\overarrowsmallerthickness}},% + thinner/.value forbidden,% +% \end{macrocode} +% Initial configuration. +% \begin{macrocode} + shift right=-2, + min length=12, + geometry={(0,-0.5ex)(\overarrowlength,0.5ex)},% + line thickness={\overarrowthickness},% + arrow={->},% + psset={},% +} +% \end{macrocode} +% % \subsubsection*{Keys for the \texttt{picture} method} % % \begin{macrocode} @@ -2795,7 +3145,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ } }, % \end{macrocode} -% Picture parts: \refKey{picture command}, \refKey{geometry}, +% Picture parts: \refKey{picture command}, \refDoc{key:picture}{geometry}, % \refDoc{key:picture}{line thickness}. % \begin{macrocode} picture command/.store in=\ovar@picture@command, @@ -2831,9 +3181,9 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ Previous definition will be overridden} }{} % \end{macrocode} -% Use a default value of |3.5 mu|, as recommended by egreg (see +% Use a default value of |3.5 mu|, as recommended by Enrico Gregorio (see % \url{https://tex.stackexchange.com/a/471736}). \cs{joinrel} -% uses a value of 3 mu. +% uses a value of 3 mu. % \begin{macrocode} \DeclareRobustCommand{\xjoinrel}[1][3.5]{\mathrel{\mkern-#1mu}} % \end{macrocode} @@ -2872,7 +3222,6 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \newlength{\overarrowlength} \newlength{\overarrowthickness} \newlength{\overarrowsmallerthickness} -\newlength{\ovar@extralength} \newlength{\ovar@tempdim} % \end{macrocode} % @@ -2891,26 +3240,75 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % \end{macro} % % \begin{macro}{\ovar@set@arrowthickness} +% \begin{macro}{\ovar@set@arrowthickness@UM@lua} % Sets \refLen{overarrowthickness} and \refLen{overarrowsmallerthickness}.\\ -% |#1|: arrow length\\ -% |#2|: math style +% |#1|: math style +% +% Set to the default rule thickness of the current math style, normaly given by +% \cs{fontdimen} 8 family 3. With \pkg{unicode-math}, use instead: +% \begin{itemize} +% \item \cs{fontdimen} 54 family 2 with XeTeX, +% \item \cs{Umathoverbarrule} with LuaTex. +% \end{itemize} +% \changes{v1.2}{2024/07/11}{Get the correct rule thickness with unicode-math} % \begin{macrocode} -\def\ovar@set@arrowthickness#1{% use rule thickness=\fontdimen 8 font family 3 +\def\ovar@rulethickness@fontdimen{8} +\def\ovar@rulethickness@family{3} +\def\ovar@set@arrowthickness#1{% \ifx#1\displaystyle% - \overarrowthickness = \fontdimen 8 \textfont 3% - \overarrowsmallerthickness = \fontdimen 8 \scriptfont 3% + \overarrowthickness = + \fontdimen \ovar@rulethickness@fontdimen \textfont \ovar@rulethickness@family% + \overarrowsmallerthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family% \else\ifx#1\textstyle% - \overarrowthickness = \fontdimen 8 \textfont 3% - \overarrowsmallerthickness = \fontdimen 8 \scriptfont 3% + \overarrowthickness = + \fontdimen \ovar@rulethickness@fontdimen \textfont \ovar@rulethickness@family% + \overarrowsmallerthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family% \else\ifx#1\scriptstyle% - \overarrowthickness = \fontdimen 8 \scriptfont 3% - \overarrowsmallerthickness = \fontdimen 8 \scriptscriptfont 3% + \overarrowthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family% + \overarrowsmallerthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptscriptfont \ovar@rulethickness@family% \else% - \overarrowthickness = \fontdimen 8 \scriptscriptfont 3% + \overarrowthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptscriptfont \ovar@rulethickness@family% \overarrowsmallerthickness = \overarrowthickness% \fi\fi\fi% } % \end{macrocode} +% \pkg{unicode-math} with LuaTeX version. +% \begin{macrocode} +\def\ovar@set@arrowthickness@UM@lua#1{% + \overarrowthickness = \Umathoverbarrule #1 + \ifx#1\displaystyle% + \overarrowsmallerthickness = \Umathoverbarrule \textstyle% + \else\ifx#1\textstyle% + \overarrowsmallerthickness = \Umathoverbarrule \scriptstyle% + \else% + \overarrowsmallerthickness = \Umathoverbarrule \scriptscriptstyle% + \fi\fi% +} +% \end{macrocode} +% Test which version to use. +% \begin{macrocode} +\AddToHook{begindocument}[overarrows] + {% + \@ifpackageloaded{unicode-math-luatex} + {% + \global\let\ovar@set@arrowthickness\ovar@set@arrowthickness@UM@lua + } + {% + \@ifpackageloaded{unicode-math-xetex} + {% + \gdef\ovar@rulethickness@fontdimen{54} + \gdef\ovar@rulethickness@family{2} + } + {} + } + } +% \end{macrocode} +% \end{macro} % \end{macro} % % \subsubsection*{Stack macros} @@ -3017,18 +3415,39 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \subsubsection*{Macro for commands creation} % +% \changes{v1.2}{2024/07/11}{Allow backslash in command name} +% In the initial version, the commands names must be given as csname (without +% backslash). To harmonize the syntax with standard \cs{NewDocumentCommand}, +% define an argument processor so that both +% \cs{NewOverArrowCommand}|{\myarrow}| and +% \cs{NewOverArrowCommand}|{myarrow}| are accepted. +% +% \begin{macrocode} +\ExplSyntaxOn +\cs_new_protected:Npn \__overarrows_processor_strip_escape_char:n #1 + { + \regex_match:nnTF { ^\cC. } { #1 } + { \tl_set:Nx \ProcessedArgument { \cs_to_str:N #1 } } + { \tl_set:Nx \ProcessedArgument { #1 } } + } +\cs_new_eq:NN \ovar@cmdname@processor \__overarrows_processor_strip_escape_char:n +\ExplSyntaxOff +% \end{macrocode} +% % \begin{macro}{\DeclareOverArrowCommand} % \begin{macrocode} -\NewDocumentCommand{\DeclareOverArrowCommand}{ O{symb} m m }{% +\NewDocumentCommand{\DeclareOverArrowCommand}{ + O{symb} >{\ovar@cmdname@processor} m m +}{% \begingroup \ovar@set@common \ifcsdef{ovar@set@#1}{% \csuse{ovar@set@#1} }{% \PackageError{overarrows}{Unknown method #1} - {Try with 'symb', 'tikz' or 'picture'} + {Try with 'symb', 'tikz', 'pstriks' or 'picture'} } - \ovar@set{#3 } + \ovar@set{#3} \ifdef{\ovar@macro@arrow}{}{% \ovar@set{no arrow macro hook} } @@ -3050,7 +3469,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \ifovar@detectsubscripts@% \csgdef{ovar@#2@auto}##1{% % \end{macrocode} -% \vspace{-2\smallskipamount}%^^A remove space between code blocs +% \vspace{-2\smallskipamount}%^^A remove space between code blocks % \changes{v1.1}{2023/02/15}{Support for non-standard subscripts} % \begin{macrocode} \@ifnextchar \ovar@subcmd {% @@ -3080,7 +3499,9 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \begin{macro}{\ProvideOverArrowCommand} % \begin{macrocode} -\NewDocumentCommand{\ProvideOverArrowCommand}{ O{symb} m m }{% +\NewDocumentCommand{\ProvideOverArrowCommand}{ + O{symb} >{\ovar@cmdname@processor} m m +}{% \ifcsdef{#2}{}{ \DeclareOverArrowCommand[#1]{#2}{#3} } @@ -3090,7 +3511,9 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \begin{macro}{\NewOverArrowCommand} % \begin{macrocode} -\NewDocumentCommand{\NewOverArrowCommand}{ O{symb} m m }{% +\NewDocumentCommand{\NewOverArrowCommand}{ + O{symb} >{\ovar@cmdname@processor} m m +}{% \ifcsdef{#2}{% \PackageError{overarrows}{Command \csname #2\endcsname already defined}% {You have used \protect\NewOverArrowCommand\space with a command that @@ -3105,7 +3528,9 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \begin{macro}{\RenewOverArrowCommand} % \begin{macrocode} -\NewDocumentCommand{\RenewOverArrowCommand}{ O{symb} m m }{% +\NewDocumentCommand{\RenewOverArrowCommand}{ + O{symb} >{\ovar@cmdname@processor} m m +}{% \ifcsundef{#2}{% \PackageError{overarrows}{Command \csname #2\endcsname undefined}% {You have used \protect\RenewOverArrowCommand\space with a command that was @@ -3120,17 +3545,21 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \subsubsection*{Starred variant} % +% \changes{v1.2}{2024/07/11}{Use boxes in starred variant for better performances} % \begin{macro}{\ovar@starversion} % |#1|: definition (stack macro + arrow macro)\\ % |#2|: math style\\ % |#3|: content % \begin{macrocode} +\newsavebox\ovar@tempbox \def\ovar@starversion#1#2#3{% - #1#2{#3}% - \settowidth{\ovar@extralength}{$\m@th#1#2{#3}$} - \settowidth{\ovar@tempdim}{$\m@th#2{#3}$} - \deflength{\ovar@extralength}{0.5\ovar@extralength-0.5\ovar@tempdim}% - \kern-\ovar@extralength% + \sbox{\ovar@tempbox}{$\m@th #1#2{#3}$}% + \usebox{\ovar@tempbox}% +% \end{macrocode} +% Remove the extra space added by the arrow. +% \begin{macrocode} + \settowidth{\ovar@tempdim}{$\m@th #2{#3}$}% + \kern\dimeval{0.5\ovar@tempdim - 0.5\wd\ovar@tempbox}% } % \end{macrocode} % \end{macro} @@ -3144,7 +3573,11 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \ifovar@option@esvect@ \let\esvectvv\vv \undef\vv - \NewOverArrowCommand{vv}{esvect, middle config=auto} +% \end{macrocode} +% \changes{v1.2}{2024/07/11}{Use \refKey{middle config}|=relbareda| instead of +% \refKey{middle config}|=auto|} +% \begin{macrocode} + \NewOverArrowCommand{\vv}{esvect, middle config = relbareda} \fi % \end{macrocode} % \end{macro} @@ -3152,216 +3585,231 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \subsubsection*{Predefined commands} % +% \changes{v1.2}{2024/07/11}{Declare predefined commands after \pkg{unicode-math} settings} +% Declare predefined commands after \pkg{unicode-math} settings. +% +% \begin{macrocode} +\AddToHook{begindocument}[overarrows] + { +% \end{macrocode} +% % \begin{macro}{\overrightarrow} % \begin{macrocode} -\ifovar@option@overrightarrow@ - \DeclareOverArrowCommand{overrightarrow}{% - amsmath, middle config=relbar, - end=\ovar@rightarrow, - right arrow, - } -\fi + \ifovar@option@overrightarrow@ + \DeclareOverArrowCommand{\overrightarrow}{% + amsmath, middle config=relbar, + end=\ovar@rightarrow, + right arrow, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\underrightarrow} % \begin{macrocode} -\ifovar@option@underrightarrow@ - \DeclareOverArrowCommand{underrightarrow}{% - amsmath, middle config=relbar, - end=\ovar@rightarrow, - right arrow, - arrow under, - } -\fi + \ifovar@option@underrightarrow@ + \DeclareOverArrowCommand{\underrightarrow}{% + amsmath, middle config=relbar, + end=\ovar@rightarrow, + right arrow, + arrow under, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\overleftarrow} % \begin{macrocode} -\ifovar@option@overleftarrow@ - \DeclareOverArrowCommand{overleftarrow}{% - amsmath, middle config=relbar, - start=\ovar@leftarrow, - end=\relbar, - left arrow, - } -\fi + \ifovar@option@overleftarrow@ + \DeclareOverArrowCommand{\overleftarrow}{% + amsmath, middle config=relbar, + start=\ovar@leftarrow, + end=\relbar, + left arrow, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\underleftarrow} % \begin{macrocode} -\ifovar@option@underleftarrow@ - \DeclareOverArrowCommand{underleftarrow}{% - amsmath, middle config=relbar, - start=\ovar@leftarrow, - end=\relbar, - left arrow, - arrow under, - } -\fi + \ifovar@option@underleftarrow@ + \DeclareOverArrowCommand{\underleftarrow}{% + amsmath, middle config=relbar, + start=\ovar@leftarrow, + end=\relbar, + left arrow, + arrow under, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\overleftrightarrow} % \begin{macrocode} -\ifovar@option@overleftrightarrow@ - \DeclareOverArrowCommand{overleftrightarrow}{% - amsmath, middle config=relbar, - start=\ovar@leftarrow, - end=\ovar@rightarrow, - center arrow, - } -\fi + \ifovar@option@overleftrightarrow@ + \DeclareOverArrowCommand{\overleftrightarrow}{% + amsmath, middle config=relbar, + start=\ovar@leftarrow, + end=\ovar@rightarrow, + center arrow, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\underleftrightarrow} % \begin{macrocode} -\ifovar@option@underleftrightarrow@ - \DeclareOverArrowCommand{underleftrightarrow}{% - amsmath, middle config=relbar, - start=\ovar@leftarrow, - end=\ovar@rightarrow, - center arrow, - arrow under, - } -\fi + \ifovar@option@underleftrightarrow@ + \DeclareOverArrowCommand{\underleftrightarrow}{% + amsmath, middle config=relbar, + start=\ovar@leftarrow, + end=\ovar@rightarrow, + center arrow, + arrow under, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\overrightharpoonup} % \begin{macrocode} -\ifovar@option@overrightharpoonup@ - \DeclareOverArrowCommand{overrightharpoonup}{% - amsmath, middle config=relbar, - end=\rightharpoonup, - right arrow, - } -\fi + \ifovar@option@overrightharpoonup@ + \DeclareOverArrowCommand{\overrightharpoonup}{% + amsmath, middle config=relbar, + end=\rightharpoonup, + right arrow, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\underrightharpoonup} % \begin{macrocode} -\ifovar@option@underrightharpoonup@ - \DeclareOverArrowCommand{underrightharpoonup}{% - amsmath, middle config=relbar, - end=\rightharpoonup, - right arrow, - arrow under, - } -\fi + \ifovar@option@underrightharpoonup@ + \DeclareOverArrowCommand{\underrightharpoonup}{% + amsmath, middle config=relbar, + end=\rightharpoonup, + right arrow, + arrow under, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\overrightharpoondown} % \begin{macrocode} -\ifovar@option@overrightharpoondown@ - \DeclareOverArrowCommand{overrightharpoondown}{% - amsmath, middle config=relbar, - end=\rightharpoondown, - right arrow, - } -\fi + \ifovar@option@overrightharpoondown@ + \DeclareOverArrowCommand{\overrightharpoondown}{% + amsmath, middle config=relbar, + end=\rightharpoondown, + right arrow, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\underrightharpoondown} % \begin{macrocode} -\ifovar@option@underrightharpoondown@ - \DeclareOverArrowCommand{underrightharpoondown}{% - amsmath, middle config=relbar, - end=\rightharpoondown, - right arrow, - arrow under, - } -\fi + \ifovar@option@underrightharpoondown@ + \DeclareOverArrowCommand{\underrightharpoondown}{% + amsmath, middle config=relbar, + end=\rightharpoondown, + right arrow, + arrow under, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\overleftharpoonup} % \begin{macrocode} -\ifovar@option@overleftharpoonup@ - \DeclareOverArrowCommand{overleftharpoonup}{% - amsmath, middle config=relbar, - start=\leftharpoonup, - end=\relbar, - left arrow, - } -\fi + \ifovar@option@overleftharpoonup@ + \DeclareOverArrowCommand{\overleftharpoonup}{% + amsmath, middle config=relbar, + start=\leftharpoonup, + end=\relbar, + left arrow, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\underleftharpoonup} % \begin{macrocode} -\ifovar@option@underleftharpoonup@ - \DeclareOverArrowCommand{underleftharpoonup}{% - amsmath, middle config=relbar, - start=\leftharpoonup, - end=\relbar, - left arrow, - arrow under, - } -\fi + \ifovar@option@underleftharpoonup@ + \DeclareOverArrowCommand{\underleftharpoonup}{% + amsmath, middle config=relbar, + start=\leftharpoonup, + end=\relbar, + left arrow, + arrow under, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\overleftharpoondown} % \begin{macrocode} -\ifovar@option@overleftharpoondown@ - \DeclareOverArrowCommand{overleftharpoondown}{% - amsmath, middle config=relbar, - start=\leftharpoondown, - end=\relbar, - left arrow, - } -\fi + \ifovar@option@overleftharpoondown@ + \DeclareOverArrowCommand{\overleftharpoondown}{% + amsmath, middle config=relbar, + start=\leftharpoondown, + end=\relbar, + left arrow, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\underleftharpoondown} % \begin{macrocode} -\ifovar@option@underleftharpoondown@ - \DeclareOverArrowCommand{underleftharpoondown}{% - amsmath, middle config=relbar, - start=\leftharpoondown, - end=\relbar, - left arrow, - arrow under, - } -\fi + \ifovar@option@underleftharpoondown@ + \DeclareOverArrowCommand{\underleftharpoondown}{% + amsmath, middle config=relbar, + start=\leftharpoondown, + end=\relbar, + left arrow, + arrow under, + } + \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\overbar} % \begin{macrocode} -\ifovar@option@overbar@ - \DeclareOverArrowCommand{overbar}{% - amsmath, middle config=relbar, - start={\std@minus}, end={\std@minus},% \relbar is defined with \mathsm@sh - shift leftright=0, - space after arrow=-0.3ex, - } -\fi + \ifovar@option@overbar@ + \DeclareOverArrowCommand{\overbar}{% + amsmath, middle config=relbar, + start={\std@minus}, end={\std@minus},% \relbar is defined with \mathsm@sh + shift leftright=0, + space after arrow=-0.3ex, + } + \fi % \end{macrocode} % \end{macro} % +% With \pkg{unicode-math}, add |\vphantom{+}| to get the correct position. % \begin{macro}{\underbar} % \begin{macrocode} -\ifovar@option@underbar@ - \DeclareOverArrowCommand{underbar}{% - amsmath, middle config=relbar, - start={\std@minus}, end={\std@minus},% \relbar is defined with \mathsm@sh - shift leftright=0, - arrow under, - space before arrow=-0.3ex, - } -\fi + \ifovar@option@underbar@ + \DeclareOverArrowCommand{\underbar}{% + amsmath, middle config=relbar, + start={\vphantom{+}\std@minus}, end={\std@minus},% \relbar is defined with \mathsm@sh + shift leftright=0, + arrow under, + space before arrow=-0.3ex, + } + \fi % \end{macrocode} % \end{macro} % +% End of |\AddToHook{begindocument}| hook. +% \begin{macrocode} + } +% \end{macrocode} +% +% % \subsubsection*{Test macros} % % \begin{macro}{\ovar@testmathstyles} @@ -3422,7 +3870,9 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ % % \begin{macro}{\TestOverArrow} % \begin{macrocode} -\NewDocumentCommand{\TestOverArrow}{ s o m }{ +\NewDocumentCommand{\TestOverArrow}{ + s o >{\ovar@cmdname@processor} m +}{% \ifcsdef{#3}{}{% \PackageWarning{overarrows}{Unknown name '#3' passed to \protect\TestOverArrow} @@ -3494,6 +3944,7 @@ $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $ \lstdefinestyle{lstovardoc}{% language = [LaTeX]TeX, columns = flexible, + keepspaces = true, keywordstyle = {\bfseries\color{ovar_darkblue}}, texcsstyle = *{\bfseries\color{ovar_darkblue}}, commentstyle = {\color{gray}}, @@ -3618,7 +4069,7 @@ actual '=' name=macrocode, firstnumber=auto, style = lstovarcode, - showlines=false, + showlines = false, % \end{macrocode} % Commands and lengths identification and indexing % @@ -3648,8 +4099,9 @@ actual '=' % \begin{macrocode} texcs = [4]{% internal macros ovar@rightarrow, ovar@leftarrow, ifovar@option@oldarrows@, - ifovar@option@esvect@, ifovar@option@tikz@, ifovar@option@pstarrows@, - ifovar@detectsubscripts@, ifovar@option@debug@, + ifovar@option@esvect@, ifovar@option@tikz@, ifovar@option@pstricks@, + ifovar@option@pstarrows@, ifovar@detectsubscripts@, + ifovar@option@subother@, ifovar@option@subactive@, ifovar@option@debug@, ifovar@option@overrightarrow@, ifovar@option@underrightarrow@, ifovar@option@overleftarrow@, ifovar@option@underleftarrow@, ifovar@option@overleftrightarrow@, ifovar@option@underleftrightarrow@, @@ -3657,20 +4109,23 @@ actual '=' ifovar@option@overrightharpoondown@, ifovar@option@underrightharpoondown@, ifovar@option@overleftharpoonup@, ifovar@option@underleftharpoonup@, ifovar@option@overleftharpoondown@, ifovar@option@underleftharpoondown@, - ifovar@option@overbar@, ifovar@option@underbar@, ovar@set, ovar@length@min, + ifovar@option@overbar@, ifovar@option@underbar@, ovar@auto@middle, + ovar@auto@trim@middle, ovar@subcmd, ovar@set, ovar@length@min, ovar@before@arrow, ovar@after@arrow, ovar@macro@stack, ovar@macro@arrow, - ovar@set@, ovar@shift@left, ovar@shift@right, ovar@stack@fill, - ovar@stackunder@fill, ovar@stack@lens, ovar@stackunder@lens, - ovar@macro@arrowfill, ovar@arrow@fill, ovar@arrow@start, ovar@trim@start, - ovar@trim@middle, ovar@arrow@middle, ovar@trim@end, ovar@arrow@end, - ovar@tikz@command, ovar@tikz@pathoptions, ovar@tikz@path, - ovar@tikz@options, ovar@picture@geometry, ovar@picture@linethickness, - ovar@picture@command, ovar@extralength, ovar@tempdim, ovar@set@arrowlength, - ovar@set@arrowthickness, ovar@stackover@@, ovar@stackunder@@, - ovar@stackover@, ovar@stackunder@, ovar@stackover@fill, - ovar@stackover@lens, ovar@set@common, ovar@starversion, - ovar@testmathstyles, ovar@row@teststyle,% - ifovar@option@subother@,ifovar@option@subactive@,ovar@subcmd,ovar@testkerning,% + ovar@shift@left, ovar@shift@right, ovar@stack@fill, ovar@stackunder@fill, + ovar@stack@lens, ovar@stackunder@lens, ovar@macro@arrowfill, + ovar@arrow@fill, ovar@arrow@start, ovar@trim@start, ovar@trim@middle, + ovar@arrow@middle, ovar@trim@end, ovar@arrow@end, ovar@tikz@command, + ovar@tikz@pathoptions, ovar@tikz@path, ovar@tikz@options, + ovar@pstricks@geometry, ovar@pstricks@linethickness, ovar@pstricks@psset, + ovar@pstricks@command, ovar@picture@geometry, ovar@picture@linethickness, + ovar@picture@command, ovar@tempdim, ovar@set@arrowlength, + ovar@set@arrowthickness, ovar@set@arrowthickness@UM@lua, + ovar@rulethickness@fontdimen, ovar@rulethickness@family, ovar@stackover@@, + ovar@stackunder@@, ovar@stackover@, ovar@stackunder@, ovar@stackover@fill, + ovar@stackover@lens, ovar@cmdname@processor, ovar@set@common, + ovar@starversion, ovar@tempbox, ovar@testmathstyles, ovar@row@teststyle, + ovar@testkerning% }, index = [4][texcs4],% indexstyle = [4]\indexmacrointernal,% @@ -3678,20 +4133,25 @@ actual '=' % Other macros identification % \begin{macrocode} moretexcs = [5]{% other macros - Relbar, relbareda, relbaredd, rightarrow, Rightarrow, varleftarrow, - varrightarrow, twoheadrightarrow,% + relbar, Relbar, relbareda, relbaredd, harrowextender, rightarrow, + Rightarrow, varleftarrow, varrightarrow, twoheadrightarrow,% }, % \end{macrocode} -% Il would be nice to also index keys, but spaces are badly handled by listings. +% Il would be nice to also index keys, but spaces are badly handled by +% \pkg{listings}. % \begin{macrocode} %^^A morekeywords = [2]{% -%^^A no stack macro hook, stack macro, arrow macro, no arrow macro hook, min -%^^A length, before arrow, after arrow, space before arrow, space after arrow, -%^^A shift left, shift right, shift leftright, center arrow, left arrow, right -%^^A arrow, arrow under, fill macro, start, middle, end, trim start, trim -%^^A middle, trim end, trim, no trimming, middle config, amsmath, esvect, tikz -%^^A command, tikz options, path options, path, add path options, add tikz -%^^A options, arrows, line thickness, thinner, picture command, geometry, detect subscripts, +%^^A overarrows, no stack macro hook, stack macro, detect subscripts, arrow +%^^A macro, no arrow macro hook, min length, before arrow, after arrow, space +%^^A before arrow, space after arrow, shift left, shift right, shift leftright, +%^^A center arrow, left arrow, right arrow, arrow under, arrow under/noconfig, +%^^A arrow under/autoconfig, fill macro, start, middle, end, trim start, trim +%^^A middle, trim end, trim, no trimming, middle config, middle config/relbar, +%^^A middle config/relbareda, middle config/harrowextender, middle config/auto, +%^^A amsmath, amsmath/mimic, amsmath/strict, esvect, esvect/mimic, +%^^A esvect/strict, tikz command, tikz options, path options, path, add path +%^^A options, add tikz options, arrows, line thickness, thinner, pstricks +%^^A command, psset, geometry, arrow, picture command,% %^^A }, %^^A index = [3][keywords2],% %^^A indexstyle = [3]\lstindexmacro,% diff --git a/Master/texmf-dist/tex/latex/overarrows/overarrows.sty b/Master/texmf-dist/tex/latex/overarrows/overarrows.sty index f954f12b55b..db0b1b04322 100644 --- a/Master/texmf-dist/tex/latex/overarrows/overarrows.sty +++ b/Master/texmf-dist/tex/latex/overarrows/overarrows.sty @@ -17,10 +17,11 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{overarrows} -[2023/02/15 v1.1 Custom extensible arrows over math expressions] +[2024/07/11 v1.2 Custom extensible arrows over math expressions] \newif\ifovar@option@oldarrows@ \newif\ifovar@option@esvect@ \ovar@option@esvect@true \PassOptionsToPackage{f}{esvect} \newif\ifovar@option@tikz@ +\newif\ifovar@option@pstricks@ \newif\ifovar@option@pstarrows@ \newif\ifovar@detectsubscripts@ \newif\ifovar@option@subother@ @@ -54,6 +55,7 @@ \DeclareOption{esvecth}{\ovar@option@esvect@true\PassOptionsToPackage{h}{esvect}} \DeclareOption{old-arrows}{\ovar@option@oldarrows@true} \DeclareOption{tikz}{\ovar@option@tikz@true} +\DeclareOption{pstricks}{\ovar@option@pstricks@true} \DeclareOption{pstarrows}{\ovar@option@pstarrows@true} \DeclareOption{subscripts}{\ovar@detectsubscripts@true} \DeclareOption{subother}{\ovar@option@subother@true} @@ -117,35 +119,70 @@ \ProcessOptions\relax \RequirePackage{amsmath} \RequirePackage{etoolbox} -\let\ovar@rightarrow\rightarrow -\let\ovar@leftarrow\leftarrow +\def\ovar@rightarrow{\rightarrow} +\def\ovar@leftarrow{\leftarrow} \ifovar@option@oldarrows@ \RequirePackage[old]{old-arrows} - \let\ovar@rightarrow\varrightarrow - \let\ovar@leftarrow\varleftarrow + \def\ovar@rightarrow{\varrightarrow} + \def\ovar@leftarrow{\varleftarrow} \fi \ifovar@option@esvect@ \RequirePackage{esvect} + \DeclareFontFamily{U}{esvect}{} + \DeclareFontShape{U}{esvect}{m}{n}{ + <-5.5> vect5 + <5.5-6.5> vect6 + <6.5-7.5> vect7 + <7.5-8.5> vect8 + <8.5-9.5> vect9 + <9.5-> vect10 + }{} \fi \ifovar@option@tikz@ \RequirePackage{tikz} \usetikzlibrary{arrows.meta} \fi +\ifovar@option@pstricks@ + \RequirePackage{pstricks-add} +\fi \ifovar@option@pstarrows@ \RequirePackage[pstarrows]{pict2e} \fi +\DeclareHookRule{begindocument}{overarrows}{after}{unicode-math-luatex} +\DeclareHookRule{begindocument}{overarrows}{after}{unicode-math-xetex} +\AddToHook{begindocument}[overarrows] + {% + \ifdef{\relbareda} + {% + \gdef\ovar@auto@middle{\relbareda} + \gdef\ovar@auto@trim@middle{1} + } + {% + \gdef\ovar@auto@middle{\relbar} + \gdef\ovar@auto@trim@middle{2.5} + }% + \@ifpackageloaded{unicode-math} + {% + \check@mathfonts + \iffontchar\textfont\tw@\string"23AF + \gdef\ovar@auto@middle{\mathrel\harrowextender} + \gdef\ovar@auto@trim@middle{0} + \fi + } + {}% + } \newcommand{\SetOverArrowsSubscriptCommand}[1]{\global\let\ovar@subcmd=#1} \SetOverArrowsSubscriptCommand{_} \ifovar@option@subother@ \begingroup \catcode `_=12 - \AddToHook{begindocument/end}{\SetOverArrowsSubscriptCommand{_}} + \SetOverArrowsSubscriptCommand{_}% \endgroup \fi \ifovar@option@subactive@ \begingroup \catcode `_=13 - \AddToHook{begindocument/end}{\SetOverArrowsSubscriptCommand{_}} + \SetOverArrowsSubscriptCommand{_}% \endgroup \fi \RequirePackage{pgfkeys} @@ -286,12 +323,17 @@ } } }, + middle config/harrowextender/.code={% + \pgfkeysalso{% + middle={\harrowextender}, + trim middle={0}, + } + }, middle config/auto/.code={% - \ifovar@option@esvect@ - \pgfkeysalso{middle config=relbareda} - \else - \pgfkeysalso{middle config=relbar} - \fi + \pgfkeysalso{% + middle={\ovar@auto@middle}, + trim middle={\ovar@auto@trim@middle}, + } }, amsmath/.is choice,% amsmath/mimic/.code=\pgfkeysalso{% @@ -369,6 +411,39 @@ shift right=-2, min length=12, } +\SetOverArrowsMethod[lens]{pstricks}{% + no arrow macro hook/.code={% + \ovar@set{% + arrow macro/.expanded={% + $\noexpand\mkern \expandonce{\ovar@shift@left} mu\noexpand\relax$% + \noexpand\begin{pspicture}\expandonce{\ovar@pstricks@geometry}% + \noexpand\psset{linewidth=\expandonce{\ovar@pstricks@linethickness}}% + \noexpand\psset{\expandonce{\ovar@pstricks@psset}}% + \expandonce{\ovar@pstricks@command}% + \noexpand\end{pspicture}% + $\noexpand\mkern \expandonce{\ovar@shift@right} mu\noexpand\relax$% + } + } + }, + pstricks command/.store in=\ovar@pstricks@command, + psset/.store in=\ovar@pstricks@psset, + geometry/.store in=\ovar@pstricks@geometry, + line thickness/.store in=\ovar@pstricks@linethickness, + pstricks command/.value required, + psset/.value required, + geometry/.value required, + line thickness/.value required, + arrow/.style={pstricks command={\psline{##1}(0,0)(\overarrowlength,0)}},% + arrow/.value required,% + thinner/.style={line thickness={\overarrowsmallerthickness}},% + thinner/.value forbidden,% + shift right=-2, + min length=12, + geometry={(0,-0.5ex)(\overarrowlength,0.5ex)},% + line thickness={\overarrowthickness},% + arrow={->},% + psset={},% +} \SetOverArrowsMethod[lens]{picture}{% no arrow macro hook/.code={% \ovar@set{% @@ -413,28 +488,61 @@ \newlength{\overarrowlength} \newlength{\overarrowthickness} \newlength{\overarrowsmallerthickness} -\newlength{\ovar@extralength} \newlength{\ovar@tempdim} \def\ovar@set@arrowlength#1#2#3{% \settowidth{\ovar@tempdim}{$\m@th#2\mskip #1 mu\relax$}% \settowidth{\overarrowlength}{$\m@th#2#3$}% \ifdim \overarrowlength < \ovar@tempdim \overarrowlength=\ovar@tempdim\fi% } -\def\ovar@set@arrowthickness#1{% use rule thickness=\fontdimen 8 font family 3 +\def\ovar@rulethickness@fontdimen{8} +\def\ovar@rulethickness@family{3} +\def\ovar@set@arrowthickness#1{% \ifx#1\displaystyle% - \overarrowthickness = \fontdimen 8 \textfont 3% - \overarrowsmallerthickness = \fontdimen 8 \scriptfont 3% + \overarrowthickness = + \fontdimen \ovar@rulethickness@fontdimen \textfont \ovar@rulethickness@family% + \overarrowsmallerthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family% \else\ifx#1\textstyle% - \overarrowthickness = \fontdimen 8 \textfont 3% - \overarrowsmallerthickness = \fontdimen 8 \scriptfont 3% + \overarrowthickness = + \fontdimen \ovar@rulethickness@fontdimen \textfont \ovar@rulethickness@family% + \overarrowsmallerthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family% \else\ifx#1\scriptstyle% - \overarrowthickness = \fontdimen 8 \scriptfont 3% - \overarrowsmallerthickness = \fontdimen 8 \scriptscriptfont 3% + \overarrowthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family% + \overarrowsmallerthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptscriptfont \ovar@rulethickness@family% \else% - \overarrowthickness = \fontdimen 8 \scriptscriptfont 3% + \overarrowthickness = + \fontdimen \ovar@rulethickness@fontdimen \scriptscriptfont \ovar@rulethickness@family% \overarrowsmallerthickness = \overarrowthickness% \fi\fi\fi% } +\def\ovar@set@arrowthickness@UM@lua#1{% + \overarrowthickness = \Umathoverbarrule #1 + \ifx#1\displaystyle% + \overarrowsmallerthickness = \Umathoverbarrule \textstyle% + \else\ifx#1\textstyle% + \overarrowsmallerthickness = \Umathoverbarrule \scriptstyle% + \else% + \overarrowsmallerthickness = \Umathoverbarrule \scriptscriptstyle% + \fi\fi% +} +\AddToHook{begindocument}[overarrows] + {% + \@ifpackageloaded{unicode-math-luatex} + {% + \global\let\ovar@set@arrowthickness\ovar@set@arrowthickness@UM@lua + } + {% + \@ifpackageloaded{unicode-math-xetex} + {% + \gdef\ovar@rulethickness@fontdimen{54} + \gdef\ovar@rulethickness@family{2} + } + {} + } + } \def\ovar@stackover@@#1#2#3#4#5#6{\vbox{\ialign{##\crcr% $#5\mskip #1 mu\relax$\crcr% \noalign{#2\nointerlineskip}#4\crcr% @@ -467,16 +575,27 @@ \ovar@stackunder@{#2}{#3}{#4}{#5}{#6}% } \def\ovar@stack@lens{\ovar@stackover@lens} -\NewDocumentCommand{\DeclareOverArrowCommand}{ O{symb} m m }{% +\ExplSyntaxOn +\cs_new_protected:Npn \__overarrows_processor_strip_escape_char:n #1 + { + \regex_match:nnTF { ^\cC. } { #1 } + { \tl_set:Nx \ProcessedArgument { \cs_to_str:N #1 } } + { \tl_set:Nx \ProcessedArgument { #1 } } + } +\cs_new_eq:NN \ovar@cmdname@processor \__overarrows_processor_strip_escape_char:n +\ExplSyntaxOff +\NewDocumentCommand{\DeclareOverArrowCommand}{ + O{symb} >{\ovar@cmdname@processor} m m +}{% \begingroup \ovar@set@common \ifcsdef{ovar@set@#1}{% \csuse{ovar@set@#1} }{% \PackageError{overarrows}{Unknown method #1} - {Try with 'symb', 'tikz' or 'picture'} + {Try with 'symb', 'tikz', 'pstriks' or 'picture'} } - \ovar@set{#3 } + \ovar@set{#3} \ifdef{\ovar@macro@arrow}{}{% \ovar@set{no arrow macro hook} } @@ -519,12 +638,16 @@ \fi \endgroup } -\NewDocumentCommand{\ProvideOverArrowCommand}{ O{symb} m m }{% +\NewDocumentCommand{\ProvideOverArrowCommand}{ + O{symb} >{\ovar@cmdname@processor} m m +}{% \ifcsdef{#2}{}{ \DeclareOverArrowCommand[#1]{#2}{#3} } } -\NewDocumentCommand{\NewOverArrowCommand}{ O{symb} m m }{% +\NewDocumentCommand{\NewOverArrowCommand}{ + O{symb} >{\ovar@cmdname@processor} m m +}{% \ifcsdef{#2}{% \PackageError{overarrows}{Command \csname #2\endcsname already defined}% {You have used \protect\NewOverArrowCommand\space with a command that @@ -534,7 +657,9 @@ \DeclareOverArrowCommand[#1]{#2}{#3} } } -\NewDocumentCommand{\RenewOverArrowCommand}{ O{symb} m m }{% +\NewDocumentCommand{\RenewOverArrowCommand}{ + O{symb} >{\ovar@cmdname@processor} m m +}{% \ifcsundef{#2}{% \PackageError{overarrows}{Command \csname #2\endcsname undefined}% {You have used \protect\RenewOverArrowCommand\space with a command that was @@ -544,148 +669,151 @@ \DeclareOverArrowCommand[#1]{#2}{#3} } } +\newsavebox\ovar@tempbox \def\ovar@starversion#1#2#3{% - #1#2{#3}% - \settowidth{\ovar@extralength}{$\m@th#1#2{#3}$} - \settowidth{\ovar@tempdim}{$\m@th#2{#3}$} - \deflength{\ovar@extralength}{0.5\ovar@extralength-0.5\ovar@tempdim}% - \kern-\ovar@extralength% + \sbox{\ovar@tempbox}{$\m@th #1#2{#3}$}% + \usebox{\ovar@tempbox}% + \settowidth{\ovar@tempdim}{$\m@th #2{#3}$}% + \kern\dimeval{0.5\ovar@tempdim - 0.5\wd\ovar@tempbox}% } \ifovar@option@esvect@ \let\esvectvv\vv \undef\vv - \NewOverArrowCommand{vv}{esvect, middle config=auto} -\fi -\ifovar@option@overrightarrow@ - \DeclareOverArrowCommand{overrightarrow}{% - amsmath, middle config=relbar, - end=\ovar@rightarrow, - right arrow, - } -\fi -\ifovar@option@underrightarrow@ - \DeclareOverArrowCommand{underrightarrow}{% - amsmath, middle config=relbar, - end=\ovar@rightarrow, - right arrow, - arrow under, - } -\fi -\ifovar@option@overleftarrow@ - \DeclareOverArrowCommand{overleftarrow}{% - amsmath, middle config=relbar, - start=\ovar@leftarrow, - end=\relbar, - left arrow, - } -\fi -\ifovar@option@underleftarrow@ - \DeclareOverArrowCommand{underleftarrow}{% - amsmath, middle config=relbar, - start=\ovar@leftarrow, - end=\relbar, - left arrow, - arrow under, - } -\fi -\ifovar@option@overleftrightarrow@ - \DeclareOverArrowCommand{overleftrightarrow}{% - amsmath, middle config=relbar, - start=\ovar@leftarrow, - end=\ovar@rightarrow, - center arrow, - } -\fi -\ifovar@option@underleftrightarrow@ - \DeclareOverArrowCommand{underleftrightarrow}{% - amsmath, middle config=relbar, - start=\ovar@leftarrow, - end=\ovar@rightarrow, - center arrow, - arrow under, - } -\fi -\ifovar@option@overrightharpoonup@ - \DeclareOverArrowCommand{overrightharpoonup}{% - amsmath, middle config=relbar, - end=\rightharpoonup, - right arrow, - } -\fi -\ifovar@option@underrightharpoonup@ - \DeclareOverArrowCommand{underrightharpoonup}{% - amsmath, middle config=relbar, - end=\rightharpoonup, - right arrow, - arrow under, - } + \NewOverArrowCommand{\vv}{esvect, middle config = relbareda} \fi -\ifovar@option@overrightharpoondown@ - \DeclareOverArrowCommand{overrightharpoondown}{% - amsmath, middle config=relbar, - end=\rightharpoondown, - right arrow, - } -\fi -\ifovar@option@underrightharpoondown@ - \DeclareOverArrowCommand{underrightharpoondown}{% - amsmath, middle config=relbar, - end=\rightharpoondown, - right arrow, - arrow under, - } -\fi -\ifovar@option@overleftharpoonup@ - \DeclareOverArrowCommand{overleftharpoonup}{% - amsmath, middle config=relbar, - start=\leftharpoonup, - end=\relbar, - left arrow, - } -\fi -\ifovar@option@underleftharpoonup@ - \DeclareOverArrowCommand{underleftharpoonup}{% - amsmath, middle config=relbar, - start=\leftharpoonup, - end=\relbar, - left arrow, - arrow under, - } -\fi -\ifovar@option@overleftharpoondown@ - \DeclareOverArrowCommand{overleftharpoondown}{% - amsmath, middle config=relbar, - start=\leftharpoondown, - end=\relbar, - left arrow, - } -\fi -\ifovar@option@underleftharpoondown@ - \DeclareOverArrowCommand{underleftharpoondown}{% - amsmath, middle config=relbar, - start=\leftharpoondown, - end=\relbar, - left arrow, - arrow under, - } -\fi -\ifovar@option@overbar@ - \DeclareOverArrowCommand{overbar}{% - amsmath, middle config=relbar, - start={\std@minus}, end={\std@minus},% \relbar is defined with \mathsm@sh - shift leftright=0, - space after arrow=-0.3ex, - } -\fi -\ifovar@option@underbar@ - \DeclareOverArrowCommand{underbar}{% - amsmath, middle config=relbar, - start={\std@minus}, end={\std@minus},% \relbar is defined with \mathsm@sh - shift leftright=0, - arrow under, - space before arrow=-0.3ex, +\AddToHook{begindocument}[overarrows] + { + \ifovar@option@overrightarrow@ + \DeclareOverArrowCommand{\overrightarrow}{% + amsmath, middle config=relbar, + end=\ovar@rightarrow, + right arrow, + } + \fi + \ifovar@option@underrightarrow@ + \DeclareOverArrowCommand{\underrightarrow}{% + amsmath, middle config=relbar, + end=\ovar@rightarrow, + right arrow, + arrow under, + } + \fi + \ifovar@option@overleftarrow@ + \DeclareOverArrowCommand{\overleftarrow}{% + amsmath, middle config=relbar, + start=\ovar@leftarrow, + end=\relbar, + left arrow, + } + \fi + \ifovar@option@underleftarrow@ + \DeclareOverArrowCommand{\underleftarrow}{% + amsmath, middle config=relbar, + start=\ovar@leftarrow, + end=\relbar, + left arrow, + arrow under, + } + \fi + \ifovar@option@overleftrightarrow@ + \DeclareOverArrowCommand{\overleftrightarrow}{% + amsmath, middle config=relbar, + start=\ovar@leftarrow, + end=\ovar@rightarrow, + center arrow, + } + \fi + \ifovar@option@underleftrightarrow@ + \DeclareOverArrowCommand{\underleftrightarrow}{% + amsmath, middle config=relbar, + start=\ovar@leftarrow, + end=\ovar@rightarrow, + center arrow, + arrow under, + } + \fi + \ifovar@option@overrightharpoonup@ + \DeclareOverArrowCommand{\overrightharpoonup}{% + amsmath, middle config=relbar, + end=\rightharpoonup, + right arrow, + } + \fi + \ifovar@option@underrightharpoonup@ + \DeclareOverArrowCommand{\underrightharpoonup}{% + amsmath, middle config=relbar, + end=\rightharpoonup, + right arrow, + arrow under, + } + \fi + \ifovar@option@overrightharpoondown@ + \DeclareOverArrowCommand{\overrightharpoondown}{% + amsmath, middle config=relbar, + end=\rightharpoondown, + right arrow, + } + \fi + \ifovar@option@underrightharpoondown@ + \DeclareOverArrowCommand{\underrightharpoondown}{% + amsmath, middle config=relbar, + end=\rightharpoondown, + right arrow, + arrow under, + } + \fi + \ifovar@option@overleftharpoonup@ + \DeclareOverArrowCommand{\overleftharpoonup}{% + amsmath, middle config=relbar, + start=\leftharpoonup, + end=\relbar, + left arrow, + } + \fi + \ifovar@option@underleftharpoonup@ + \DeclareOverArrowCommand{\underleftharpoonup}{% + amsmath, middle config=relbar, + start=\leftharpoonup, + end=\relbar, + left arrow, + arrow under, + } + \fi + \ifovar@option@overleftharpoondown@ + \DeclareOverArrowCommand{\overleftharpoondown}{% + amsmath, middle config=relbar, + start=\leftharpoondown, + end=\relbar, + left arrow, + } + \fi + \ifovar@option@underleftharpoondown@ + \DeclareOverArrowCommand{\underleftharpoondown}{% + amsmath, middle config=relbar, + start=\leftharpoondown, + end=\relbar, + left arrow, + arrow under, + } + \fi + \ifovar@option@overbar@ + \DeclareOverArrowCommand{\overbar}{% + amsmath, middle config=relbar, + start={\std@minus}, end={\std@minus},% \relbar is defined with \mathsm@sh + shift leftright=0, + space after arrow=-0.3ex, + } + \fi + \ifovar@option@underbar@ + \DeclareOverArrowCommand{\underbar}{% + amsmath, middle config=relbar, + start={\vphantom{+}\std@minus}, end={\std@minus},% \relbar is defined with \mathsm@sh + shift leftright=0, + arrow under, + space before arrow=-0.3ex, + } + \fi } -\fi \newcommand{\ovar@testmathstyles}[2][]{ \begingroup \newcommand*{\ovar@row@teststyle}[1]{% @@ -728,7 +856,9 @@ \end{displaymath} } \endgroup -\NewDocumentCommand{\TestOverArrow}{ s o m }{ +\NewDocumentCommand{\TestOverArrow}{ + s o >{\ovar@cmdname@processor} m +}{% \ifcsdef{#3}{}{% \PackageWarning{overarrows}{Unknown name '#3' passed to \protect\TestOverArrow} |