Debian Codegraph @

texmf-dist/source/latex/overarrows/overarrows.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2023-2025 by Julien Labbé <[email protected]>
4 %
5 % This file may be distributed and/or modified under the conditions of the
6 % LaTeX Project Public License (LPPL), either version 1.3c of this license or
7 % (at your option) any later version. The latest version of this license is in
8 % the file https://www.latex-project.org/lppl.txt
9 %
10 % \fi
11 %
12 % \iffalse
13 %<*driver>
14 \ProvidesFile{overarrows.dtx}
15 %</driver>
16 %<package>\NeedsTeXFormat{LaTeX2e}
17 %<package>\ProvidesPackage{overarrows}
18 %<*package>
19 [2025/10/19 v1.5 Custom extensible arrows over math expressions]
20 %</package>
21 %
22 %<*driver>
23 \documentclass[nohyperref]{ltxdoc}
24 \usepackage{metalogo}
25 \usepackage{enumitem}
26 \usepackage{array}
27
28 \usepackage{overarrows-doc} %^^A defined at end of this file, with guard <docstyle>
29 \usepackage[old-arrows, esvect, tikz, pstricks, pstarrows, allcommands]{overarrows}
30
31 \EnableCrossrefs
32 \PageIndex
33 % \CodelineIndex
34 \RecordChanges
35 % \OnlyDescription
36
37 %% symbols
38 \newcommand*{\symb}[1]{\colorbox{yellow!50}{\rule{0pt}{1ex}$#1$}}
39
40 %% Arrows used in doc
41 \usepackage{amssymb}% for \twoheadrightarrow
42 \NewOverArrowCommand{\amsoverrightarrow}{amsmath=strict, end={\rightarrow}}
43 \NewOverArrowCommand{\overrightnewarrow}{%
44 amsmath, middle config=relbar, end=\rightarrow,
45 right arrow,
46 }
47 \DeclareMathSymbol{\fldra}{\mathrel}{esvector}{'021}
48 \DeclareMathSymbol{\fldrb}{\mathrel}{esvector}{'022}
49 \DeclareMathSymbol{\fldrc}{\mathrel}{esvector}{'023}
50 \DeclareMathSymbol{\fldrd}{\mathrel}{esvector}{'024}
51 \DeclareMathSymbol{\fldre}{\mathrel}{esvector}{'025}
52 \DeclareMathSymbol{\fldrf}{\mathrel}{esvector}{'026}
53 \DeclareMathSymbol{\fldrg}{\mathrel}{esvector}{'027}
54 \DeclareMathSymbol{\fldrh}{\mathrel}{esvector}{'030}
55 \NewOverArrowCommand{\esveca}{esvect=strict, end={\fldra}}
56 \NewOverArrowCommand{\esvecb}{esvect=strict, end={\fldrb}}
57 \NewOverArrowCommand{\esvecc}{esvect=strict, end={\fldrc}}
58 \NewOverArrowCommand{\esvecd}{esvect=strict, end={\fldrd}}
59 \NewOverArrowCommand{\esvece}{esvect=strict, end={\fldre}}
60 \NewOverArrowCommand{\esvecg}{esvect=strict, end={\fldrg}}
61 \NewOverArrowCommand{\esvech}{esvect=strict, end={\fldrh}}
62 \NewOverArrowCommand{\vva}{esvect, middle config=auto, end=\fldra}
63 \NewOverArrowCommand{\esvecf}{esvect=strict, end={\fldrf}}
64 \NewOverArrowCommand{\vvb}{esvect, middle config=auto, end=\fldrb}
65 \NewOverArrowCommand{\vvc}{esvect, middle config=auto, end=\fldrc}
66 \NewOverArrowCommand{\vvd}{esvect, middle config=auto, end=\fldrd}
67 \NewOverArrowCommand{\vve}{esvect, middle config=auto, end=\fldre}
68 \NewOverArrowCommand{\vvf}{esvect, middle config=auto, end=\fldrf}
69 \NewOverArrowCommand{\vvg}{esvect, middle config=auto, end=\fldrg}
70 \NewOverArrowCommand{\vvh}{esvect, middle config=auto, end=\fldrh}
71
72 \makeatletter
73 \newcommand{\unsetoldarrows}{
74 \let\ovar@rightarrow\rightarrow
75 \let\ovar@leftarrow\leftarrow
76 }
77 \newcommand{\setoldarrows}{
78 \let\ovar@rightarrow\varrightarrow
79 \let\ovar@leftarrow\varleftarrow
80 }
81 \makeatother
82
83 \begin{document}
84
85 \DocInput{overarrows.dtx}
86
87 \PrintIndex
88 \PrintChanges
89
90 \end{document}
91 %</driver>
92 % \fi
93 %
94 % \changes{v1.0}{2023/01/18}{Initial version}
95 %
96 % \GetFileInfo{\jobname.dtx}
97 %
98 % \title{The \pkg{overarrows} package\thanks{This document
99 % corresponds to \pkg{overarrows}~\fileversion, dated \filedate.}}
100 % \author{Julien Labb\'e \\ {\small \url{https://github.com/julienlabbe/latex-packages}}}
101 %
102 % \maketitle
103 %
104 % \begin{abstract}
105 % A \LaTeX{} package to create custom arrows over math expressions, mainly for
106 % vectors (but arrows can as well be drawn below). Arrows stretch with
107 % content, scale with math styles, and have a correct kerning when a subscript
108 % follows.
109 %
110 % \bigskip
111 %
112 % Short example:
113 % \iffalse
114 %<*example>
115 % \fi
116 \begin{dispExample}
117 \NewOverArrowCommand{\overrightharpoon}{%
118 end=\rightharpoonup
119 }
120
121 \begin{align*}
122 &\overrightharpoon{v} && \overrightharpoon{v}_{subscript} \\
123 &\overrightharpoon{ABCD} && \overrightharpoon*{v}_{subscript}
124 \end{align*}
125 \end{dispExample}
126 % \iffalse
127 %</example>
128 % \fi
129 %
130 %\bigskip
131 %
132 % Predefined commands are also provided:
133 % \begin{itemize}
134 % \item to typeset vectors:
135 % \[ \vv{v} \qquad \vv{AB}, \]
136 %
137 % \item to draw arrows of various shapes above math expressions:
138 % \begin{align*}
139 % \overrightarrow{AB}
140 % && \overleftarrow{AB}
141 % && \overleftrightarrow{AB}
142 % && \overrightharpoonup{AB}
143 % && \overleftharpoonup{AB}
144 % && \overrightharpoondown{AB}
145 % && \overleftharpoondown{AB}
146 % && \overbar{AB},
147 % \end{align*}
148 %
149 % \item to draw arrows of various shapes under math expressions:
150 % \begin{align*}
151 % \underrightarrow{AB}
152 % && \underleftarrow{AB}
153 % && \underleftrightarrow{AB}
154 % && \underrightharpoonup{AB}
155 % && \underleftharpoonup{AB}
156 % && \underrightharpoondown{AB}
157 % && \underleftharpoondown{AB}
158 % && \underbar{AB}.
159 % \end{align*}
160 % \end{itemize}
161 %
162 % \end{abstract}
163 %
164 % \clearpage
165 %
166 % \tableofcontents{}
167 %\clearpage
168 %
169 % \section{Presentation of the package}
170 % \label{sec:package-description}
171 %
172 % The \pkg{overarrows} package allows to create commands for drawing arrows over
173 % math expressions. These arrows:
174 % \begin{itemize}
175 % \item are fully customisable, at command definition, through a key-value
176 % interface;
177 % \item stretch with the content and can cover many characters, like in $\vv{AB}$;
178 % \item scale with math styles\footnotemark{}, like in
179 % $\vv*{v}_{\vv*{u}_{\vv*{w}}}$.
180 % \footnotetext{\cs{displaystyle}, \cs{textstyle}, \cs{scriptstyle} and
181 % \cs{scriptscriptstyle}.}
182 % \end{itemize}
183 %
184 % Commands created with the \pkg{overarrows} package are provided with a starred
185 % variant, that removes the extra end space generated by the arrow. This is
186 % particularly useful when the command is followed by a subscript. For example,
187 % the velocity of the center of mass can be written with exactly the same
188 % kerning when scalar $v_{\text{cm}}$ or vector $\vv*{v}_{\text{cm}}$ (no extra
189 % space before the subscript, unlike the output of the unstarred variant:
190 % $\vv{v}_{\text{cm}}$).
191 %
192 % The \pkg{overarrows} package was primitively written for vectors, but in
193 % a highly customisable way. It can be used to define a large variety of arrows,
194 % using math symbols, or drawing commands from PGF/TikZ or PSTricks. It's also
195 % possible to create commands that draw the arrows under. Some predefined
196 % commands are provided, giving\footnotemark{}, for arrow over:
197 % \footnotetext{Displayed here with the \refOpt{old-arrows} option.}
198 % \begin{align*}
199 % \overrightarrow{\alpha+\beta}
200 % && \overleftarrow{\alpha+\beta}
201 % && \overleftrightarrow{\alpha+\beta}
202 % && \overrightharpoonup{\alpha+\beta}
203 % && \overleftharpoonup{\alpha+\beta}
204 % && \overrightharpoondown{\alpha+\beta}
205 % && \overleftharpoondown{\alpha+\beta}
206 % && \overbar{\alpha+\beta}
207 % \end{align*}
208 % and for arrow under :
209 % \begin{align*}
210 % \underrightarrow{\alpha+\beta}
211 % && \underleftarrow{\alpha+\beta}
212 % && \underleftrightarrow{\alpha+\beta}
213 % && \underrightharpoonup{\alpha+\beta}
214 % && \underleftharpoonup{\alpha+\beta}
215 % && \underrightharpoondown{\alpha+\beta}
216 % && \underleftharpoondown{\alpha+\beta}
217 % && \underbar{\alpha+\beta}.
218 % \end{align*}
219 %
220 % \section{Introduction}
221 %
222 % \subsection{Vector arrows}
223 %
224 % Vectors are commonly typeset in bold face, or with an arrow
225 % above\footnotemark{}. For this second convention, \TeX/\LaTeX provides the
226 % command \cs{vec}, which accents its content (using the \cs{mathaccent}
227 % command) with the character~\symb{\mathchar "017E\relax}
228 % (\cs{mathchar}|"017E| in Computer Modern font). But \symb{\mathchar
229 % "017E\relax} isn't extensible\footnotemark{}, and gives: $\vec{v}$, $\vec{AB}$
230 % or $\vec{\text{grad}}$ (there's no command \cs{widevec} analogous to
231 % \cs{widehat}).
232 %
233 % \addtocounter{footnote}{-2}%^^A two footnotemarks
234 %
235 % \stepcounter{footnote}
236 % \footnotetext{See, for example: International Organization for
237 % Standardization. (2019). \emph{Quantities and units -- Part 2: Mathematics}
238 % (ISO Standard No. 80000-2:2019).
239 % \url{https://www.iso.org/standard/64973.html}.}
240 %
241 % \stepcounter{footnote}
242 % \footnotetext{In fact, with the unicode engines \LuaTeX{} and \XeTeX{}, the
243 % command \cs{Umathaccent} can now define extensible accents. This is used by
244 % the \pkg{unicode-math} package, which also set the arrows displayed by \cs{vec}
245 % and \cs{overrightarrow} in a coherent manner.}
246 %
247 % An extensible alternative is given by the command \cs{overrightarrow},
248 % available in \TeX/\LaTeX, and which is redefined by the commonly used
249 % \pkg{amsmath} package. But its arrow, built with the \cs{rightarrow} symbol
250 % \symb{\rightarrow}, is too large, using the default \emph{Computer Modern}
251 % font: $\amsoverrightarrow{AB}$. Another alternative is the \pkg{esvect}
252 % package, which provides the \cs{vv} command and a set of custom arrows:
253 % $\esveca{AB}$, $\esvecb{AB}$, $\esvecc{AB}$, $\esvecd{AB}$, $\esvece{AB}$,
254 % $\esvecf{AB}$, $\esvecg{AB}$, $\esvech{AB}$.
255 %
256 % \subsection{Stack and arrow macros}
257 %
258 % It's worth looking at the definition of \pkg{amsmath} \cs{overrightarrow}
259 % command: \iffalse
260 %<*example>
261 % \fi
262 \begin{dispListing}
263 \long macro:->\mathpalette {\overarrow@ \rightarrowfill@ }
264 \end{dispListing}
265 % \iffalse
266 %</example>
267 % \fi
268 % \noindent Three macros are used here:
269 % \begin{description}
270 % \item[\cs{mathpalette}] adapts the output to the current math style;
271 % \item[\cs{overarrow@}] is the \emph{stack macro}, that puts the arrow above
272 % the content;
273 % \item[\cs{rightarrowfill@}] is the \emph{arrow macro}, that holds the
274 % content of the arrow.
275 % \end{description}
276 % The command \cs{vv} from \pkg{esvec} is defined with a very similar way, using
277 % its own stack macro (\cs{overvect@}) and arrow macro (\cs{vectfill@}).
278 %
279 % \medskip
280 %
281 % The \pkg{overarrows} package uses the same mechanism. Arrow and stack macros
282 % are set, at command creation, through a key-value interface provided by the
283 % \pkg{pgfkeys} package (after creation, however, the command definition is
284 % static and the key-value interface is not used).
285 %
286 % \subsection{Extensible arrows}
287 % \label{sec:extensible-arrows}
288 %
289 % Arrows drawn by the commands \cs{overrightarrow} or \cs{vv} are built by
290 % joining math symbols, and made extensible by repetition of the central
291 % symbol\footnotemark{}. Thus, the line of the macro \cs{overrightarrow} is made
292 % by repetition of command \cs{relbar} \symb{\relbar} (which simply corresponds
293 % to the minus sign), while \cs{vv} use its own command \cs{relbareda}
294 % \symb{\relbareda}.
295 %
296 %\footnotetext{Using the \TeX{} \cs{cleaders} command.}
297 %
298 % This method may generate some undesirable spacing issues, when symbols
299 % badly overlap. See, for example, the output of \pkg{amsmath}
300 % \cs{overrightarrow} (left) and \pkg{esvect} \cs{vv} (right) in
301 % \cs{scriptscriptstyle} math style (scaled by a factor~ 4):
302 % \begin{center}
303 % \scalebox{4}{$\scriptscriptstyle \amsoverrightarrow{long~vector}$}
304 % \qquad
305 % \scalebox{4}{$\scriptscriptstyle \esvectvv{long~vector}$}.
306 % \end{center}
307 % While the arrow on the left lets guess where the symbols \symb{\relbar}
308 % overlap, the arrow on the right present unwanted spaces and show clearly its
309 % composition as association of the symbols \symb{\relbaredd}, \symb{\relbareda}
310 % and \symb{\fldr}.
311 %
312 % \medskip
313 %
314 % By default, the \pkg{overarrows} package uses the same mechanism to extend
315 % arrows according to their contents. Settings and tools are provided to perform
316 % fine tuning and avoid spacing issues. As example, see below the
317 % \cs{overrightarrow} and \cs{vv} commands, as redefined by \pkg{overarrows} (in
318 % \cs{scriptscriptstyle} and scaled by a factor~4):
319 % \begin{center}
320 % \scalebox{4}{$\scriptscriptstyle \overrightnewarrow{long~vector}$}
321 % \qquad
322 % \scalebox{4}{$\scriptscriptstyle \vv{long~vector}$}
323 % \end{center}
324 %
325 % The \pkg{overarrows} package also provides an alternative mechanism.
326 % When used, the length \cs{overarrowlength} is set, according to the arrow
327 % command content, and can be employed, for example, to draw arrows using
328 % PGF/TikZ, PSTricks or the \LaTeX{} picture environment.
329 %
330 % \section{Quick start}
331 %
332 % \subsection{Loading the package \pkg{overarrows}}
333 %
334 % To load the \pkg{overarrows}, simply add in preamble, before the
335 % ``\cs{begin}|{document}|":
336 % \iffalse
337 %<*example>
338 % \fi
339 \begin{dispListing}
340 \usepackage{overarrows}
341 \end{dispListing}
342 % \iffalse
343 %</example>
344 % \fi
345 %
346 % Options can be given, in a comma-separated list. For example, to use the
347 % predefined commands shown in the section~\ref{sec:package-description},
348 % page~\pageref{sec:package-description}, write:
349 % \iffalse
350 %<*example>
351 % \fi
352 \begin{dispListing}
353 \usepackage[allcommands, old-arrows]{overarrows}
354 \end{dispListing}
355 % \iffalse
356 %</example>
357 % \fi
358 % \noindent This define the commands (described in
359 % section~\ref{sec:predefined-commands},
360 % page~\pageref{sec:predefined-commands}):
361 % \begin{center}
362 % \begin{minipage}{0.5\linewidth}
363 % \begin{itemize}
364 % \item \refCom{overrightarrow}
365 % \item \refCom{overleftarrow}
366 % \item \refCom{overleftrightarrow}
367 % \item \refCom{overrightharpoonup}
368 % \item \refCom{overrightharpoondown}
369 % \item \refCom{overleftharpoonup}
370 % \item \refCom{overleftharpoondown}
371 % \item \refCom{overbar}
372 % \end{itemize}
373 % \end{minipage}\hfill
374 % \begin{minipage}{0.5\linewidth}
375 % \begin{itemize}
376 % \item \refCom{underrightarrow}
377 % \item \refCom{underleftarrow}
378 % \item \refCom{underleftrightarrow}
379 % \item \refCom{underrightharpoonup}
380 % \item \refCom{underrightharpoondown}
381 % \item \refCom{underleftharpoonup}
382 % \item \refCom{underleftharpoondown}
383 % \item \refCom{underbar}
384 % \end{itemize}
385 % \end{minipage}
386 % \end{center}
387 % Note that the \refOpt{old-arrows} option may give bad results, if math fonts
388 % have been changed. Simply remove the option in this case.
389 %
390 % Many other options are available. See the complete list,
391 % page~\pageref{sec:package-options}.
392 %
393 % \subsection{Commands creation}
394 %
395 % Commands are created with \refCom{NewOverArrowCommand}. This macro take two
396 % mandatory arguments : the name of the command and the arrow configuration as
397 % comma-separated list of key-values. By default, a right arrow is set:
398 % \iffalse
399 %<*example>
400 % \fi
401 \begin{dispExample}
402 \NewOverArrowCommand{\myovercmd}{}
403 $ \myovercmd{test} $
404 \end{dispExample}
405 % \iffalse
406 %</example>
407 % \fi
408 % \noindent Commands are defined with a starred variant, designed to handle
409 % subscripts:
410 % \iffalse
411 %<*example>
412 % \fi
413 \NewOverArrowCommand{\myovercmd}{}
414 \begin{dispExample}
415 $ v_{sub} \qquad \myovercmd{v}_{sub} \qquad \myovercmd*{v}_{sub} $
416 \end{dispExample}
417 % \iffalse
418 %</example>
419 % \fi
420 %
421 % \subsection{Start and end of the arrow}
422 %
423 % Extremities of the arrow are set by the keys \refKey{start} and \refKey{end}.
424 % For example, an arrow starting with a hook (symbols \cs{lhook} \symb{\lhook})
425 % and ending with two heads (symbol \cs{twoheadrightarrow}
426 % \symb{\twoheadrightarrow}) is defined by:
427 % \iffalse
428 %<*example>
429 % \fi
430 \begin{dispListing}
431 \NewOverArrowCommand{\overhooktwoheadrightarrow}{%
432 start=\lhook, end=\twoheadrightarrow,
433 }
434 \end{dispListing}
435 % \iffalse
436 %</example>
437 % \fi
438 % \noindent Note that \cs{twoheadrightarrow} must be defined, as it is not in
439 % \LaTeX{}. This can be done with the package \pkg{amssymb}, by adding in
440 % preamble:
441 % \iffalse
442 %<*example>
443 % \fi
444 \begin{dispListing}
445 \usepackage{amssymb}
446 \end{dispListing}
447 % \iffalse
448 %</example>
449 % \fi
450 % But with the previous definition, the output of \cs{overhooktwoheadrightarrow}
451 % is faulty:
452 % \iffalse
453 %<*example>
454 % \fi
455 \NewOverArrowCommand{\overhooktwoheadrightarrow}{%
456 start=\lhook, end=\twoheadrightarrow,
457 }
458 \begin{dispExample}
459 $ \overhooktwoheadrightarrow{v} \qquad \overhooktwoheadrightarrow{AB} $
460 \end{dispExample}
461 % \iffalse
462 %</example>
463 % \fi
464 % \noindent The problem comes from symbols junction and the trimming used to
465 % obtain their overlap. It can be solved with the keys \refKey{trim start} and
466 % \refKey{trim end}, which are numbers and set the corresponding trimming in
467 % math units (typically |1/18 em|). Appropriate values gives better results:
468 % \iffalse
469 %<*example>
470 % \fi
471 \csundef{overhooktwoheadrightarrow code}
472 \csundef{overhooktwoheadrightarrow}
473 \begin{dispExample}
474 \NewOverArrowCommand{\overhooktwoheadrightarrow}{%
475 start=\lhook, end=\twoheadrightarrow,
476 trim start=1.5, trim end=2,
477 }
478 $ \overhooktwoheadrightarrow{v} \qquad \overhooktwoheadrightarrow{AB} $
479 \end{dispExample}
480 % \iffalse
481 %</example>
482 % \fi
483 %
484 % \medskip
485 %
486 % If the math font differs from the default \emph{Computer Modern}, the central
487 % part of the arrow may have inappropriate position or line width. This is
488 % because the default symbol used for the arrow line is \cs{relbareda}
489 % \symb{\relbareda} from the \pkg{esvect} package\footnote{Except if the
490 % \pkg{unicode-math} package is used with a math font that provides the
491 % \cs{harrowextender} symbol (see the \refKey*{middle config}|=auto| key).}.
492 % If needed, try to set the \refKey{middle} key with the symbol \cs{relbar}
493 % \symb{\relbar}. The trimming should also be adapted:
494 % \iffalse
495 %<*example>
496 % \fi
497 \csundef{overhooktwoheadrightarrow code}
498 \csundef{overhooktwoheadrightarrow}
499 \begin{dispExample}
500 \NewOverArrowCommand{\overhooktwoheadrightarrow}{%
501 start=\lhook, end=\twoheadrightarrow, middle=\relbar,
502 trim start=0, trim end=3, trim middle=5,
503 }
504 $ \overhooktwoheadrightarrow{v} \qquad \overhooktwoheadrightarrow{AB} $
505 \end{dispExample}
506 % \iffalse
507 %</example>
508 % \fi
509 %
510 % Finding the correct values for \refKey{trim start}, \refKey{trim end} and
511 % \refKey{trim middle} may need many trials. For this purpose, the
512 % \refCom{TestOverArrow} macro displays the result of a command for different
513 % lengths and math styles:
514 % \iffalse
515 %<*example>
516 % \fi
517 \DeclareOverArrowCommand{\overhooktwoheadrightarrow}{%
518 start=\lhook, end=\twoheadrightarrow, middle=\relbar,
519 trim start=0, trim end=3, trim middle=5,
520 }
521 \begin{dispExample}
522 \TestOverArrow{\overhooktwoheadrightarrow}
523 \end{dispExample}
524 % \iffalse
525 %</example>
526 % \fi
527 %
528 % \subsection{Size and position of the arrow}
529 %
530 % A command \cs{OverRightarrow}, built with the symbol \cs{Relbar}
531 % \symb{\Relbar} and the symbol \cs{Rightarrow} \symb{\Rightarrow}, gives:
532 %\iffalse
533 %<*example>
534 % \fi
535 \begin{dispExample}
536 \NewOverArrowCommand{\OverRightarrow}{%
537 start=\Relbar,
538 middle=\Relbar,
539 end=\Rightarrow,
540 trim=4,
541 }
542 $ \OverRightarrow{v} \qquad \OverRightarrow{AB} $
543 \end{dispExample}
544 % \iffalse
545 %</example>
546 % \fi
547 %\noindent The key \refKey{trim} sets \refKey{trim start}, \refKey{trim middle} and
548 %\refKey{trim end} with the same value.
549 %
550 % The previous arrow is visually too big. The macro \refCom{smallermathstyle}
551 % allows to obtain a better result:
552 % \iffalse
553 %<*example>
554 % \fi
555 \begin{dispExample}
556 \NewOverArrowCommand{\OverRightarrow}{%
557 start={\smallermathstyle\Relbar},
558 middle={\smallermathstyle\Relbar},
559 end=\Rightarrow,
560 trim=4,
561 }
562 $ \OverRightarrow{v} \qquad \OverRightarrow{AB} $
563 \end{dispExample}
564 % \iffalse
565 %</example>
566 % \fi
567 % \noindent Note that \refCom{smallermathstyle} should not be used for
568 % \refKey{end}, because this last is formatted with the same math style as
569 % \refKey{start}.
570 %
571 % It would be better to add an extra space between the arrow and the content of
572 % the command. This can be done with the key \refKey{space after arrow}:
573 % \iffalse
574 %<*example>
575 % \fi
576 \begin{dispExample}
577 \NewOverArrowCommand{\OverRightarrow}{%
578 start={\smallermathstyle\Relbar},
579 middle={\smallermathstyle\Relbar},
580 end=\Rightarrow,
581 trim=4,
582 space after arrow=0.25ex,
583 }
584 $ \OverRightarrow{v} \qquad \OverRightarrow{AB} $
585 \end{dispExample}
586 % \iffalse
587 %</example>
588 % \fi
589 %
590 % \medskip
591 %
592 % Default arrows are slightly shifted to the right. For a left arrow, this
593 % should be reversed, using the keys \refKey{shift left} and \refKey{shift
594 % right}. These keys set the corresponding shifts, in math units. Example:
595 % \iffalse
596 %<*example>
597 % \fi
598 \begin{dispExample}
599 \NewOverArrowCommand{\OverLeftarrow}{%
600 start={\smallermathstyle\Leftarrow},
601 middle={\smallermathstyle\Relbar},
602 end=\Relbar,
603 trim=4,
604 space after arrow=0.25ex,
605 shift left=0, shift right=2,
606 }
607 $ \OverLeftarrow{v} \qquad \OverLeftarrow{AB} $
608 \end{dispExample}
609 % \iffalse
610 %</example>
611 % \fi
612 %
613 % \medskip
614 %
615 % Finally, the key \refKey{arrow under} places the arrow below the content,
616 % instead of above (and \refKey{space before arrow} sets the space upon it):
617 % \iffalse
618 %<*example>
619 % \fi
620 \begin{dispExample}
621 \NewOverArrowCommand{\UnderLeftRightarrow}{%
622 start={\smallermathstyle\Leftarrow},
623 middle={\smallermathstyle\Relbar},
624 end=\Rightarrow,
625 trim=4,
626 arrow under,
627 space before arrow=0.5ex,
628 shift left=0, shift right=0,
629 }
630 $ \UnderLeftRightarrow{v} \qquad \UnderLeftRightarrow{AB} $
631 \end{dispExample}
632 % \iffalse
633 %</example>
634 % \fi
635 %
636 % \subsection{Symbols assemblage}
637 %
638 % Many \LaTeX{} math symbols are built by assemblage, using the macro
639 % \cs{joinrel}\footnotemark{} which remove 3 math units of horizontal space.
640 % The \pkg{overarrows} package provides a flexible version of \cs{joinrel},
641 % called \refCom{xjoinrel}, which remove an arbitrary number of math units,
642 % given as optional argument.
643 %
644 %\footnotetext{For example, the symbol \cs{models}
645 % \smash{\symb{\models}} is defined as
646 % \cs{mathrel}\texttt{\{\textbar\}}\cs{joinrel}\cs{Relbar} and corresponds to
647 % the assemblage of a vertical line \symb{\vert} and the symbol \cs{Relbar}
648 % \symb{\Relbar}. The command \cs{mathrel} modifies the spacing according to the
649 % math relation class; \cs{Relbar} corresponds to the equal sign (it's
650 % definition is \cs{mathrel}\texttt{\{=\}}).}
651 %
652 % Symbols association is then simple. As example, one can define a triple tail
653 % macro \cs{tttail} from the symbol \cs{succ} \symb{\succ}:
654 % \iffalse
655 %<*example>
656 % \fi
657 \begin{dispExample}
658 \newcommand*{\tttail}{\succ\xjoinrel[10]\succ\xjoinrel[10]\succ}
659 $ \tttail $
660 \end{dispExample}
661 \newcommand*{\tttail}{\succ\xjoinrel[10]\succ\xjoinrel[10]\succ}
662 % \iffalse
663 %</example>
664 % \fi
665 % \noindent Thus defined, the macro \cs{tttail} can be used in arrow definition:
666 %\iffalse
667 %<*example>
668 % \fi
669 \begin{dispExample}
670 \NewOverArrowCommand{\overtttailrightarrow}{%
671 start={\tttail},
672 end={\rightarrow},
673 trim start=12,
674 shift left=0, shift right=0,
675 space after arrow=.2ex,
676 min length=24,
677 }
678 $ \overtttailrightarrow{v} \qquad \overtttailrightarrow{AB} $
679 \end{dispExample}
680 % \iffalse
681 %</example>
682 % \fi
683 % \noindent Here the \refKey{min length} key was added to ensure a minimum length
684 % (in math units) when the content of the command is small (as for a single
685 % character).
686 %
687 % \medskip
688 %
689 % The previous arrow would be better with a smaller tail, and this can be done
690 % with the macro \refCom{smallermathstyle}. But a small tail and a normal sized
691 % head are not aligned; as
692 % \begin{center}
693 %|{\smallermathstyle\tttail}\xjoinrel[8]\rightarrow}|
694 % \end{center}
695 % gives:
696 % \begin{center}
697 % \scalebox{2}{${\smallermathstyle\tttail}\xjoinrel[8]\rightarrow$}
698 % \end{center}
699 % \noindent The solution comes from the command \cs{vcenter} which centers
700 % materials on math axis. The tail must then be wrapped in a \cs{hbox}:
701 % \iffalse
702 %<*example>
703 % \fi
704 \begin{dispExample}
705 \NewOverArrowCommand{\overtttailrightarrow}{%
706 start={\vcenter{\hbox{$\smallermathstyle\tttail$}}},
707 end={\rightarrow},
708 trim start=12,
709 shift left=0, shift right=0,
710 space after arrow=.2ex,
711 min length=24,
712 }
713 $ \overtttailrightarrow{v} \qquad \overtttailrightarrow{AB} $
714 \end{dispExample}
715 % \iffalse
716 %</example>
717 % \fi
718 %
719 % \medskip
720 %
721 % Text symbols, namely symbols that are not defined in math mode, can also be
722 % used. They should yet be enclosed in the \cs{text} macro, from the
723 % \pkg{amsmath} package, to be correctly displayed and correctly scaled
724 % according to math style. With, for example, the arrow heads given by the
725 % symbols 40 and 41 of the \emph{lasy} font:
726 % \iffalse
727 %<*example>
728 % \fi
729 \begin{dispExample}
730 \newcommand*{\leftarrowhead}{\usefont{U}{lasy}{m}{n}\symbol{40}}
731 \newcommand*{\righttarrowhead}{\usefont{U}{lasy}{m}{n}\symbol{41}}
732 \NewOverArrowCommand{\overrightleftarrow}{%
733 start=\text{\righttarrowhead},
734 end=\text{\leftarrowhead},
735 trim start=0.7, trim end=0.7,
736 min length=20,
737 shift leftright=-2,
738 }
739 $ \overrightleftarrow{AB} \qquad \scriptstyle\overrightleftarrow{AB} $
740 \end{dispExample}
741 % \iffalse
742 %</example>
743 % \fi
744 %
745 % \subsection{Drawing the arrow with TikZ}
746 %
747 % In addition to the default method presented previously (assemblage of symbols,
748 % as described in section~\ref{sec:extensible-arrows},
749 % page~\pageref{sec:extensible-arrows}), the \pkg{overarrows} package has an
750 % alternative method to draw the arrow. This one allows the use of graphic
751 % languages such as PGF/TikZ.
752 %
753 % Drawing arrows with TikZ requires to load the \pkg{tikz} package and its
754 % library |arrows.meta|. This can be simply done by passing the \refOpt{tikz}
755 % option to the \pkg{overarrows} package\footnotemark{}:
756 %
757 % \footnotetext{Note that the \refOpt{tikz} option isn't mandatory to use TikZ
758 % commands in \pkg{overarrows}. The \pkg{tikz} package and its library
759 % |arrows.meta| can be loaded independently.}
760 % \iffalse
761 %<*example>
762 % \fi
763 \begin{dispListing}
764 \usepackage[tikz]{overarrows}
765 \end{dispListing}
766 % \iffalse
767 %</example>
768 % \fi
769 %
770 % \medskip
771 %
772 % To use PGF/TikZ language, the optional argument |tikz| must be passed to
773 % \refCom{NewOverArrowCommand}. TikZ pictures are not extensible. That's why the
774 % \pkg{overarrows} package provides three lengths that can be used in TikZ
775 % commands:
776 % \begin{itemize}
777 % \item \refCom{overarrowlength} for the arrow length,
778 % \item \refCom{overarrowthickness} and \refCom{overarrowsmallerthickness} for
779 % the arrow thickness.
780 % \end{itemize}
781 % These lengths are computed at each utilisation of a command created with the
782 % |tikz| optional argument.
783 %
784 % Without any other configuration, a right arrow is drawn:
785 % \iffalse
786 %<*example>
787 % \fi
788 \begin{dispExample}
789 \NewOverArrowCommand[tikz]{\overtikzarrow}{}
790 $ \overtikzarrow{v} \qquad \overtikzarrow{AB} $
791 \end{dispExample}
792 % \iffalse
793 %</example>
794 % \fi
795 %
796 % \medskip
797 %
798 % Keys to use Tikz are described in section~\ref{sec:tikz-keys},
799 % page~\pageref{sec:tikz-keys}. Main keys are: \refKey{tikz options},
800 % \refKey{path options} and \refKey{path}. It's also possible to append settings
801 % with \refKey{add tikz options} and \refKey{add path options}. The full TikZ
802 % command used to draw the arrow can as well be entirely redefined
803 % with the key \refKey{tikz command}
804 %
805 % Here is a example of an arrow drawn with TikZ\footnotemark{}:
806 %
807 % \footnotetext{TikZ arrows are very powerfull, but much slower to draw than the
808 % default method using assemblage of math symbols.}
809 % \iffalse
810 %<*example>
811 % \fi
812 \begin{dispExample}
813 \NewOverArrowCommand[tikz]{\overarchedleftrightarrow}{%
814 add tikz options={y=\overarrowlength},
815 add tikz options={line width={\overarrowsmallerthickness}},
816 path options={arrows={<[scale=0.5]->[scale=0.5]}},
817 path={(0,0) arc (-250:70:0.5 and 0.1)},
818 center arrow,
819 min length=25,
820 space after arrow=0.4ex,
821 }
822 $ \overarchedleftrightarrow{v} \qquad \overarchedleftrightarrow{ABCD} $
823
824 \end{dispExample}
825 % \iffalse
826 %</example>
827 % \fi
828 %
829 % \subsection{Drawing the arrow with PSTricks}
830 %
831 % In addition to PGF/TikZ, the arrow can be drawn with PSTricks macros.
832 % For this, the optional argument |pstricks| must be passed to
833 % \refCom{NewOverArrowCommand}. Like with
834 % |tikz|, the three lengths
835 % \begin{itemize}
836 % \item \refCom{overarrowlength};
837 % \item \refCom{overarrowthickness};
838 % \item \refCom{overarrowsmallerthickness}
839 % \end{itemize}
840 % can be used in PSTricks commands. By default, a right arrow is drawn:
841 % \iffalse
842 %<*example>
843 % \fi
844 \begin{dispExample}
845 \NewOverArrowCommand[pstricks]{\overpstarrow}{}
846 $ \overpstarrow{v} \qquad \overpstarrow{AB} $
847 \end{dispExample}
848 % \iffalse
849 %</example>
850 % \fi
851 % \noindent The \pkg{pstricks} package has to be loaded (for example, using the
852 % \refOpt{pstricks} option of the \pkg{overarrows} package)
853 %
854 % Keys to use PSTricks commands are described in section~\ref{sec:pstricks-keys},
855 % page~\pageref{sec:pstricks-keys}. The main keys are \refKey{pstricks command},
856 % \refKey{psset}, \refDoc{key:pstricks}{arrow}, \refDoc{key:pstricks}{geometry}
857 % an \refDoc{key:pstricks}{line thickness}. Examples:
858 % \iffalse
859 %<*example>
860 % \fi
861 \begin{dispExample}
862 \NewOverArrowCommand[pstricks]{\overreddisks}{%
863 psset={linecolor=red}, arrow=*-*, center arrow,
864 }
865 $ \overreddisks{v} \qquad \overreddisks{AB} $
866 \end{dispExample}
867 \begin{dispExample}
868 \NewOverArrowCommand[pstricks]{\ellipticarrow}{%
869 pstricks command={%
870 \psellipticarcn{->}%^^A avoid space before coordinates
871 (0.5\overarrowlength,0.2\overarrowlength)%^^A avoid space before coordinates
872 (0.5\overarrowlength,0.2\overarrowlength)
873 {170}{10}
874 },
875 geometry={(0,0.2\overarrowlength)(\overarrowlength,0.4\overarrowlength)},
876 line thickness={\overarrowsmallerthickness},
877 center arrow,
878 }
879 $ \ellipticarrow{v} \qquad \ellipticarrow{AB} $
880 \end{dispExample}
881 % \iffalse
882 %</example>
883 % \fi
884 %
885 % \subsection{Drawing the arrow with \LaTeX{} picture environment}
886 %
887 % Without any other package, arrows can also be drawn with the \LaTeX{}
888 % |picture| environment. In this case, the optional argument |picture| must be
889 % passed to \refCom{NewOverArrowCommand}. As with |tikz| or |pstricks|, the
890 % three lengths
891 % \begin{itemize}
892 % \item \refCom{overarrowlength};
893 % \item \refCom{overarrowthickness};
894 % \item \refCom{overarrowsmallerthickness}
895 % \end{itemize}
896 % are available and can be used in |picture| drawing commands. By default,
897 % a right vector is drawn:
898 % \iffalse
899 %<*example>
900 % \fi
901 \ltxarrows%^^A classic arrows
902 \begin{dispExample}
903 \NewOverArrowCommand[picture]{\overpictarrow}{}
904 $ \overpictarrow{v} \qquad \overpictarrow{AB} $
905 \end{dispExample}
906 % \iffalse
907 %</example>
908 % \fi
909 % \noindent If \pkg{overarrows} is loaded with the option \refOpt{pstarrows},
910 % the package \pkg{pict2e} is used and a PSTricks style vector arrows is set.
911 % This gives:
912 % \iffalse
913 %<*example>
914 % \fi
915 \pstarrows%^^A pst arrows
916 \begin{dispExample}
917 \NewOverArrowCommand[picture]{\overpictarrow}{}
918 $ \overpictarrow{v} \qquad \overpictarrow{AB} $
919 \end{dispExample}
920 % \iffalse
921 %</example>
922 % \fi
923 %
924 % Keys to use \LaTeX{} |picture| environment are described in
925 % section~\ref{sec:picture-keys}, page~\pageref{sec:picture-keys}. The main keys
926 % are \refKey{picture command}, \refDoc{key:picture}{geometry} an
927 % \refDoc{key:picture}{line thickness}. Here is an example:
928 % \iffalse
929 %<*example>
930 % \fi
931 \begin{dispExample}
932 \NewOverArrowCommand[picture]{\overbandedarrow}{
933 picture command={%
934 \qbezier
935 (0.0\overarrowlength,0)
936 (0.5\overarrowlength,0)
937 (0.9\overarrowlength,0.2\overarrowlength)
938 \put(0.9\overarrowlength,0.2\overarrowlength)
939 {\vector(2,1){0.2\overarrowlength}}
940 },
941 geometry={(\overarrowlength,0.4\overarrowlength)(0,0)},
942 line thickness={\overarrowsmallerthickness},
943 center arrow,
944 space after arrow=0.4ex,
945 }
946 $ \overbandedarrow{v} \qquad \overbandedarrow{AB} $
947 \end{dispExample}
948 % \iffalse
949 %</example>
950 % \fi
951 %
952 % \section{User interface}
953 %
954 % \subsection{Package options}
955 % \label{sec:package-options}
956 %
957 % The \pkg{overarrows} package accepts many options, given as a comma-separated
958 % list \meta{options} at package loading:
959 % \cs{usepackage}|[|\meta{options}|]{overarrows}|.
960 %
961 % The option \refOpt*{esvect} is set by default. This can be overridden with
962 % \refOpt*{noesvect}.
963 %
964 % \subsubsection{\pkg{esvect} configuration}
965 % \label{sec:esvect-conf}
966 %
967 % \begin{docOption}{esvect}
968 % Loads the \pkg{esvect} package and redefines its vector commands \refCom{vv}
969 % through the \pkg{overarrows} mechanism. Original \pkg{esvect} \cs{vv} macro
970 % is still available with \refCom{esvectvv}. The \pkg{esvect} font description
971 % is fixed to allow any font sizes.
972 %
973 % The \pkg{esvect} package provides the symbol \cs{relbareda} \symb{\relbareda}
974 % which is smaller and often more flexible than the classic one \cs{relbar}
975 % \symb{\relbar}. \cs{relbareda} fits with the standard \emph{Computer Modern}
976 % math font, but can be unsuitable with other fonts.
977 %
978 % The \pkg{esvect} package also provides the right arrow command \cs{fldr}.
979 % The shape of the arrow depends on the option passed to the \pkg{esvect}
980 % package: \symb{\fldra} (option~|a|), \symb{\fldrb} (option~|b|), \symb{\fldrc}
981 % (option~|c|), \symb{\fldrd} (option~|d|), \symb{\fldre} (option~|e|),
982 % \symb{\fldrf} (option~|f|), \symb{\fldrg} (option~|g|) or \symb{\fldrh}
983 % (option~|h|). Note that by default \pkg{overarrows} loads the \pkg{esvect}
984 % package with the option~|f| (while \pkg{esvect} default is~|d|). This can be
985 % changed with one of the eight options described bellow: \refOpt*{esvecta},
986 % \refOpt*{esvectb}, \refOpt*{esvectc}, \refOpt*{esvectd}, \refOpt*{esvecte},
987 % \refOpt*{esvectf}, \refOpt*{esvectg} and \refOpt*{esvecth}.
988 %
989 % This option is set by default and can be unset with \refOpt*{noesvect}.
990 % \end{docOption}
991 %
992 % \begin{docOption}{noesvect}
993 % Prevents the loading of the \pkg{esvect} package and the definition of the
994 % command \refCom{vv}.
995 % \end{docOption}
996 %
997 % \begin{docOption}{esvecta}
998 % Loads the \pkg{esvect} package with the |a| option.
999 %
1000 % \cs{fldr} corresponds the to the symbol \symb{\fldra}. \cs{vv} command
1001 % gives : $\vva{v} \quad \vva{AB} \quad \vva{\mathrm{grad}}$.
1002 % \end{docOption}
1003 %
1004 % \begin{docOption}{esvectb}
1005 % Loads the \pkg{esvect} package with the |b| option.
1006 %
1007 % \cs{fldr} corresponds the to the symbol \symb{\fldrb}. \cs{vv} command
1008 % gives : $\vvb{v} \quad \vvb{AB} \quad \vvb{\mathrm{grad}}$.
1009 % \end{docOption}
1010 %
1011 % \begin{docOption}{esvectc}
1012 % Loads the \pkg{esvect} package with the |c| option.
1013 %
1014 % \cs{fldr} corresponds the to the symbol \symb{\fldrc}. \cs{vv} command
1015 % gives : $\vvc{v} \quad \vvc{AB} \quad \vvc{\mathrm{grad}}$.
1016 % \end{docOption}
1017 %
1018 % \begin{docOption}{esvectd}
1019 % Loads the \pkg{esvect} package with the |d| option.
1020 %
1021 % \cs{fldr} corresponds the to the symbol \symb{\fldrd}. \cs{vv} command
1022 % gives : $\vvd{v} \quad \vvd{AB} \quad \vvd{\mathrm{grad}}$.
1023 % \end{docOption}
1024 %
1025 % \begin{docOption}{esvecte}
1026 % Loads the \pkg{esvect} package with the |e| option.
1027 %
1028 % \cs{fldr} corresponds the to the symbol \symb{\fldre}. \cs{vv} command
1029 % gives : $\vve{v} \quad \vve{AB} \quad \vve{\mathrm{grad}}$.
1030 % \end{docOption}
1031 %
1032 % \begin{docOption}{esvectf}
1033 % Loads the \pkg{esvect} package with the |f| option.
1034 %
1035 % \cs{fldr} corresponds the to the symbol \symb{\fldrf}. \cs{vv} command
1036 % gives : $\vvf{v} \quad \vvf{AB} \quad \vvf{\mathrm{grad}}$.
1037 % \end{docOption}
1038 %
1039 % \begin{docOption}{esvectg}
1040 % Loads the \pkg{esvect} package with the |g| option.
1041 %
1042 % \cs{fldr} corresponds the to the symbol \symb{\fldrg}. \cs{vv} command
1043 % gives : $\vvg{v} \quad \vvg{AB} \quad \vvg{\mathrm{grad}}$.
1044 % \end{docOption}
1045 %
1046 % \begin{docOption}{esvecth}
1047 % Loads the \pkg{esvect} package with the |h| option.
1048 %
1049 % \cs{fldr} corresponds the to the symbol \symb{\fldrh}. \cs{vv} command
1050 % gives : $\vvh{v} \quad \vvh{AB} \quad \vvh{\mathrm{grad}}$.
1051 % \end{docOption}
1052 %
1053 % \subsubsection{Predefined commands}
1054 %\label{sec:predefined-commands-opt}
1055 %
1056 % The \pkg{overarrows} package provides sixteen predefined commands, eight with
1057 % the arrow over, and eight with the arrow under. By default, theses commands
1058 % are not defined, and must be activated by the corresponding option.
1059 % Beware that commands are created without checking if already defined by
1060 % another package (\cs{overleftarrow}, \cs{overrightarrow},
1061 % \cs{overleftrightarrow}, \cs{underleftarrow}, \cs{underrightarrow} and
1062 % \cs{underleftrightarrow} are, for example, part of the \pkg{amsmath} package).
1063 %
1064 % Three options are also available to define set of commands.
1065 %
1066 % \medskip
1067 % \unsetoldarrows
1068 %
1069 % \noindent\textbf{Set of commands}
1070 %
1071 % \begin{docOption}{allcommands}
1072 % Defines all sixteen predefined commands.
1073 %\end{docOption}
1074 % \begin{docOption}{overcommands}
1075 % Defines all eight predefined commands with arrow over.
1076 %\end{docOption}
1077 % \begin{docOption}{undercommands}
1078 % Defines all eight predefined commands with arrow under.
1079 % \end{docOption}
1080 %
1081 % \medskip
1082 %
1083 % \noindent\textbf{Over arrows}
1084 %
1085 % \begin{docOption}{overrightarrow}
1086 % Defines the \refCom{overrightarrow} command: $\overrightarrow{v}$,
1087 % $\overrightarrow{AB}$, $\overrightarrow{\textrm{grad}}$.
1088 % \end{docOption}
1089 % \begin{docOption}{overleftarrow}
1090 % Defines the \refCom{overleftarrow} command: $\overleftarrow{v}$, $\overleftarrow{AB}$, $\overleftarrow{\textrm{grad}}$.
1091 % \end{docOption}
1092 % \begin{docOption}{overleftrightarrow}
1093 % Defines the \refCom{overleftrightarrow} command: $\overleftrightarrow{v}$,
1094 % $\overleftrightarrow{AB}$, $\overleftrightarrow{\textrm{grad}}$.
1095 % \end{docOption}
1096 % \begin{docOption}{overrightharpoonup}
1097 % Defines the \refCom{overrightharpoonup} command: $\overrightharpoonup{v}$,
1098 % $\overrightharpoonup{AB}$, $\overrightharpoonup{\textrm{grad}}$.
1099 % \end{docOption}
1100 % \begin{docOption}{overrightharpoondown}
1101 % Defines the \refCom{overrightharpoondown} command:
1102 % $\overrightharpoondown{v}$, $\overrightharpoondown{AB}$,
1103 % $\overrightharpoondown{\textrm{grad}}$.
1104 % \end{docOption}
1105 % \begin{docOption}{overleftharpoonup}
1106 % Defines the \refCom{overleftharpoonup} command: $\overleftharpoonup{v}$,
1107 % $\overleftharpoonup{AB}$, $\overleftharpoonup{\textrm{grad}}$.
1108 % \end{docOption}
1109 % \begin{docOption}{overleftharpoondown}
1110 % Defines the \refCom{overleftharpoondown} command: $\overleftharpoondown{v}$,
1111 % $\overleftharpoondown{AB}$, $\overleftharpoondown{\textrm{grad}}$.
1112 % \end{docOption}
1113 % \begin{docOption}{overbar}
1114 % Defines the \refCom{overbar} command: $\overbar{v}$, $\overbar{AB}$,
1115 % $\overbar{\textrm{grad}}$.
1116 % \end{docOption}
1117 %
1118 % \medskip
1119 %
1120 % \noindent\textbf{Under arrows}
1121 %
1122 % \begin{docOption}{underrightarrow}
1123 % Defines the \refCom{underrightarrow} command: $\underrightarrow{v}$,
1124 % $\underrightarrow{AB}$, $\underrightarrow{\textrm{grad}}$.
1125 % \end{docOption}
1126 % \begin{docOption}{underleftarrow}
1127 % Defines the \refCom{underleftarrow} command: $\underleftarrow{v}$,
1128 % $\underleftarrow{AB}$, $\underleftarrow{\textrm{grad}}$.
1129 % \end{docOption}
1130 % \begin{docOption}{underleftrightarrow}
1131 % Defines the \refCom{underleftrightarrow} command: $\underleftrightarrow{v}$,
1132 % $\underleftrightarrow{AB}$, $\underleftrightarrow{\textrm{grad}}$.
1133 % \end{docOption}
1134 % \begin{docOption}{underrightharpoonup}
1135 % Defines the \refCom{underrightharpoonup} command: $\underrightharpoonup{v}$,
1136 % $\underrightharpoonup{AB}$, $\underrightharpoonup{\textrm{grad}}$.
1137 % \end{docOption}
1138 % \begin{docOption}{underrightharpoondown}
1139 % Defines the \refCom{underrightharpoondown} command:
1140 % $\underrightharpoondown{v}$, $\underrightharpoondown{AB}$,
1141 % $\underrightharpoondown{\textrm{grad}}$.
1142 % \end{docOption}
1143 % \begin{docOption}{underleftharpoonup}
1144 % Defines the \refCom{underleftharpoonup} command: $\underleftharpoonup{v}$,
1145 % $\underleftharpoonup{AB}$, $\underleftharpoonup{\textrm{grad}}$.
1146 % \end{docOption}
1147 % \begin{docOption}{underleftharpoondown}
1148 % Defines the \refCom{underleftharpoondown} command:
1149 % $\underleftharpoondown{v}$, $\underleftharpoondown{AB}$,
1150 % $\underleftharpoondown{\textrm{grad}}$.
1151 % \end{docOption}
1152 % \begin{docOption}{underbar}
1153 % Defines the \refCom{underbar} command: $\underbar{v}$, $\underbar{AB}$,
1154 % $\underbar{\textrm{grad}}$.
1155 % \end{docOption}
1156 %
1157 % \subsubsection{Other options}
1158 %
1159 % \begin{docOption}{old-arrows}\setoldarrows
1160 % Loads the \pkg{old-arrows} package with its option |old|. This provides the
1161 % symbols \cs{varleftarrow} \symb{\varleftarrow} and \cs{varrightarrow}
1162 % \symb{\varrightarrow}, used then by default for predefined command.
1163 %
1164 % When the \refOpt*{old-arrows} option is set, the commands
1165 % \refCom{overrightarrow}, \refCom{overleftarrow},
1166 % \refCom{overleftrightarrow}, \refCom{underrightarrow},
1167 % \refCom{underleftarrow} and \refCom{underleftrightarrow} give respectively :
1168 % $\overrightarrow{AB}$, $\overleftarrow{AB}$, $\overleftrightarrow{AB}$,
1169 % $\underrightarrow{AB}$, $\underleftarrow{AB}$ and $\underleftrightarrow{AB}$
1170 % \end{docOption}
1171 %
1172 % \begin{docOption}{tikz}
1173 % Loads the package \pkg{tikz} with its library |arrows.meta|.
1174 %
1175 % Note that TikZ arrows, drawn with the |tikz| method, are always available,
1176 % even if this option is not set, provided the \pkg{tikz} package and its
1177 % library are loaded independently.
1178 % \end{docOption}
1179 %
1180 % \begin{docOption}{pstricks}
1181 % Loads the package \pkg{pstricks-add}.
1182 %
1183 % Note that, as it, this will compile with \LaTeX{}, \LuaLaTeX{} and
1184 % \XeLaTeX{}, but not with \makebox{pdf\LaTeX} (see the PSTricks
1185 % documentation). PSTricks arrows, drawn with the |pstricks| method, are
1186 % always available, even if this option is not set, provided the
1187 % \pkg{pstricks} package is loaded independently.
1188 % \end{docOption}
1189 %
1190 % \begin{docOption}{pstarrows}
1191 % \DeclareOverArrowCommand[picture]{\overpictarrow}{}
1192 % Loads the \pkg{pict2e} package, with its option |pstarrows|. Vectors using
1193 % \LaTeX{} |picture| environment gives then \pstarrows$\overpictarrow{AB}$
1194 % instead of \ltxarrows$\overpictarrow{AB}$.
1195 %
1196 % Note that this affect all vectors drawn in \LaTeX{} |picture| environments,
1197 % and that this setting can be changed on the fly with the commands \cs{pstarrows}
1198 % and \cs{ltxarrows} from the \pkg{pict2e} package.
1199 % \end{docOption}
1200 %
1201 % \begin{docOption}{subscripts}
1202 % Sets the default value of the key \refKey{detect subscripts} to |true|.
1203 %
1204 % This option also impacts the command \refCom{vv} and all predefined
1205 % commands, so that they automatically use their starred variant when
1206 % a subscript follows.
1207 % \end{docOption}
1208 %
1209 % \begin{docOption}{subother}
1210 % \tcbdocmarginnote{\tcbdocnew{v1.1 2023/02/15}}
1211 % Sets to 12 (\emph{other} catcode category) the catcode of the ``|_|" symbol
1212 % used for subscript detection, when this is enabled by the key \refKey{detect
1213 % subscripts} (see the section~\ref{sec:non-standard-subscripts},
1214 % page~\pageref{sec:non-standard-subscripts}).
1215 % \end{docOption}
1216 %
1217 % \begin{docOption}{subactive}
1218 % \tcbdocmarginnote{\tcbdocnew{v1.1 2023/02/15}}
1219 % Sets to 13 (\emph{active} catcode category) the catcode of the ``|_|" symbol
1220 % used for subscript detection, when this is enabled by the key \refKey{detect
1221 % subscripts} (see the section~\ref{sec:non-standard-subscripts},
1222 % page~\pageref{sec:non-standard-subscripts}).
1223 % \end{docOption}
1224 %
1225 % \begin{docOption}{debug}
1226 % Writes the meaning of defined commands in \LaTeX{} log.
1227 % \end{docOption}
1228 %
1229 % \subsection{Commands}
1230 %
1231 % \subsubsection{Macro for commands creation}
1232 % \label{sec:macro-for-commands-creation}
1233 %
1234 % \begin{docCommands}{%
1235 % {
1236 % doc name=NewOverArrowCommand,
1237 % doc parameter=\oarg{method}\marg{command}\marg{keys},
1238 % },
1239 % {
1240 % doc name=RenewOverArrowCommand,
1241 % doc parameter=\oarg{method}\marg{command}\marg{keys},
1242 % },
1243 % {
1244 % doc name=ProvideOverArrowCommand,
1245 % doc parameter=\oarg{method}\marg{command}\marg{keys},
1246 % },
1247 % {
1248 % doc name=DeclareOverArrowCommand,
1249 % doc parameter=\oarg{method}\marg{command}\marg{keys},
1250 % },
1251 % }
1252 % Creates the command \meta{command} and its starred variant
1253 % \meta{command}|*|. The starred variant \meta{command}|*| removes the extra
1254 % end space generated by the arrow, which is suitable, as example, when
1255 % a subscript follows.
1256 %
1257 % \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}}
1258 % \meta{command} can be given with or without backslash (prior to the version
1259 % 1.2, only the name, without backslash, was accepted).
1260 %
1261 % \tcbdocmarginnote{\tcbdocupdated{v1.4 2025/04/30}}
1262 % Since the version 1.4, the \meta{command} is robust (for example, it can be
1263 % used safety inside \cs{caption}).
1264 %
1265 % \begin{description}
1266 % \item[\cs{NewOverArrowCommand}] raises an error if \meta{command} is
1267 % already defined.
1268 %
1269 % \item[\cs{RenewOverArrowCommand}] raises an error if \meta{command}
1270 % is undefined.
1271 %
1272 % \item[\cs{ProvideOverArrowCommand}] sets \meta{command} if the command is
1273 % undefined and does nothing if it is already defined, without raising
1274 % any error.
1275 %
1276 % \item[\cs{DeclareOverArrowCommand}] sets \meta{command}, whether the command
1277 % is already defined or not, without raising any error.
1278 % \end{description}
1279 %
1280 % The \meta{method} used to draw the arrow must be:
1281 % \begin{description}
1282 % \item[|symb|] to draw the arrow by symbols assemblage (default);
1283 % \item[|tikz|] to draw the arrow with PGF/TikZ;
1284 % \item[|pstricks|] to draw the arrow with PSTricks;
1285 % \tcbdocmarginnote{\tcbdocnew{v1.2 2024/07/11}}
1286 % \item[|picture|] to draw the arrow with the \LaTeX{}
1287 % |picture| environment.
1288 % \end{description}
1289 % With no \meta{method} argument, the |symb| method is chosen.
1290 %
1291 % \smallskip
1292 %
1293 % \meta{keys} is a comma-separated list of keys-values. Available keys depends
1294 % of the \meta{method} chosen and are described in section~\ref{sec:keys},
1295 % page~\pageref{sec:keys}.
1296 %
1297 %\iffalse
1298 %<*example>
1299 % \fi
1300 \begin{dispExample}
1301 \NewOverArrowCommand[tikz]{\myoverarrow}{arrows={Bar-Bar}, center arrow}
1302 $ \myoverarrow{v} \qquad \myoverarrow{ABCD} $
1303 \end{dispExample}
1304 % \iffalse
1305 %</example>
1306 % \fi
1307 % \end{docCommands}
1308 %
1309 % \begin{docCommands}{%
1310 % {
1311 % doc name=TestOverArrow,
1312 % doc parameter=\oarg{pattern}\marg{command},
1313 % },
1314 % {
1315 % doc name=TestOverArrow*,
1316 % doc parameter=\oarg{pattern}\marg{command},
1317 % },
1318 % }
1319 % Displays the result of the command \meta{command} for patterns of various
1320 % lengths and for the four math styles. A custom \meta{pattern} can be added
1321 % to the predefined ones.
1322 %
1323 % The starred variant \cs{TestOverArrow*} displays a full report, including
1324 % kerning tests of the commands \meta{command} and \meta{command}|*|.
1325 %
1326 % \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}}
1327 % \meta{command} can be given with or without backslash (prior to the version
1328 % 1.2, only the name, without backslash, was accepted).
1329 %
1330 % \iffalse
1331 %<*example>
1332 % \fi
1333 \begin{dispExample}
1334 \TestOverArrow*[my~pattern]{vv}
1335 \end{dispExample}
1336 % \iffalse
1337 %</example>
1338 % \fi
1339 %
1340 % \end{docCommands}
1341 %
1342 % \subsubsection{Useful macros for symbols assemblage}
1343 %
1344 % Math symbols assemblage is the default method used to draw arrows.
1345 % The following macros are designed to help combine and format math symbols.
1346 %
1347 % \begin{docCommand}{xjoinrel}{\oarg{number}}
1348 % Removes an horizontal space of \meta{number} math units (|3.5 mu| by
1349 % default). Must be used in math mode. Useful to assemble math symbols and
1350 % create new ones.
1351 %
1352 % \iffalse
1353 %<*example>
1354 % \fi
1355 \begin{dispExample}
1356 \newcommand*{\triplebar}{\Relbar\xjoinrel[14]\relbar}
1357 \newcommand*{\triplebararrow}{\Relbar\xjoinrel[15]\rightarrow}
1358 \scalebox{2}{$ \triplebar \quad \triplebararrow $} \par
1359 \scalebox{2}{$ \triplebar\xjoinrel\triplebararrow $}
1360 \end{dispExample}
1361 % \iffalse
1362 %</example>
1363 % \fi
1364 % \end{docCommand}
1365 %
1366 % \begin{docCommand}{smallermathstyle}{}
1367 % Applies the next math style, smaller than the current. That is:
1368 % \begin{itemize}
1369 % \item uses \cs{scriptstyle} if the current math style is \cs{displaystyle}
1370 % or \cs{textstyle};
1371 % \item uses \cs{scriptscriptstyle} if the current math style is
1372 % \cs{scriptstyle};
1373 % \item does nothing if the current math style is \cs{scriptscriptstyle}.
1374 % \end{itemize}
1375 %
1376 %\iffalse
1377 %<*example>
1378 % \fi
1379 \begin{dispExample}
1380 $ \displaystyle AB \quad \textstyle AB
1381 \quad \scriptstyle AB \quad \scriptscriptstyle AB $\par
1382 $ \displaystyle AB \quad \smallermathstyle AB
1383 \quad \smallermathstyle AB \quad \smallermathstyle AB $
1384 \end{dispExample}
1385 % \iffalse
1386 %</example>
1387 % \fi
1388 %
1389 % \end{docCommand}
1390 %
1391 % \begin{docCommand}{arrowmathstyle}{}
1392 % \tcbdocmarginnote{\tcbdocnew{v1.5 2025/10/19}}
1393 % Expands to the current math style. This could be useful inside box macros,
1394 % such as, for example, \cs{raisebox}, \cs{rotatebox} or \cs{scalebox} (these
1395 % last two are defined by the package \pkg{graphicx}). \cs{arrowmathstyle} is
1396 % only available inside commands created with \refCom{NewOverArrowCommand}
1397 % and variants.
1398 %
1399 %\iffalse
1400 %<*example>
1401 % \fi
1402 \begin{dispExample}
1403 % ^^A \rotatebox is defined with \usepackage{graphicx}
1404 \NewOverArrowCommand{\heartarrow}{%
1405 start={\raisebox{\dimeval{-0.5\height+0.5\depth}}{$\arrowmathstyle\gg$}},
1406 end={\rotatebox[origin=cB]{+90}{$\arrowmathstyle\heartsuit$}},
1407 middle={\baselinebar},
1408 trim start=7,
1409 trim end=2.5,
1410 trim middle=4,
1411 shift leftright=-6,
1412 }
1413 $ \displaystyle \heartarrow{Love}
1414 \qquad \textstyle \heartarrow{Love}
1415 \qquad \scriptstyle \heartarrow{Love}
1416 \qquad \scriptscriptstyle \heartarrow{Love} $
1417 \end{dispExample}
1418 % \iffalse
1419 %</example>
1420 % \fi
1421 %
1422 % \end{docCommand}
1423 %
1424 % \begin{docCommand}{baselinebar}{}
1425 % \tcbdocmarginnote{\tcbdocnew{v1.5 2025/10/19}}
1426 % Draws a zero-height horizontal bar \symb{\baselinebar}, aligned with the
1427 % baseline (analogous to \cs{relbar} defined by \LaTeX{}, and redefined by
1428 % the \pkg{amsmath} package, but centered on the baseline). \cs{baselinebar}
1429 % should work with most fonts. It is used in the definition of
1430 % \refCom{overbar} and \refCom{underbar}.
1431 %
1432 % For example, the \refCom{overbar} command is defined with:
1433 % \iffalse
1434 %<*example>
1435 % \fi
1436 \begin{dispListing}
1437 \DeclareOverArrowCommand{\overbar}{%
1438 amsmath, middle={\baselinebar},
1439 start={\baselinebar}, end={\baselinebar},
1440 space before arrow={0.5\overarrowthickness},
1441 space after arrow={3.5\overarrowthickness}
1442 }
1443 \end{dispListing}
1444 % \iffalse
1445 %</example>
1446 % \fi
1447 %
1448 % \end{docCommand}
1449 %
1450 % \subsubsection{Useful lengths for TikZ, PSTricks or \texttt{picture} environment}
1451 %
1452 % Arrows drawn with graphic languages, like PGF/TikZ, PSTricks or the \LaTeX{}
1453 % |picture| environment, are not extensible. The three lengths
1454 % \refLen*{overarrowlength}, \refLen*{overarrowthickness} and
1455 % \refLen*{overarrowsmallerthickness} are computed at each utilisation of
1456 % a command set with the |tikz|, |pstricks| or |picture| method, so they can be
1457 % used in drawing commands.
1458 %
1459 % \iffalse
1460 %<*example>
1461 % \fi
1462 \begin{dispExample*}{grow to left by=-2em}
1463 \NewOverArrowCommand[tikz]{\overparabola}{%
1464 path options={x=\overarrowlength, line width=\overarrowsmallerthickness},
1465 path={(0,0) parabola[parabola height=0.2\overarrowlength] (1,0)},
1466 arrows={-}, center arrow, min length=30,
1467 }
1468 $\displaystyle \overparabola{v} \qquad \overparabola{ABCD} $ \par
1469 $\scriptstyle \overparabola{v} \qquad \overparabola{ABCD} $ \par
1470 \end{dispExample*}
1471 % \iffalse
1472 %</example>
1473 % \fi
1474 %
1475 % \begin{docLength}{overarrowlength}
1476 % Is set to the width of the arrow command content, or, if larger, to the
1477 % minimal arrow length set through the key \refKey{min length}.
1478 % \end{docLength}
1479 %
1480 % \begin{docLength}{overarrowthickness}
1481 % Is set to the default rule thickness of the current math style. That is:
1482 % \begin{itemize}
1483 % \item |\fontdimen 8 \textfont 3| in \cs{displaystyle} or \cs{textstyle};
1484 % \item |\fontdimen 8 \scriptfont 3| in \cs{scriptstyle};
1485 % \item |\fontdimen 8 \scriptscriptfont 3| in
1486 % \cs{scriptscriptstyle}.
1487 % \end{itemize}
1488 %
1489 % \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}}
1490 % Theses settings are adapted when the package \pkg{unicode-math} is loaded
1491 % (using \cs{Umathoverbarrule} with \LuaLaTeX{} or |\fontdimen 54|, family~2
1492 % with \XeLaTeX{} --- see the manual of \pkg{unicode-math}).
1493 %
1494 % \tcbdocmarginnote{\tcbdocupdated{v1.5 2025/10/19}}
1495 % Since the version 1.5, the length \cs{overarrowthickness} is always
1496 % available, whatever drawing method is used for the arrow (including arrows
1497 % drawn by symbols assemblage).
1498 % \end{docLength}
1499 %
1500 % \begin{docLength}{overarrowsmallerthickness}
1501 % Is set to the default rule thickness of the next smaller math style.
1502 % That is:
1503 % \begin{itemize}[before=\raggedright]
1504 % \item |\fontdimen 8 \scriptfont 3| in \cs{displaystyle} or \cs{textstyle};
1505 % \item |\fontdimen 8 \scriptscriptfont 3| in \cs{scriptstyle} or
1506 % \cs{scriptscriptstyle}.
1507 % \end{itemize}
1508 %
1509 % \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}}
1510 % Theses settings are adapted when the package \pkg{unicode-math} is loaded
1511 % (using \cs{Umathoverbarrule} with \LuaLaTeX{} or |\fontdimen 54|, family~2
1512 % with \XeLaTeX{} --- see the manual of \pkg{unicode-math}).
1513 %
1514 % \tcbdocmarginnote{\tcbdocupdated{v1.5 2025/10/19}}
1515 % Since the version 1.5, the length \cs{overarrowsmallerthickness} is always
1516 % available, whatever drawing method is used for the arrow (including arrows
1517 % drawn by symbols assemblage).
1518 % \end{docLength}
1519 %
1520 % \subsubsection{Vectors macros}
1521 %
1522 % The macro \cs{vv}, dedicated to vectors, is automatically defined when the
1523 % option \refOpt{esvect} is set (which is the default). It is a clone of the
1524 % \cs{vv} command provided by the \pkg{esvect} package, but its starred variant
1525 % has a correct kerning when followed by a subscript.
1526 %
1527 % \begin{docCommands}{%
1528 % {
1529 % doc name=vv,
1530 % doc parameter=\marg{content},
1531 % },
1532 % {
1533 % doc name=vv*,
1534 % doc parameter=\marg{content},
1535 % },
1536 % }
1537 % Draws a vector arrow upon math \meta{content}. The shape of the arrow
1538 % depends on the corresponding options described in
1539 % section~\ref{sec:esvect-conf}, page~\pageref{sec:esvect-conf} :
1540 % \refOpt{esvecta}, \refOpt{esvectb}, \refOpt{esvectc}, \refOpt{esvectd},
1541 % \refOpt{esvecte}, \refOpt{esvectf}, \refOpt{esvectg}, \refOpt{esvecth}.
1542 %
1543 % The starred variant \cs{vv*} suppresses the end space created by the arrow.
1544 %
1545 % \iffalse
1546 %<*example>
1547 % \fi
1548 \begin{dispExample}
1549 $ \vv{\imath}_{0} \quad \vv{e}_r \quad \vv{L}_\Delta $\par
1550 $ \vv*{\imath}_{0} \quad \vv*{e}_r \quad \vv*{L}_\Delta $
1551 \end{dispExample}
1552 % \iffalse
1553 %</example>
1554 % \fi
1555 %
1556 %\end{docCommands}
1557 %
1558 % \begin{docCommand}{esvectvv}{}
1559 % Is simply the backup of the original \pkg{esvect} \cs{vv} command.
1560 % \iffalse
1561 %<*example>
1562 % \fi
1563 \begin{dispExample}
1564 $ \esvectvv{\imath}_{0} \quad \esvectvv{e}_{r} \quad \esvectvv{L}_\Delta $\par
1565 $ \esvectvv*{\imath}{0} \quad \esvectvv*{e}{r} \quad \esvectvv*{L}{\Delta} $
1566 \end{dispExample}
1567 % \iffalse
1568 %</example>
1569 % \fi
1570 %
1571 % \end{docCommand}
1572 %
1573 % \subsubsection{Predefined commands}
1574 % \label{sec:predefined-commands}
1575 %
1576 % Predefined commands are defined if the corresponding option is set (see
1577 % section~\ref{sec:predefined-commands-opt},
1578 % page~\pageref{sec:predefined-commands-opt}). The commands
1579 % \begin{itemize}
1580 % \item \refCom*{overrightarrow};
1581 % \item \refCom*{overleftarrow};
1582 % \item \refCom*{overleftrightarrow};
1583 % \item \refCom*{underrightarrow};
1584 % \item \refCom*{underleftarrow};
1585 % \item \refCom*{underleftrightarrow}
1586 % \end{itemize}
1587 % are affected by the option \refOpt{old-arrows}.
1588 %
1589 % \medskip
1590 %
1591 % \noindent\textbf{Over arrows}
1592 %
1593 % \begin{docCommand}{overrightarrow}{}
1594 % \[ \overrightarrow{v} \qquad \overrightarrow{AB} \qquad \overrightarrow{\mathrm{grad}} \]
1595 %
1596 % The shape of the arrow is smaller if the option \refOpt{old-arrows} is set.
1597 % \end{docCommand}
1598 %
1599 % \begin{docCommand}{overleftarrow}{}
1600 % \[ \overleftarrow{v} \qquad \overleftarrow{AB} \qquad \overleftarrow{\mathrm{grad}} \]
1601 %
1602 % The shape of the arrow is smaller if the option \refOpt{old-arrows} is set.
1603 % \end{docCommand}
1604 %
1605 % \begin{docCommand}{overleftrightarrow}{}
1606 % \[ \overleftrightarrow{v} \qquad \overleftrightarrow{AB} \qquad\overleftrightarrow{\mathrm{grad}} \]
1607 %
1608 % The shape of the arrows is smaller if the option \refOpt{old-arrows} is set.%
1609 % \end{docCommand}
1610 %
1611 %\begin{docCommand}{overrightharpoonup}{}
1612 % \[ \overrightharpoonup{v} \qquad \overrightharpoonup{AB} \qquad \overrightharpoonup{\mathrm{grad}} \]
1613 % \end{docCommand}
1614 %
1615 % \begin{docCommand}{overrightharpoondown}{}
1616 % \[ \overrightharpoondown{v} \qquad \overrightharpoondown{AB} \qquad \overrightharpoondown{\mathrm{grad}} \]
1617 % \end{docCommand}
1618 %
1619 % \begin{docCommand}{overleftharpoonup}{}
1620 % \[ \overleftharpoonup{v} \qquad \overleftharpoonup{AB} \qquad \overleftharpoonup{\mathrm{grad}} \]
1621 % \end{docCommand}
1622 %
1623 % \begin{docCommand}{overleftharpoondown}{}
1624 % \[ \overleftharpoondown{v} \qquad \overleftharpoondown{AB} \qquad \overleftharpoondown{\mathrm{grad}} \]
1625 % \end{docCommand}
1626 %
1627 % \begin{docCommand}{overbar}{}
1628 % \[ \overbar{v} \qquad \overbar{AB} \qquad \overbar{\mathrm{grad}} \]
1629 %
1630 % \tcbdocmarginnote{\tcbdocupdated{v1.5 2025/10/19}}
1631 % Since version 1.5, the \cs{overbar} command car be properly nested.
1632 % \[ \overbar{\overbar{AB}} \qquad x_{\overbar{\overbar{AB}}} \]
1633 %
1634 % \end{docCommand}
1635 %
1636 %
1637 % \medskip
1638 %
1639 % \noindent\textbf{Under arrows}
1640 %
1641 % \begin{docCommand}{underrightarrow}{}
1642 % \[ \underrightarrow{v} \qquad \underrightarrow{AB} \qquad \underrightarrow{\mathrm{grad}} \]
1643 %
1644 % The shape of the arrow is smaller if the option \refOpt{old-arrows} is set.
1645 % \end{docCommand}
1646 %
1647 % \begin{docCommand}{underleftarrow}{}
1648 % \[ \underleftarrow{v} \qquad \underleftarrow{AB} \qquad \underleftarrow{\mathrm{grad}} \]
1649 %
1650 % The shape of the arrow is smaller if the option \refOpt{old-arrows} is set.
1651 % \end{docCommand}
1652 %
1653 % \begin{docCommand}{underleftrightarrow}{}
1654 % \[ \underleftrightarrow{v} \qquad \underleftrightarrow{AB} \qquad \underleftrightarrow{\mathrm{grad}} \]
1655 %
1656 % The shape of the arrows is smaller if the option \refOpt{old-arrows} is set.
1657 % \end{docCommand}
1658 %
1659 % \begin{docCommand}{underrightharpoonup}{}
1660 % \[ \underrightharpoonup{v} \qquad \underrightharpoonup{AB} \qquad \underrightharpoonup{\mathrm{grad}} \]
1661 % \end{docCommand}
1662 %
1663 % \begin{docCommand}{underrightharpoondown}{}
1664 % \[ \underrightharpoondown{v} \qquad \underrightharpoondown{AB} \qquad \underrightharpoondown{\mathrm{grad}} \]
1665 % \end{docCommand}
1666 %
1667 % \begin{docCommand}{underleftharpoonup}{}
1668 % \[ \underleftharpoonup{v} \qquad \underleftharpoonup{AB} \qquad \underleftharpoonup{\mathrm{grad}} \]
1669 % \end{docCommand}
1670 %
1671 % \begin{docCommand}{underleftharpoondown}{}
1672 % \[ \underleftharpoondown{v} \qquad \underleftharpoondown{AB} \qquad \underleftharpoondown{\mathrm{grad}} \]
1673 % \end{docCommand}
1674 %
1675 % \begin{docCommand}{underbar}{}
1676 % \[ \underbar{v} \qquad \underbar{AB} \qquad \underbar{\mathrm{grad}} \]
1677 %
1678 % \tcbdocmarginnote{\tcbdocupdated{v1.5 2025/10/19}}
1679 % Since version 1.5, the \cs{underbar} command car be properly nested.
1680 % \[ \underbar{\underbar{AB}} \qquad x_{\underbar{\underbar{AB}}} \]
1681 % \end{docCommand}
1682 %
1683 % \subsection{Keys}
1684 %\label{sec:keys}
1685 %
1686 % The customisation of arrows is done at command creation through a key-value
1687 % interface provided by the \pkg{pgfkeys} package (with |/overarrows/| as key
1688 % path).
1689 %
1690 % \subsubsection{Arrow position and length settings}
1691 %
1692 % These keys are available whatever the method chosen at command creation (see
1693 % section~\ref{sec:macro-for-commands-creation},
1694 % page~\pageref{sec:macro-for-commands-creation} for the documentation of
1695 % commands creation).
1696 %
1697 % \medskip\par\noindent\textbf{Length}
1698 %
1699 % \begin{docKey}{min length}{=\marg{number}}
1700 % {no default, see below for the initial value}
1701 % Sets the minimal arrow length to \meta{number} math units. The arrow length is
1702 % set from content width, or, if larger, to this value.
1703 %
1704 % The initial value of \refKey*{min length} depends on the \meta{method} chosen
1705 % at command creation (see section~\ref{sec:macro-for-commands-creation},
1706 % page~\pageref{sec:macro-for-commands-creation} for the documentation of
1707 % commands creation):
1708 % \begin{itemize}
1709 % \item \meta{number}| = 0 | for the |symb| method (method by default);
1710 % \item \meta{number}| = 12| for the |tikz| method;
1711 % \item \meta{number}| = 12| for the |pstricks| method;
1712 % \item \meta{number}| = 18| for the |picture| method.
1713 % \end{itemize}
1714 %
1715 %\iffalse
1716 %<*example>
1717 % \fi
1718 \begin{dispExample}
1719 \NewOverArrowCommand{\overlongarrow}{min length=50}
1720 $ \overlongarrow{v} \qquad \overlongarrow{ABCDEF} $
1721 \end{dispExample}
1722 % \iffalse
1723 %</example>
1724 % \fi
1725 %\end{docKey}
1726 %
1727 % \medskip\par\noindent\textbf{Placement}
1728 %
1729 % \begin{docKeys}{
1730 % {
1731 % doc name={arrow under},
1732 % doc description={default |autoconfig|, initially unset},
1733 % },
1734 % {
1735 % doc name={arrow under},
1736 % doc parameter={=autoconfig\textbar noconfig},
1737 % doc no index,
1738 % }
1739 % }
1740 % Places the arrow under, instead of over.
1741 % \begin{description}
1742 % \item[\refKey*{arrow under} or \refKey*{arrow under}|=autoconfig|] also
1743 % configures suitably the key \refKey{detect subscripts} to |false| and the
1744 % key \refKey{before arrow} to get an additional space over the arrow.
1745 % \item[\refKey*{arrow under}|=noconfig|] does not do any
1746 % additional configuration.
1747 % \end{description}
1748 %
1749 % \iffalse
1750 %<*example>
1751 % \fi
1752 \begin{dispExample}
1753 \NewOverArrowCommand{\underhooks}{%
1754 start={\lhook}, end={\rhook}, trim=1,
1755 arrow under, shift leftright=-4,
1756 }
1757 $ \underhooks{v} \qquad \underhooks{AB} $
1758 \end{dispExample}
1759 % \iffalse
1760 %</example>
1761 % \fi
1762 %
1763 % \end{docKeys}
1764 %
1765 % \medskip\par\noindent\textbf{Horizontal shifts}
1766 %
1767 % \begin{docKey}{shift left}{=\marg{number}}
1768 % {no default, initially |2|}
1769 % Shifts the left side of the arrow by \meta{number} math units (positive number
1770 % means a shift to the right).
1771 %\end{docKey}
1772 %
1773 % \begin{docKey}{shift right}{=\marg{number}}
1774 % {no default, see below for the initial value}
1775 % Shifts the right side of the arrow by \meta{number} math units (positive
1776 % number means a shift to the left).
1777 %
1778 % The initial value of \refKey*{shift right} depends on the \meta{method} chosen
1779 % at command creation (see section~\ref{sec:macro-for-commands-creation},
1780 % page~\pageref{sec:macro-for-commands-creation} for the documentation of
1781 % commands creation):
1782 % \begin{itemize}
1783 % \item \meta{number}| = 0 | for the |symb| method (method by default);
1784 % \item \meta{number}| = -2| for the |tikz|, |pstricks| and |picture| methods.
1785 % \end{itemize}
1786 %
1787 %\end{docKey}
1788 %
1789 %\iffalse
1790 %<*example>
1791 % \fi
1792 \begin{dispExample*}{grow to left by=-2em}
1793 \NewOverArrowCommand{\lookback}{%
1794 start={\leftarrow}, end={\rightharpoondown},
1795 shift left=-50, shift right=-10,
1796 }
1797 $ \lookback{\text{look back}} $
1798 \end{dispExample*}
1799 % \iffalse
1800 %</example>
1801 % \fi
1802 %
1803 %
1804 % \begin{docKey}{shift leftright}{=\marg{number}}{no default}
1805 % Sets \refKey{shift left} and \refKey{shift right} to the same
1806 % \meta{number} value.
1807 %\end{docKey}
1808 %
1809 %
1810 % \begin{docKey}{center arrow}{}{}
1811 % Sets \refKey{shift left} and \refKey{shift right} to zero.
1812 %\end{docKey}
1813 %
1814 % \begin{docKey}{left arrow}{=\marg{number}}{default |2|}
1815 % Sets \refKey{shift left} to zero and \refKey{shift right} to \meta{number}.
1816 % \end{docKey}
1817 %
1818 % \begin{docKey}{right arrow}{=\marg{number}}{default |2|}
1819 % Sets \refKey{shift right} to zero and \refKey{shift left} to \meta{number}.
1820 % \end{docKey}
1821 %
1822 % \medskip\par\noindent\textbf{Vertical adjunct}
1823 %
1824 % \begin{docKeys}{
1825 % {
1826 % doc name={before arrow},
1827 % doc parameter={=\marg{vertical material}},
1828 % doc description={initially empty},
1829 % },
1830 % {
1831 % doc name={after arrow},
1832 % doc parameter={=\marg{vertical material}},
1833 % doc description={initially empty},
1834 % },
1835 % }
1836 % Adds the \meta{vertical material} before or after the arrow.
1837 %
1838 % Over and under arrow commands are typeset through the \TeX{} \cs{ialign}
1839 % command, which aligns contents, like a tabular. The \meta{vertical material}
1840 % is inserted \emph{between} the rows, with \TeX{} \cs{noalign} command.
1841 %
1842 % These keys are essentially used to add some extra space between the arrow
1843 % and the content of the command. They can be set in a handier way with the
1844 % keys \refKey{space before arrow} and \refKey{space after arrow}.
1845 % \end{docKeys}
1846 %
1847 % \begin{docKey}{space before arrow}{=\marg{length}}{no default}
1848 % Adds a space of \meta{length} before the arrow. This sets the keys
1849 % \refKey{before arrow}.
1850 % \end{docKey}
1851 %
1852 % \begin{docKey}{space after arrow}{=\marg{length}}{no default}
1853 % Adds a space of \meta{length} after the arrow. This sets the keys
1854 % \refKey{after arrow}.
1855 % \end{docKey}
1856 %
1857 % \tcbdocmarginnote{\tcbdocupdated{v1.5 2025/10/19}}
1858 % Since the version 1.5, the length \refLen{overarrowthickness} can be used to
1859 % set \refKey{space before arrow} or \refKey{space after arrow}, whatever
1860 % drawing methods is chosen, including the symbols assemblage. The main interest
1861 % is that \refLen{overarrowthickness} scale with the math style and the
1862 % main font.
1863 %
1864 % \iffalse
1865 %<*example>
1866 % \fi
1867 \begin{dispExample*}{grow to left by=-2em}
1868 \NewOverArrowCommand{\overharpoonsdown}{%
1869 start=\leftharpoondown, end=\rightharpoondown, center arrow,
1870 space before arrow=-\overarrowthickness,
1871 space after arrow=3\overarrowthickness,
1872 }
1873 $ \dot{\overharpoonsdown{v}} \quad \ddot{\overharpoonsdown{AB}} \qquad
1874 \scriptstyle \dot{\overharpoonsdown{v}} \quad \ddot{\overharpoonsdown{AB}} $
1875 \end{dispExample*}
1876 % \iffalse
1877 %</example>
1878 % \fi
1879 %
1880 % \subsubsection{Subscripts detection setting}
1881 %
1882 % This key is available whatever the method chosen at command creation (see
1883 % section~\ref{sec:macro-for-commands-creation},
1884 % page~\pageref{sec:macro-for-commands-creation} for the documentation of
1885 % commands creation).
1886 %
1887 % \begin{docKey}{detect subscripts}{=true\textbar{}false}
1888 % {default |true|, see below for the initial value}
1889 %
1890 % Removes automatically the extra end space created by the arrow, if a subscript
1891 % immediately follows the command.
1892 %
1893 % By default, the initial value of \refKey*{detect subscripts} is |false|.
1894 % When the option \refOpt{subscripts} is set, the initial value of
1895 % \refKey*{detect subscripts} is |true|.
1896 %
1897 % Note that the detection may fail when the standard subscript command is
1898 % changed or altered (see the section~\ref{sec:non-standard-subscripts},
1899 % page~\pageref{sec:non-standard-subscripts}).
1900 %
1901 % \iffalse
1902 %<*example>
1903 % \fi
1904 \begin{dispExample}
1905 \NewOverArrowCommand{\autosub}{detect subscripts}
1906 $ \imath_0 \qquad \autosub{\imath}_0 \qquad
1907 {\autosub{\imath}}_0 \qquad {\autosub*{\imath}}_0 $
1908 \end{dispExample}
1909 % \iffalse
1910 %</example>
1911 % \fi
1912 %
1913 %\end{docKey}
1914 %
1915 % \subsubsection{Symbols assemblage settings}
1916 %
1917 % The following keys are available for arrows drawn with the default |symb|
1918 % method (see section~\ref{sec:macro-for-commands-creation},
1919 % page~\pageref{sec:macro-for-commands-creation} for the documentation of
1920 % commands creation).
1921 %
1922 % \begin{docKeys}{
1923 % {
1924 % doc name={start},
1925 % doc parameter={=\marg{command}},
1926 % doc description={no default, initially \cs{relbar}},
1927 % },
1928 % {
1929 % doc name={middle},
1930 % doc parameter={=\marg{command}},
1931 % doc description={no default, initially set by \refKey*{middle config}|=auto|},
1932 % },
1933 % {
1934 % doc name={end},
1935 % doc parameter={=\marg{command}},
1936 % doc description={no default, see below for the initial value},
1937 % },
1938 % }
1939 % Sets the \meta{command} used to draw the start (left), middle (center) or
1940 % end (right) part of the arrow. The \refKey*{middle} one is repeated, if
1941 % necessary, to extend the arrow. It is set, initially by \refKey*{middle
1942 % config}|=auto|.
1943 % By default, the \refKey*{end} symbols is initially \cs{rightarrow}
1944 % \symb{\rightarrow}. When the option \refOpt{old-arrows} is set, the initial
1945 % value of \refKey*{end} is \cs{varrightarrow} \symb{\varrightarrow}.
1946 %
1947 % \refKey*{start} and \refKey*{end} symbols are typeset in the same group.
1948 % \refKey*{middle} is typeset alone. This means that, if a command, like
1949 % \refCom{smallermathstyle}, is used to alter the symbols, it should be
1950 % applied both to \refKey*{start} and \refKey*{middle} (but not to
1951 % \refKey*{end}).
1952 %
1953 %\iffalse
1954 %<*example>
1955 % \fi
1956 \begin{dispExample}
1957 \NewOverArrowCommand{\smalleroverrightarrow}{%
1958 start={\smallermathstyle\relbar},
1959 middle={\smallermathstyle\relbareda},
1960 end={\rightarrow},
1961 space after arrow={0.2ex},
1962 }
1963 $ \smalleroverrightarrow{v} \qquad \smalleroverrightarrow{AB} $
1964 \end{dispExample}
1965 % \iffalse
1966 %</example>
1967 % \fi
1968 %\end{docKeys}
1969 %
1970 %
1971 %\begin{docKey}{trim start}{=\marg{number}}{no default, initially |7|}
1972 % Trims \meta{number} math units from the right side of the
1973 % \refKey{start} symbol.
1974 % \end{docKey}
1975 %
1976 % \begin{docKey}{trim middle}{=\marg{number}}
1977 % {no default, initially set by \refKey*{middle config}|=auto|}
1978 % Trims \meta{number} math units from both left and right sides of the
1979 % \refKey{middle} symbol.
1980 % \end{docKey}
1981 %
1982 % \begin{docKey}{trim end}{=\marg{number}}{no default, initially |7|}
1983 % Trims \meta{number} math units from the left side of the
1984 % \refKey{end} symbol.
1985 % \end{docKey}
1986 %
1987 % \begin{docKey}{trim}{=\marg{number}}{no default}
1988 % Sets \refKey{trim start}, \refKey{trim middle} and \refKey{trim end} to the
1989 % same \meta{number} value.
1990 % \end{docKey}
1991 %
1992 % \begin{docKey}{no trimming}{}{}
1993 % Clears \refKey{trim start}, \refKey{trim middle} and \refKey{trim end}.
1994 % \end{docKey}
1995 %
1996 %\begin{docKey}{middle config}{=auto\textbar relbar\textbar relbareda\textbar harrowextender}{no default}
1997 % Sets a suitable configuration for the keys \refKey{middle} and \refKey{trim
1998 % middle}:
1999 % \begin{description}
2000 % \item[For \refKey*{middle config}| = relbar|,] \refKey{middle} is set to
2001 % \cs{relbar} \symb{\relbar} and \refKey{trim middle} to |2.5|.
2002 % \item[For \refKey*{middle config}| = relbareda|,] \refKey{middle} is set to
2003 % \cs{relbareda} \symb{\relbareda} and \refKey{trim middle} to |1|.
2004 % \item[For \refKey*{middle config}| = harrowextender|,]
2005 % \tcbdocmarginnote{\tcbdocnew{v1.2 2024/07/11}}
2006 % \refKey{middle} is set to \cs{harrowextender} and \refKey{trim middle} to
2007 % |0|.
2008 % \item[For \refKey*{middle config}| = auto|,]
2009 % \tcbdocmarginnote{\tcbdocupdated{v1.2 2024/07/11}}
2010 % if \cs{harrowextender} is provided by the math font\footnote{See the
2011 % documentation of the package \pkg{unicode-math}.}, \refKey{middle} is set
2012 % with \refKey*{middle config}| = harrowextender|. If \cs{harrowextender}
2013 % isn't availlable, \refKey{middle} is set with \refKey*{middle config}%
2014 % | = relbareda| if the option \refOpt{esvect} is set (which is the
2015 % default) and \refKey*{middle config}| = relabar| if not.
2016 % \end{description}
2017 %\end{docKey}
2018 %
2019 % \begin{docKeys}{
2020 % {
2021 % doc name={amsmath},
2022 % doc description={default |mimic|},
2023 % },
2024 % {
2025 % doc name={amsmath},
2026 % doc parameter={=mimic\textbar strict},
2027 % doc no index,
2028 % }
2029 % }
2030 % Loads a configuration coherent with \pkg{amsmath}
2031 % \cs{overrightarrow} command.
2032 % \begin{description}
2033 % \item[\refKey*{amsmath} or \refKey*{amsmath}|=mimic|] sets the corresponding
2034 % keys suitably:
2035 % \begin{center}
2036 % \begin{tabular*}{\linewidth}{ @{\extracolsep{\fill}}lll }
2037 % \refKey*{start}|={\relbar}|
2038 % & \refKey*{middle}=|{\relbar}|
2039 % & \refKey*{end}|={\rightarrow}| \\
2040 % \refKey*{trim start}|=7|
2041 % & \refKey*{trim middle}|=2|
2042 % & \refKey*{trim end}|=7| \\
2043 % \refKey*{shift leftright}|=0|
2044 % & \refKey*{after arrow}|={}|
2045 % & \refKey*{before arrow}|={}|
2046 % \end{tabular*}
2047 % \end{center}
2048 % \item[\refKey*{amsmath}|=strict|] makes, in addition, the command uses the
2049 % internal macros of \pkg{amsmath}
2050 % \cs{overrightarrow} (\refKey*{no trimming}, \refKey*{fill
2051 % macro}|={\arrowfill@}|, \refKey*{stack macro}|={\overarrow@}|). Note that
2052 % many configuration keys becomes ineffective.
2053 % \end{description}
2054 % \end{docKeys}
2055 %
2056 % \begin{docKeys}{
2057 % {
2058 % doc name={esvect},
2059 % doc description={default |mimic|},
2060 % },
2061 % {
2062 % doc name={esvect},
2063 % doc parameter={=mimic\textbar strict},
2064 % doc no index,
2065 % }
2066 % }
2067 % Loads a configuration coherent with \pkg{amsmath}
2068 % \cs{vv} command.
2069 % \begin{description}
2070 % \item[\refKey*{esvect} or \refKey*{esvect}|=mimic|] sets the corresponding
2071 % keys suitably:
2072 % \begin{center}
2073 % \begin{tabular*}{\linewidth}{ @{\extracolsep{\fill}}lll }
2074 % \refKey*{start}|={\relbaredd}|
2075 % & \refKey*{middle}=|{\relbareda}|
2076 % & \refKey*{end}|={\fldr}| \\
2077 % \refKey*{trim start}|=1.5|
2078 % & \refKey*{trim middle}|=0|
2079 % & \refKey*{trim end}|=1.5| \\
2080 % \refKey*{space before arrow}|=-.7pt|
2081 % & \refKey*{space after arrow}|=-.3pt|
2082 % &\refKey*{right arrow}|=2|
2083 % \end{tabular*}
2084 % \end{center}
2085 % \item[\refKey*{esvect}|=strict|] makes, in addition, the command uses the
2086 % internal macros of the \pkg{esvect} \cs{vv} command. this imply
2087 % \begin{flushleft}
2088 % \refKey*{no trimming}\\
2089 % \refKey*{fill macro}|={\traitfill@}|\\
2090 % \refKey*{stack macro}|={\overvect@}|
2091 % \end{flushleft}
2092 % Note that many configuration keys becomes ineffective.
2093 % \end{description}
2094 %
2095 %\end{docKeys}
2096 %
2097 % \subsubsection{TikZ settings}
2098 % \label{sec:tikz-keys}
2099 %
2100 % If, at command creation (see section~\ref{sec:macro-for-commands-creation},
2101 % page~\pageref{sec:macro-for-commands-creation} for the documentation of
2102 % commands creation), the |tikz| method is chosen, then the arrow is drawn by
2103 % the command:
2104 % \begin{center}
2105 % \cs{tikz}|[<|\refKey*{tikz options}|>]{<|\refKey*{tikz command}|>}|
2106 % \end{center}
2107 % \noindent where \refKey{tikz options} and \refKey{tikz command} are two keys
2108 % described below. When \refKey*{tikz command} is let unset, the drawing command
2109 % turns into:
2110 % \begin{center}
2111 % \cs{tikz}|[<|\refKey*{tikz options}|>]{|\cs{draw}|[<|\refKey*{path options}|>]|
2112 % |<|\refKey*{path}|>;}|
2113 % \end{center}
2114 %
2115 % The best way to customise |tikz| arrows is then to set the keys \refKey{tikz
2116 % options}, \refKey{path options} and \refKey{path}, preferably through the
2117 % handy alternatives: \refKey{add tikz options}, \refKey{add path options},
2118 % \refKey{arrows}, \refKey{line thickness} or \refKey{thinner}.
2119 %
2120 %\iffalse
2121 %<*example>
2122 % \fi
2123 \begin{dispExample*}{grow to left by=-2em}
2124 \NewOverArrowCommand[tikz]{\overdotteddoublearrow}{%
2125 add tikz options={blue}, add path options={densely dotted},
2126 arrows={->[scale=0.5]>[scale=0.5]}, thinner,
2127 min length=20, space after arrow={0.3ex},
2128 }
2129 $ \overdotteddoublearrow{v} \qquad \overdotteddoublearrow{AB} $
2130 \end{dispExample*}
2131 % \iffalse
2132 %</example>
2133 % \fi
2134 %
2135 % \bigskip
2136 %
2137 % The following keys are available when the |tikz| method is chosen.
2138 %
2139 % \begin{docKey}[][before lower=\bigskip\par]
2140 % {tikz options}{=\marg{TikZ options}}
2141 % {no default, initially |x=|\cs{overarrowlength}|, line
2142 % width=|\cs{overarrowthickness}}
2143 % Sets TikZ options to \meta{TikZ options}.
2144 %\end{docKey}
2145 %
2146 % \begin{docKey}[][before lower=\bigskip\par]
2147 % {path options}{=\marg{path options}}
2148 % {no default, initially |arrows={-Classical TikZ Rightarrow}, cap=round|}
2149 % Sets TikZ path options to \meta{path options}.
2150 % \end{docKey}
2151 % \begin{docKey}{path}{=\marg{path specification}}
2152 % {no default, initially |(0,0)--(1,0)|}
2153 % Sets TikZ path specification to \meta{path} (the ending semicolon is
2154 % automatically appended).
2155 %\end{docKey}
2156 %
2157 % \begin{docKey}{add tikz options}{=\marg{TikZ options}}{no default}
2158 % Appends the options \meta{TikZ options} to the key \refKey{tikz options}.
2159 % \end{docKey}
2160 %
2161 % \begin{docKey}{add path options}{=\marg{path options}}{no default}
2162 % Appends the options \meta{path options} to the key \refKey{path options}.
2163 % \end{docKey}
2164 %
2165 % \begin{docKey}{arrows}{=\marg{arrow specification}}{no default}
2166 % Appends the option |arrows={|\meta{arrow specification}|}| to the key
2167 % \refKey{path options}.
2168 % \end{docKey}
2169 %
2170 % \begin{docKey}{line thickness}{=\marg{length}}{no default}
2171 % Appends the option |line width={|\meta{length}|}| to the key \refKey{path
2172 % options}.
2173 % \end{docKey}
2174 %
2175 % \begin{docKey}{thinner}{}{}
2176 % Sets the keys \refKey{line thickness} with \cs{overarrowsmallerthickness}.
2177 % \end{docKey}
2178 %
2179 % \begin{docKey}{tikz command}{=\marg{TikZ command}}{initially unset}
2180 % Sets the \meta{TikZ command} used to draw the arrow. If left unset, the
2181 % value \cs{draw}|[|\refKey*{path options}|] |\refKey*{path}|;| is used.
2182 %\end{docKey}
2183 %
2184 % \subsubsection{PSTricks settings}
2185 % \label{sec:pstricks-keys}
2186 %
2187 % \tcbdocmarginnote{\tcbdocnew{v1.2 2024/07/11}}
2188 % If, at command creation (see section~\ref{sec:macro-for-commands-creation},
2189 % page~\pageref{sec:macro-for-commands-creation} for the documentation of
2190 % commands creation), the |pstricks| method is chosen, then the arrow is drawn
2191 % by:
2192 % \begin{flushleft}\leftskip=3cm
2193 % \cs{begin}|{pspicture}<|\refDoc{key:pstricks}*{geometry}|>%|\\
2194 % \quad\cs{psset}|{linewidth=<|\refDoc{key:pstricks}*{line thickness}|>}%|\\
2195 % \quad\cs{psset}|{<|\refKey*{psset}|>}%|\\
2196 % \quad|<|\refKey*{pstricks command}|>%|\par
2197 % \cs{end}|{pspicture}%|
2198 % \end{flushleft}
2199 % \noindent where \refDoc{key:pstricks}{geometry}, \refDoc{key:pstricks}{line
2200 % thickness} \refKey*{psset} and \refKey*{pstricks command} are four keys
2201 % described below.
2202 %
2203 %\iffalse
2204 %<*example>
2205 % \fi
2206 \begin{dispExample*}{grow to left by=-2em}
2207 \NewOverArrowCommand[pstricks]{\overloopandarrow}{
2208 pstricks command={%
2209 \pscurve{->}(0,0)
2210 (0.6\overarrowlength,0.05\overarrowlength)
2211 (0.5\overarrowlength,0.1\overarrowlength)
2212 (0.4\overarrowlength,0.05\overarrowlength)
2213 (\overarrowlength,0)
2214 },
2215 geometry={(0,0)(\overarrowlength,0.2\overarrowlength)},
2216 space after arrow=2pt, min length=20,
2217 geometry={(0,0)(\overarrowlength,0.2\overarrowlength)},
2218 }
2219 $ \overloopandarrow{v} \qquad \overloopandarrow{AB} $
2220 \end{dispExample*}
2221 % \iffalse
2222 %</example>
2223 % \fi
2224 %
2225 % \bigskip
2226 %
2227 % The following keys are available when the |pstricks| method is chosen.
2228 %
2229 % \begin{docKey}[][before lower=\bigskip\par]
2230 % {pstricks command}{=\marg{pstricks command}}
2231 % {no default, initially \cs{psline}|\{->\}(0,0)(|\refCom*{overarrowlength}|,0)|}
2232 % Sets the |pspicture| command to \meta{pstricks command}.
2233 % \end{docKey}
2234 %
2235 % \begin{docKey}[][doc label={pstricks:arrow}]%^^A same name as for TikZ
2236 % {arrow}{=\marg{arrow}}
2237 % {no default, initially |->|}
2238 % Sets \refKey{pstricks command} with
2239 % |\psline{|\meta{arrow}|}(0,0)(|\refCom*{overarrowlength}|,0)|.
2240 % \end{docKey}
2241 %
2242 % \begin{docKey}[][]
2243 % {psset}{=\marg{pstricks setting}}
2244 % {no default, initially empty}
2245 % Sets \meta{pstricks setting} with \cs{psset}.
2246 % \end{docKey}
2247 %
2248 % \begin{docKey}[][before lower=\bigskip\par, doc label={pstricks:geometry}]%^^A same name as for picture
2249 % {geometry}{=\marg{pstricks geometry specification}}
2250 % {no default, initially |(0,-0.5ex)(|\refCom*{overarrowlength}|,1ex)|}
2251 % Sets the |pspicture| geometry to \meta{pstricks geometry specification}.
2252 % \end{docKey}
2253 %
2254 % \begin{docKey}[][doc label={pstricks:line thickness}]%^^A same name as for TikZ
2255 % {line thickness}{=\marg{length}}{no default}
2256 % Sets the line thickness to \meta{length}.
2257 % \end{docKey}
2258 %
2259 % \begin{docKey}[][doc label={pstricks:thinner}]%^^A same name as for TikZ
2260 % {thinner}{}{}
2261 % Sets the keys \refDoc{key:pstricks}{line thickness} with
2262 % \cs{overarrowsmallerthickness}.
2263 % \end{docKey}
2264 %
2265 % \subsubsection{Picture environment settings}
2266 % \label{sec:picture-keys}
2267 %
2268 % If, at command creation (see section~\ref{sec:macro-for-commands-creation},
2269 % page~\pageref{sec:macro-for-commands-creation} for the documentation of
2270 % commands creation), the |picture| method is chosen, then the arrow is drawn
2271 % by:
2272 % \begin{flushleft}\leftskip=3cm
2273 % \cs{begin}|{picture}<|\refDoc{key:picture}*{geometry}|>%|\\
2274 % \quad\cs{linethickness}|{<|\refDoc{key:picture}*{line thickness}|>}%|\\
2275 % \quad|<|\refKey*{picture command}|>%|\par
2276 % \cs{end}|{picture}%|
2277 % \end{flushleft}
2278 % \noindent where \refDoc{key:picture}{geometry}, \refDoc{key:picture}{line
2279 % thickness} and \refKey*{picture command} are three keys described below.
2280 %
2281 %\iffalse
2282 %<*example>
2283 % \fi
2284 \begin{dispExample*}{grow to left by=-2em}
2285 % ^^A \arc and \roundcap commands are from the pict2e package
2286 % ^^A this example needs \usepackage{pict2e} in the preamble
2287 \NewOverArrowCommand[picture]{\overarc}{%
2288 picture command={%
2289 \roundcap
2290 \put(0.5\overarrowlength,0){\arc[180,0]{0.6\overarrowlength}}
2291 },
2292 geometry={%
2293 (1.2\overarrowlength,0.5\overarrowlength)(-0.1\overarrowlength,0.2ex)
2294 },
2295 thinner, center arrow,
2296 }
2297 $ \overarc{v} \qquad \overarc{AB} $
2298 \end{dispExample*}
2299 % \iffalse
2300 %</example>
2301 % \fi
2302 %
2303 % \bigskip
2304 %
2305 %The following keys are available when the |picture| method is chosen.
2306 %
2307 % \begin{docKey}[][before lower=\bigskip\par]
2308 % {picture command}{=\marg{picture command}}
2309 % {no default, initially \cs{put}|(0,0)\{|\cs{vector}|(1,0)\{|\refCom*{overarrowlength}|\}\}|}
2310 % Sets picture command to \meta{picture command}.
2311 % \end{docKey}
2312 %
2313 % \begin{docKey}[][before lower=\bigskip\par, doc label={picture:geometry}]%^^A same name as for pstricks
2314 % {geometry}{=\marg{picture geometry specification}}
2315 % {no default, initially |(|\refCom*{overarrowlength}|,1ex)(0,-0.5ex)|}
2316 % Sets picture geometry to \meta{picture geometry specification}.
2317 % \end{docKey}
2318 %
2319 % \begin{docKey}[][doc label={picture:line thickness}]%^^A same name as for TikZ
2320 % {line thickness}{=\marg{length}}{no default}
2321 % Sets the picture line thickness to \meta{length}.
2322 % \end{docKey}
2323 %
2324 % \begin{docKey}[][doc label={picture:thinner}]%^^A same name as for TikZ
2325 % {thinner}{}{no default}
2326 % Sets the keys \refDoc{key:picture}{line thickness} with
2327 % \cs{overarrowsmallerthickness}.
2328 % \end{docKey}
2329 %
2330 % \subsection{Advanced commands and keys}
2331 %
2332 % The following commands and keys are used in the implementation of the
2333 % \pkg{overarrows} package. They can also be employed for an advanced
2334 % configuration of the commands created, although unnecessary in the vast
2335 % majority of cases.
2336 %
2337 % \subsubsection{Advanced commands}
2338 %
2339 % \begin{docCommand}{SetOverArrowsSubscriptCommand}{\marg{command}}
2340 % \tcbdocmarginnote{\tcbdocnew{v1.1 2023/02/15}}
2341 % Sets to \meta{command} the command used for subscript detection, when this
2342 % is enabled by the key \refKey{detect subscripts} (see the
2343 % section~\ref{sec:non-standard-subscripts},
2344 % page~\pageref{sec:non-standard-subscripts}).
2345 % \end{docCommand}
2346 %
2347 % \begin{docCommands}{%
2348 % {
2349 % doc name=SetOverArrowsMethod,
2350 % doc parameter=\oarg{stack mechanism}\marg{name}\oarg{pre code}\marg{keys def},
2351 % },
2352 % {
2353 % doc name=SetOverArrowsMethod*,
2354 % doc parameter=\marg{name}\oarg{pre code}\marg{keys def},
2355 % },
2356 % }
2357 % Defines the method \meta{name}, to be used with
2358 % \refCom{NewOverArrowCommand}, with \refCom{RenewOverArrowCommand}, with
2359 % \refCom{ProvideOverArrowCommand} or with \refCom{DeclareOverArrowCommand}.
2360 % When the \meta{name} method is chosen, corresponding keys are defined by
2361 % \meta{keys def}. This must set, in particular, the keys \refKey{no stack
2362 % macro hook} and \refKey{no arrow macro hook}. Optional code \meta{pre code}
2363 % is evaluated before the keys definition.
2364 %
2365 % The unstarred variant automatically defines the key \refKey{no stack macro
2366 % hook}, according to the value of the optional \meta{stack mechanism}.
2367 % This one must be:
2368 % \begin{description}
2369 % \item[|fill|] if \refKey{arrow macro} creates extensible arrows (typically
2370 % with \cs{cleaders}). In this case, the arrow macro (defined by \refKey{no
2371 % arrow macro hook}) is called with the math style, passed as argument (it
2372 % can be, for example, the macro \cs{rightarrowfill@} used by \pkg{amsmath}
2373 % \cs{overrightarrow}). |fill| is the mechanism used by the |symb| method.
2374 % \item[|lens|] if \refKey{arrow macro} creates fixed-length arrows, and
2375 % needs the computation of lengths \refLen{overarrowlength}, \refLen{overarrowthickness}
2376 % and \refLen{overarrowsmallerthickness}. In this case, the arrow macro
2377 % (defined by \refKey{no arrow macro hook}) is called without argument.
2378 % |lens| is the mechanism used by the |tikz| and |picture| methods.
2379 % \end{description}
2380 % Without optional \meta{stack mechanism}, |fill| is used. The starred variant
2381 % does not set the key \refKey{no stack macro hook}.
2382 % \end{docCommands}
2383 %
2384 % \subsubsection{Advanced keys}
2385 %
2386 % \begin{docKey}{stack macro}{=\marg{stack definition}}
2387 % {no default, initially unset}
2388 % Defines the stack macro to be \meta{stack definition}. Stack macro is
2389 % a command which takes three arguments: the arrow macro set by \refKey{arrow
2390 % macro}, the math style, and the command content (under or over the arrow).
2391 % \meta{stack definition} can be, for example, the macro \cs{overarrow@} used by
2392 % \pkg{amsmath} \cs{overrightarrow}.
2393 % \end{docKey}
2394 %
2395 % \begin{docKey}{arrow macro}{=\marg{arrow definition}}
2396 % {no default, initially unset}
2397 % Defines the arrow macro (used in the stack macro) by to be \meta{arrow
2398 % definition}.
2399 % \end{docKey}
2400 %
2401 % \begin{docKey}{no stack macro hook}{=\marg{code}}{no default}
2402 % Sets the \meta{code} executed if \refKey{stack macro} is left unset, after
2403 % user evaluation of \meta{keys} in \refCom{NewOverArrowCommand},
2404 % \refCom{RenewOverArrowCommand}, \refCom{ProvideOverArrowCommand} or
2405 % \refCom{DeclareOverArrowCommand}.
2406 %
2407 % \meta{code} must configure \refKey{stack macro} accordingly to the user
2408 % keys setting.
2409 % \end{docKey}
2410 %
2411 % \begin{docKey}{no arrow macro hook}{=\marg{code}}{no default}
2412 % Sets the \meta{code} executed if \refKey{arrow macro} is left unset, after
2413 % user evaluation of \meta{keys} in \refCom{NewOverArrowCommand},
2414 % \refCom{RenewOverArrowCommand}, \refCom{ProvideOverArrowCommand} or
2415 % \refCom{DeclareOverArrowCommand}.
2416 %
2417 % \meta{code} must configure \refKey{arrow macro} accordingly to the user
2418 % keys setting.
2419 % \end{docKey}
2420 %
2421 % \begin{docKey}{fill macro}{=\marg{definition}}{no default, initially unset}
2422 % Defines the fill macro to be \meta{definition}. The fill macro is used by
2423 % arrows created with the |symb| method, to set \refKey{arrow macro} in
2424 % \refKey{no arrow macro hook}. It is called with fours arguments: start,
2425 % middle and end symbols used to draw the arrow, and the math style.
2426 % \meta{definition} can be, for example, the macro \cs{arrowfill@} used by
2427 % \pkg{amsmath} \cs{overrightarrow}.
2428 % \end{docKey}
2429 %
2430 % \section{Complements}
2431 %
2432 % \subsection{Know issues}
2433 %
2434 % \subsubsection{Math font change}
2435 %
2436 % If the math font differs from the default \emph{Computer Modern}, arrow drawn
2437 % with the |symb| method may have a central part of the arrow with inappropriate
2438 % position or line width. This is
2439 % because the default symbol used for the arrow line is \cs{relbareda}
2440 % \symb{\relbareda} from the \pkg{esvect} package. This can be fixed with the
2441 % \refOpt{noesvect} option.
2442 %
2443 % Depending of the math font, predefined commands may be faulty. For example, at
2444 % the time of writing, hooks vertical position is incorrect with \emph{Asana
2445 % Math} or \cs{harrowextender} is badly positioned with \emph{Stix two Math}
2446 % (for the smallest math styles), \emph{Libertinus Math} and
2447 % \emph{GFSNeohellenicMath}.
2448 %
2449 % \subsubsection{Detection of non standard subscripts}
2450 % \label{sec:non-standard-subscripts}
2451 %
2452 % The subscript detection enabled by the key \refKey{detect subscripts} is based
2453 % on the \LaTeX{} macro \cs{@ifnextchar}. The detection may fail if the standard
2454 % subscript command is modified of altered. This is the case, as example:
2455 % \begin{itemize}
2456 % \item with the \pkg{spbmark} package
2457 % (\url{https://www.ctan.org/pkg/spbmark}), by Qu Yi, which allows a complete
2458 % customisation of subscripts, through the \cs{sub} command;
2459 % \item with the \pkg{altsubsup} package
2460 % (\url{https://www.ctan.org/pkg/altsubsup}), by Julien Labb\'e, which
2461 % provides an alternative subscript format, and changes, for this purpose, the
2462 % catcode of the underscore symbol ``|_|" from 8 (\emph{subscript} catcode
2463 % category) to 12 (\emph{other} catcode category).
2464 % \end{itemize}
2465 %
2466 % To handle theses cases, the command used for subscript detection can be
2467 % redefined with \refCom{SetOverArrowsSubscriptCommand}. Compatibility with the
2468 % \pkg{spbmark} package is then obtained by:
2469 % \iffalse
2470 %<*example>
2471 % \fi
2472 \begin{dispListing}
2473 \SetOverArrowsSubscriptCommand{\sub}
2474 \end{dispListing}
2475 % \iffalse
2476 %</example>
2477 % \fi
2478 % \noindent In the same way, with the \pkg{altsubsup} package, add:
2479 % \iffalse
2480 %<*example>
2481 % \fi
2482 \begin{dispListing}
2483 \SetOverArrowsSubscriptCommand{_}
2484 \end{dispListing}
2485 % \iffalse
2486 %</example>
2487 % \fi
2488 % \noindent after the \cs{begin}|{document}| (namely, after the catcode
2489 % redefinition done by \pkg{altsubsup}).
2490 %
2491 % \medskip
2492 %
2493 % Alternatively, two package options handle the cases where the catcode of the
2494 % underscore ``|_|" symbol is changed: \refOpt{subother} (for catcode 12, or
2495 % \emph{other}) and \refOpt{subactive} (for catcode 13, or \emph{active}).
2496 % Hence, setting the \refOpt{subother} option is sufficient for compatibility
2497 % with the \pkg{altsubsup} package (no need of
2498 % \refCom{SetOverArrowsSubscriptCommand}). Note, that with options
2499 % \refOpt{subother} and \refOpt{subactive}, the command \refCom{TestOverArrow*}
2500 % may give bad results for kerning test, as defined before the
2501 % catcode redefinition.
2502 %
2503 % \subsection{Package dependencies}
2504 %
2505 % The following packages are used by \pkg{overarrows}:
2506 % \begin{itemize}
2507 % \item \pkg{amsmath}
2508 % \item \pkg{etoolbox}
2509 % \item \pkg{pgfkeys}
2510 % \item \pkg{esvect} (unless the option \refOpt{noesvect} is used)
2511 % \item \pkg{old-arrows} (when the option \refOpt{old-arrows} is used)
2512 % \item \pkg{tikz} (when the |tikz| method or the option \refOpt{tikz} is used)
2513 % \item \pkg{pict2e} (when the option \refOpt{pstarrows} is used)
2514 % \end{itemize}
2515 %
2516 % \LaTeX{} distributions prior to 2020/10/01 must load the \pkg{xparse} package
2517 % before \pkg{overarrows}.
2518 %
2519 % \subsection{Alternatives}
2520 %
2521 % \begin{description}[style=unboxed]
2522 % \item[\textsf{esvect} package]
2523 % (\url{https://www.ctan.org/pkg/esvect}), by Eddie Saudrais, provides the
2524 % fine vector macro \cs{vv}. This package is loaded by default by
2525 % \pkg{overarrows}.
2526 %
2527 % \item[\pkg{letterswitharrows} package]
2528 % (\url{https://www.ctan.org/pkg/letterswitharrows}), by Max Teegen, provides
2529 % left and right over arrows commands, which can extend to
2530 % multiple characters.
2531 %
2532 % \item[\pkg{overrightarrow} package]
2533 % (\url{https://www.ctan.org/pkg/overrightarrow}), by Robin Fairbairns,
2534 % provides the \cs{Overrightarrow} command which is an amalgam of \cs{overrightarrow}
2535 % and \cs{Rightarrow}.
2536 %
2537 % \item[\pkg{harpoon} package] (\url{https://ctan.org/pkg/harpoon}), by Tobias
2538 % Kuipers, provides over- and under-harpoon symbol commands.
2539 % \end{description}
2540 %
2541 % \subsection{Changelog}
2542 %
2543 % \begingroup
2544 % \renewcommand{\arraystretch}{2}
2545 % \begin{tabular*}{\linewidth}
2546 % {@{} l @{\extracolsep{\fill}} p{0.9\linewidth} @{}}
2547 % v1.5 &\noindent\par\vspace{-\baselineskip}
2548 % \begin{itemize}[left=0pt, topsep=0pt, partopsep=0pt]
2549 % \item Provide the command \refCom{baselinebar}.
2550 % \item Redefine \refCom{overbar} and \refCom{underbar} so that they can be
2551 % nested properly.
2552 % \item Make always available the lengths \refLen{overarrowthickness} and
2553 % \refLen{overarrowsmallerthickness}.
2554 % \item Provide the command \refCom{arrowmathstyle}.
2555 % \end{itemize}
2556 % \\
2557 % v1.4 & Make commands robust.
2558 % \\
2559 % v1.3 & Bug fix for |esvect| options (see \url{https://github.com/julienlabbe/latex-packages/issues/2}).
2560 % \\
2561 % v1.2 & \noindent\par\vspace{-\baselineskip}
2562 % \begin{itemize}[left=0pt, topsep=0pt, partopsep=0pt]
2563 % \item Fix compatibility issues with \pkg{unicode-math}.
2564 % \item Allow to draw the arrow with PSTricks.
2565 % \item Make \pkg{esvect} handle all font sizes.
2566 % \item Allow backslash in command name for \cs{NewOverArrowCommand} and variants.
2567 % \item Rewrite starred variant for better performances.
2568 % \end{itemize}
2569 % \\
2570 % v1.1 & Support for non-standard subscripts.
2571 % \\
2572 % v1.0.1 & Bug fix for under* options.
2573 % \\
2574 % v1.0 & Initial version.
2575 % \end{tabular*}
2576 % \endgroup
2577 %
2578 % \StopEventually{}
2579 %
2580 % \section{Implementation}
2581 %
2582 %\iffalse
2583 %<*package>
2584 %\fi
2585 %
2586 % \setlength{\parindent}{0em}
2587 % \setlength{\parskip}{\smallskipamount}
2588 %
2589 % \begin{macrocode}
2590 \RequirePackage{etoolbox}
2591 % \end{macrocode}
2592 %
2593 % \subsection{Management of options}
2594 %
2595 % \subsubsection{Declaration of conditionals}
2596 %
2597 % \begin{macrocode}
2598 \newif\ifovar@option@oldarrows@
2599 \newif\ifovar@option@tikz@
2600 \newif\ifovar@option@pstricks@
2601 \newif\ifovar@option@pstarrows@
2602 \newif\ifovar@detectsubscripts@
2603 \newif\ifovar@option@subother@
2604 \newif\ifovar@option@subactive@
2605 \newif\ifovar@option@debug@
2606 % \end{macrocode}
2607 %
2608 % Following conditionals are for predefined commands.
2609 %
2610 % \begin{macrocode}
2611 \newif\ifovar@option@overrightarrow@
2612 \newif\ifovar@option@underrightarrow@
2613 \newif\ifovar@option@overleftarrow@
2614 \newif\ifovar@option@underleftarrow@
2615 \newif\ifovar@option@overleftrightarrow@
2616 \newif\ifovar@option@underleftrightarrow@
2617 \newif\ifovar@option@overrightharpoonup@
2618 \newif\ifovar@option@underrightharpoonup@
2619 \newif\ifovar@option@overrightharpoondown@
2620 \newif\ifovar@option@underrightharpoondown@
2621 \newif\ifovar@option@overleftharpoonup@
2622 \newif\ifovar@option@underleftharpoonup@
2623 \newif\ifovar@option@overleftharpoondown@
2624 \newif\ifovar@option@underleftharpoondown@
2625 \newif\ifovar@option@overbar@
2626 \newif\ifovar@option@underbar@
2627 % \end{macrocode}
2628 %
2629 % \subsubsection{Declaration of options}
2630 %
2631 % \changes{v1.2}{2024/07/11}{Add option pstricks}
2632 % \changes{v1.3}{2025/02/02}{Use a control sequence to store the esvect option}
2633 %
2634 % \begin{macrocode}
2635 \def\ovar@option@esvect{f}
2636 \DeclareOption{esvect}{\gdef\ovar@option@esvect{f}}
2637 \DeclareOption{noesvect}{\gundef\ovar@option@esvect}
2638 \DeclareOption{esvecta}{\gdef\ovar@option@esvect{a}}
2639 \DeclareOption{esvectb}{\gdef\ovar@option@esvect{b}}
2640 \DeclareOption{esvectc}{\gdef\ovar@option@esvect{c}}
2641 \DeclareOption{esvectd}{\gdef\ovar@option@esvect{d}}
2642 \DeclareOption{esvecte}{\gdef\ovar@option@esvect{e}}
2643 \DeclareOption{esvectf}{\gdef\ovar@option@esvect{f}}
2644 \DeclareOption{esvectg}{\gdef\ovar@option@esvect{g}}
2645 \DeclareOption{esvecth}{\gdef\ovar@option@esvect{h}}
2646 \DeclareOption{old-arrows}{\ovar@option@oldarrows@true}
2647 \DeclareOption{tikz}{\ovar@option@tikz@true}
2648 \DeclareOption{pstricks}{\ovar@option@pstricks@true}
2649 \DeclareOption{pstarrows}{\ovar@option@pstarrows@true}
2650 \DeclareOption{subscripts}{\ovar@detectsubscripts@true}
2651 \DeclareOption{subother}{\ovar@option@subother@true}
2652 \DeclareOption{subactive}{\ovar@option@subactive@true}
2653 \DeclareOption{debug}{\ovar@option@debug@true}
2654 % \end{macrocode}
2655 %
2656 % Following options are for predefined commands.
2657 %
2658 % \changes{v1.0.1}{2023/01/19}{Bug fix for under* options}
2659 %
2660 % \begin{macrocode}
2661 \DeclareOption{overrightarrow}{\ovar@option@overrightarrow@true}
2662 \DeclareOption{underrightarrow}{\ovar@option@underrightarrow@true}
2663 \DeclareOption{overleftarrow}{\ovar@option@overleftarrow@true}
2664 \DeclareOption{underleftarrow}{\ovar@option@underleftarrow@true}
2665 \DeclareOption{overleftrightarrow}{\ovar@option@overleftrightarrow@true}
2666 \DeclareOption{underleftrightarrow}{\ovar@option@underleftrightarrow@true}
2667 \DeclareOption{overrightharpoonup}{\ovar@option@overrightharpoonup@true}
2668 \DeclareOption{underrightharpoonup}{\ovar@option@underrightharpoonup@true}
2669 \DeclareOption{overrightharpoondown}{\ovar@option@overrightharpoondown@true}
2670 \DeclareOption{underrightharpoondown}{\ovar@option@underrightharpoondown@true}
2671 \DeclareOption{overleftharpoonup}{\ovar@option@overleftharpoonup@true}
2672 \DeclareOption{underleftharpoonup}{\ovar@option@underleftharpoonup@true}
2673 \DeclareOption{overleftharpoondown}{\ovar@option@overleftharpoondown@true}
2674 \DeclareOption{underleftharpoondown}{\ovar@option@underleftharpoondown@true}
2675 \DeclareOption{overbar}{\ovar@option@overbar@true}
2676 \DeclareOption{underbar}{\ovar@option@underbar@true}
2677 % \end{macrocode}
2678 %
2679 % Following options are for sets of predefined commands.
2680 %
2681 % \begin{macrocode}
2682 \DeclareOption{overcommands}{%
2683 \ovar@option@overrightarrow@true
2684 \ovar@option@overleftarrow@true
2685 \ovar@option@overleftrightarrow@true
2686 \ovar@option@overrightharpoonup@true
2687 \ovar@option@overrightharpoondown@true
2688 \ovar@option@overleftharpoonup@true
2689 \ovar@option@overleftharpoondown@true
2690 \ovar@option@overbar@true
2691 }
2692 \DeclareOption{undercommands}{%
2693 \ovar@option@underrightarrow@true
2694 \ovar@option@underleftarrow@true
2695 \ovar@option@underleftrightarrow@true
2696 \ovar@option@underrightharpoonup@true
2697 \ovar@option@underrightharpoondown@true
2698 \ovar@option@underleftharpoonup@true
2699 \ovar@option@underleftharpoondown@true
2700 \ovar@option@underbar@true
2701 }
2702 \DeclareOption{allcommands}{%
2703 \ovar@option@overrightarrow@true
2704 \ovar@option@underrightarrow@true
2705 \ovar@option@overleftarrow@true
2706 \ovar@option@underleftarrow@true
2707 \ovar@option@overleftrightarrow@true
2708 \ovar@option@underleftrightarrow@true
2709 \ovar@option@overrightharpoonup@true
2710 \ovar@option@underrightharpoonup@true
2711 \ovar@option@overrightharpoondown@true
2712 \ovar@option@underrightharpoondown@true
2713 \ovar@option@overleftharpoonup@true
2714 \ovar@option@underleftharpoonup@true
2715 \ovar@option@overleftharpoondown@true
2716 \ovar@option@underleftharpoondown@true
2717 \ovar@option@overbar@true
2718 \ovar@option@underbar@true
2719 }
2720 % \end{macrocode}
2721 %
2722 % \subsubsection{Options processing}
2723 %
2724 % \changes{v1.3}{2025/02/02}{Process options in the order specified by the user}
2725 %
2726 % \begin{macrocode}
2727 \DeclareOption*{\PackageWarning{overarrows}{Unknown option: '\CurrentOption'}}
2728 \ProcessOptions*
2729 % \end{macrocode}
2730 %
2731 % \subsection{Package dependencies}
2732 %
2733 % \LaTeX{} distributions prior to 2020/10/01 must add the \pkg{xparse} package.
2734 %
2735 % \pkg{etoolbox} is loaded at the very start of the package, as \cs{gundef} is
2736 % used at options processing.
2737 %
2738 % \begin{macrocode}
2739 \RequirePackage{amsmath}
2740 % \end{macrocode}
2741 %
2742 % Option \refOpt{old-arrows}. Configuration of arrows used for
2743 % predefined commands.
2744 % \changes{v1.2}{2024/07/11}{Use \cs{def} instead of \cs{let} for
2745 % \cs{ovar@rightarrow} and \cs{ovar@leftarrow}}
2746 % \begin{macrocode}
2747 \def\ovar@rightarrow{\rightarrow}
2748 \def\ovar@leftarrow{\leftarrow}
2749 \ifovar@option@oldarrows@
2750 \RequirePackage[old]{old-arrows}
2751 \def\ovar@rightarrow{\varrightarrow}
2752 \def\ovar@leftarrow{\varleftarrow}
2753 \fi
2754 % \end{macrocode}
2755 %
2756 % Option \refOpt{esvect}.
2757 % \changes{v1.3}{2025/02/02}{Use only one \cs{PassOptionsToPackage} with esvect}
2758 % \begin{macrocode}
2759 \ifdefined\ovar@option@esvect
2760 \PassOptionsToPackage{\ovar@option@esvect}{esvect}
2761 \RequirePackage{esvect}
2762 % \end{macrocode}
2763 % \changes{v1.2}{2024/07/11}{Fix esvect font sizes}
2764 % Fix font description in |uesvect.fd| to allow any sizes (taken from Enrico
2765 % Gregorio, \url{https://tex.stackexchange.com/a/689863/})
2766 % \begin{macrocode}
2767 \DeclareFontFamily{U}{esvect}{}
2768 \DeclareFontShape{U}{esvect}{m}{n}{
2769 <-5.5> vect5
2770 <5.5-6.5> vect6
2771 <6.5-7.5> vect7
2772 <7.5-8.5> vect8
2773 <8.5-9.5> vect9
2774 <9.5-> vect10
2775 }{}
2776 \fi
2777 % \end{macrocode}
2778 %
2779 % Option \refOpt{tikz}.
2780 % \begin{macrocode}
2781 \ifovar@option@tikz@
2782 \RequirePackage{tikz}
2783 \usetikzlibrary{arrows.meta}
2784 \fi
2785 % \end{macrocode}
2786 %
2787 % Option \refOpt{pstricks}.
2788 % \begin{macrocode}
2789 \ifovar@option@pstricks@
2790 \RequirePackage{pstricks-add}
2791 \fi
2792 % \end{macrocode}
2793 %
2794 % Option \refOpt{pstarrows}.
2795 % \begin{macrocode}
2796 \ifovar@option@pstarrows@
2797 \RequirePackage[pstarrows]{pict2e}
2798 \fi
2799 % \end{macrocode}
2800 %
2801 % Add hook rules to apply settings after \pkg{unicode-math}.
2802 % \begin{macrocode}
2803 \DeclareHookRule{begindocument}{overarrows}{after}{unicode-math-luatex}
2804 \DeclareHookRule{begindocument}{overarrows}{after}{unicode-math-xetex}
2805 % \end{macrocode}
2806 %
2807 % \changes{v1.2}{2024/07/11}{Use \cs{harrowextender}, if availlable.}
2808 % Set \cs{ovar@auto@middle} and \cs{ovar@auto@trim@middle}, used by
2809 % configurations made with \refKey*{middle config}|=auto|.
2810 % \begin{macrocode}
2811 \AddToHook{begindocument}[overarrows]
2812 {%
2813 \ifdef{\relbareda}
2814 {%
2815 \gdef\ovar@auto@middle{\relbareda}%
2816 \gdef\ovar@auto@trim@middle{1}%
2817 }%
2818 {%
2819 \gdef\ovar@auto@middle{\relbar}%
2820 \gdef\ovar@auto@trim@middle{2.5}%
2821 }%
2822 \@ifpackageloaded{unicode-math}
2823 {%
2824 % \end{macrocode}
2825 % Test of \cs{harrowextender} availability taken from Enrico Gregorio,
2826 % (\url{https://tex.stackexchange.com/a/218407/}).
2827 % \begin{macrocode}
2828 \check@mathfonts
2829 \iffontchar\textfont\tw@\string"23AF
2830 \gdef\ovar@auto@middle{\mathrel\harrowextender}%
2831 \gdef\ovar@auto@trim@middle{0}%
2832 \fi
2833 }%
2834 {}%
2835 }
2836 % \end{macrocode}
2837 %
2838 % \subsection{Configuration of subscripts detection}
2839 %
2840 % \changes{v1.1}{2023/02/15}{Support for non-standard subscripts}
2841 %
2842 % \begin{macro}{\SetOverArrowsSubscriptCommand}
2843 % Sets the subscript command.
2844 % \begin{macrocode}
2845 \newcommand{\SetOverArrowsSubscriptCommand}[1]{\global\let\ovar@subcmd=#1}
2846 % \end{macrocode}
2847 % \end{macro}
2848 %
2849 % Initial configuration.
2850 % \changes{v1.2}{2024/07/11}{Remove useless \cs{AtBeginDocument}}
2851 % \begin{macrocode}
2852 \SetOverArrowsSubscriptCommand{_}
2853 % \end{macrocode}
2854 % Option \refOpt{subother} for \emph{other} (catcode 12) subscript commands.
2855 % \begin{macrocode}
2856 \ifovar@option@subother@
2857 \begingroup
2858 \catcode `_=12
2859 \SetOverArrowsSubscriptCommand{_}%
2860 \endgroup
2861 \fi
2862 % \end{macrocode}
2863 % Option \refOpt{subactive} for \emph{active} (catcode 13) subscript commands.
2864 % \begin{macrocode}
2865 \ifovar@option@subactive@
2866 \begingroup
2867 \catcode `_=13
2868 \SetOverArrowsSubscriptCommand{_}%
2869 \endgroup
2870 \fi
2871 % \end{macrocode}
2872 % \subsection{Management of keys}
2873 %
2874 % \subsubsection{Family declaration and setters}
2875 %
2876 % \begin{macrocode}
2877 \RequirePackage{pgfkeys}
2878 \pgfkeys{overarrows/.is family}
2879 % \end{macrocode}
2880 %
2881 % \begin{macro}{\ovar@set}
2882 % \begin{macrocode}
2883 \newcommand{\ovar@set}[1]{\pgfqkeys{/overarrows}{#1}}
2884 % \end{macrocode}
2885 % \end{macro}
2886 %
2887 % \begin{macro}{\SetOverArrowsMethod}
2888 % \begin{macrocode}
2889 \NewDocumentCommand{\SetOverArrowsMethod}{ s O{fill} m O{} m }{%
2890 \IfBooleanTF{#1}{%
2891 \csgdef{ovar@set@#3}{#4\ovar@set{#5}}%
2892 }{%
2893 \csgdef{ovar@set@#3}{#4\ovar@set{%
2894 no stack macro hook/.code={%
2895 \ovar@set{stack macro/.expanded={%
2896 \expandafter\expandonce\csname ovar@stack@#2\endcsname%
2897 {\expandonce\ovar@length@min}%
2898 {\expandonce\ovar@before@arrow}{\expandonce\ovar@after@arrow}%
2899 }}%
2900 },#5}}%
2901 }%
2902 }
2903 % \end{macrocode}
2904 % \end{macro}
2905 %
2906 % \subsubsection{Common keys}
2907 %
2908 % \begin{macrocode}
2909 \SetOverArrowsMethod*{common}[\undef{\ovar@macro@stack}\undef{\ovar@macro@arrow}]{%
2910 % \end{macrocode}
2911 %
2912 % \refKey{detect subscripts}.
2913 %
2914 % \begin{macrocode}
2915 detect subscripts/.is if=ovar@detectsubscripts@,
2916 % \end{macrocode}
2917 %
2918 % \refKey{stack macro} and \refKey{arrow macro}.
2919 %
2920 % \begin{macrocode}
2921 stack macro/.store in=\ovar@macro@stack,
2922 arrow macro/.store in=\ovar@macro@arrow,
2923 stack macro/.value required,
2924 arrow macro/.value required,
2925 % \end{macrocode}
2926 %
2927 % \refKey{no stack macro hook}, \refKey{no arrow macro hook}. These two keys
2928 % must be redefined by the command \cs{ovar@set@}\meta{method}.
2929 %
2930 % \begin{macrocode}
2931 no stack macro hook/.code={%
2932 \PackageError{overarrows}{Undefined stack macro}
2933 {The requested method is perhaps mispelled}%
2934 },
2935 no arrow macro hook/.code={%
2936 \PackageError{overarrows}{Undefined arrow macro}
2937 {The requested method is perhaps mispelled}%
2938 },
2939 % \end{macrocode}
2940 %
2941 % \refKey{min length}.
2942 %
2943 % \begin{macrocode}
2944 min length/.store in=\ovar@length@min,
2945 min length/.value required,
2946 min length=0,
2947 % \end{macrocode}
2948 %
2949 % \refKey{before arrow}, \refKey{after arrow}, \refKey{space before arrow},
2950 % \refKey{space after arrow}.
2951 %
2952 % \begin{macrocode}
2953 before arrow/.store in=\ovar@before@arrow,
2954 after arrow/.store in=\ovar@after@arrow,
2955 before arrow/.value required,
2956 after arrow/.value required,
2957 before arrow=\empty,
2958 after arrow=\empty,
2959 space before arrow/.code=\pgfkeysalso{before arrow={\kern ##1}},
2960 space after arrow/.code=\pgfkeysalso{after arrow={\kern ##1}},
2961 % \end{macrocode}
2962 %
2963 % \refKey{shift left}, \refKey{shift right}, \refKey{shift leftright},
2964 % \refKey{center arrow}, \refKey{left arrow}, \refKey{right arrow}.
2965 %
2966 % \begin{macrocode}
2967 shift left/.store in=\ovar@shift@left,
2968 shift right/.store in=\ovar@shift@right,
2969 shift left/.value required,
2970 shift right/.value required,
2971 shift leftright/.code=\pgfkeysalso{%
2972 shift left=##1, shift right=##1,
2973 },
2974 center arrow/.code=\pgfkeysalso{shift leftright=0},
2975 shift leftright/.value required,
2976 center arrow/.value forbidden,
2977 left arrow/.code=\pgfkeysalso{%
2978 shift left=0, shift right=##1,
2979 },
2980 right arrow/.code=\pgfkeysalso{%
2981 shift left=##1, shift right=0,
2982 },
2983 left arrow/.default=2,
2984 right arrow/.default=2,
2985 right arrow,
2986 % \end{macrocode}
2987 %
2988 % \refKey{arrow under}.
2989 %
2990 % \begin{macrocode}
2991 arrow under/.is choice,
2992 arrow under/noconfig/.code={%
2993 \def\ovar@stack@fill{\ovar@stackunder@fill}%
2994 \def\ovar@stack@lens{\ovar@stackunder@lens}%
2995 },
2996 arrow under/autoconfig/.code={%
2997 \pgfkeysalso{%
2998 arrow under=noconfig,
2999 detect subscripts=false,
3000 before arrow={\kern 1.3\ex@\relax},% like underarrow@ from amsmath
3001 }%
3002 },
3003 arrow under/.default=autoconfig,
3004 }
3005 % \end{macrocode}
3006 %
3007 % \subsubsection{Keys for the \texttt{symb} method}
3008 %
3009 % \begin{macrocode}
3010 \SetOverArrowsMethod{symb}[\undef{\ovar@macro@arrowfill}]{%
3011 % \end{macrocode}
3012 % Fill macro.
3013 % \begin{macrocode}
3014 fill macro/.store in=\ovar@macro@arrowfill,
3015 fill macro/.value required,
3016 % \end{macrocode}
3017 % Arrow macro.
3018 % \begin{macrocode}
3019 no arrow macro hook/.code={%
3020 \ifdef{\ovar@macro@arrowfill}{}{%
3021 \ovar@set{%
3022 fill macro/.expanded={%
3023 \noexpand\ovar@arrow@fill%
3024 {\expandonce\ovar@shift@left}{\expandonce\ovar@shift@right}%
3025 }%
3026 }%
3027 }%
3028 \ovar@set{%
3029 arrow macro/.expanded={%
3030 \expandonce{\ovar@macro@arrowfill}%
3031 {\expandonce{\ovar@arrow@start}\expandonce{\ovar@trim@start}}%
3032 {\expandonce{\ovar@trim@middle}\expandonce{\ovar@arrow@middle}%
3033 \expandonce{\ovar@trim@middle}}%
3034 {\expandonce{\ovar@trim@end}\expandonce{\ovar@arrow@end}}%
3035 }%
3036 }%
3037 },
3038 % \end{macrocode}
3039 % \refKey{start}, \refKey{middle}, \refKey{end}.
3040 % \begin{macrocode}
3041 start/.store in=\ovar@arrow@start,
3042 middle/.store in=\ovar@arrow@middle,
3043 end/.store in=\ovar@arrow@end,
3044 start/.value required,
3045 middle/.value required,
3046 end/.value required,
3047 % \end{macrocode}
3048 % \refKey{trim start}, \refKey{trim middle}, \refKey{trim end}, \refKey{trim},
3049 % \refKey{no trimming}.
3050 % \begin{macrocode}
3051 trim start/.code={\def\ovar@trim@start{\xjoinrel[##1]}},
3052 trim middle/.code={\def\ovar@trim@middle{\xjoinrel[##1]}},
3053 trim end/.code={\def\ovar@trim@end{\xjoinrel[##1]}},
3054 trim start/.value required,
3055 trim middle/.value required,
3056 trim end/.value required,
3057 trim/.code={\pgfkeysalso{trim start={##1}, trim middle={##1}, trim end={##1}}},
3058 trim/.value required,
3059 no trimming/.code={%
3060 \let\ovar@trim@start\empty
3061 \let\ovar@trim@middle\empty
3062 \let\ovar@trim@end\empty
3063 },
3064 no trimming/.value forbidden,
3065 % \end{macrocode}
3066 % \refKey{middle config}.
3067 % \begin{macrocode}
3068 middle config/.is choice,
3069 middle config/.value required,
3070 middle config/relbar/.code=\pgfkeysalso{%
3071 middle={\relbar},
3072 trim middle={2.5},
3073 },
3074 middle config/relbareda/.code={%
3075 \ifundef{\relbareda}{%
3076 \PackageWarning{overarrows}{Key 'middle config=relbareda' used,
3077 \MessageBreak%
3078 but \protect\relbareda\space is undefined; ignored.
3079 \MessageBreak%
3080 Load 'esvect' package, or use 'esvect' option \MessageBreak%
3081 to remove this warning}
3082 }{%
3083 \pgfkeysalso{%
3084 middle={\relbareda},
3085 trim middle={1},
3086 }%
3087 }%
3088 },
3089 % \end{macrocode}
3090 % \changes{v1.2}{2024/07/11}{Add config \refKey*{middle config}|=harrowextender|}
3091 % \begin{macrocode}
3092 middle config/harrowextender/.code={%
3093 \pgfkeysalso{%
3094 middle={\harrowextender},
3095 trim middle={0},
3096 }%
3097 },
3098 % \end{macrocode}
3099 % Set \refKey*{middle config} with (hopefully) a good configuration. It would be
3100 % better to reuse the previous \refKey*{middle config} settings, but we have to
3101 % wait for the |begindocument| hook to know which one to use.
3102 % \begin{macrocode}
3103 middle config/auto/.code={%
3104 \pgfkeysalso{%
3105 middle={\ovar@auto@middle},
3106 trim middle={\ovar@auto@trim@middle},
3107 }%
3108 },
3109 % \end{macrocode}
3110 % \refKey{amsmath}.
3111 % \begin{macrocode}
3112 amsmath/.is choice,%
3113 amsmath/mimic/.code=\pgfkeysalso{%
3114 start={\relbar}, middle={\relbar}, end={\rightarrow},
3115 trim start=7,
3116 trim middle=2,
3117 trim end=7,
3118 shift leftright=0,
3119 after arrow={}, before arrow={},
3120 },
3121 amsmath/strict/.code=\pgfkeysalso{%
3122 amsmath=mimic,
3123 no trimming,
3124 fill macro={\arrowfill@}, stack macro={\overarrow@},
3125 },
3126 amsmath/.default=mimic,
3127 % \end{macrocode}
3128 % \refKey{esvect}.
3129 % \begin{macrocode}
3130 esvect/.is choice,%
3131 esvect/mimic/.code=\pgfkeysalso{%
3132 start={\relbaredd}, middle={\relbareda}, end={\fldr},
3133 trim start=1.5,
3134 trim end=1.5,
3135 trim middle=0,
3136 right arrow=2,
3137 space before arrow=-.7pt,
3138 space after arrow=-.3pt,
3139 },
3140 esvect/strict/.code=\pgfkeysalso{%
3141 esvect=mimic,
3142 no trimming,
3143 fill macro={\traitfill@}, stack macro={\overvect@},
3144 },
3145 esvect/.default=mimic,
3146 % \end{macrocode}
3147 % Initial configuration.
3148 % \begin{macrocode}
3149 amsmath, middle config=auto, end=\ovar@rightarrow, right arrow,
3150 }
3151 % \end{macrocode}
3152 %
3153 % \subsubsection{Keys for the \texttt{tikz} method}
3154 %
3155 % \begin{macrocode}
3156 \SetOverArrowsMethod[lens]{tikz}[\undef{\ovar@tikz@command}]{%
3157 % \end{macrocode}
3158 % Arrow macro.
3159 % \begin{macrocode}
3160 no arrow macro hook/.code={%
3161 \ifdef{\ovar@tikz@command}{}{%
3162 \pgfkeysgetvalue{/overarrows/path options}{\ovar@tikz@pathoptions}%
3163 \ovar@set{%
3164 tikz command/.expanded={%
3165 \noexpand\draw[\expandonce\ovar@tikz@pathoptions]\expandonce\ovar@tikz@path;
3166 }%
3167 }%
3168 }%
3169 \pgfkeysgetvalue{/overarrows/tikz options}{\ovar@tikz@options}%
3170 \ovar@set{%
3171 arrow macro/.expanded={%
3172 $\noexpand\mkern \expandonce{\ovar@shift@left} mu\noexpand\relax$%
3173 \noexpand\tikz[\expandonce{\ovar@tikz@options}]{\expandonce{\ovar@tikz@command}}%
3174 $\noexpand\mkern \expandonce{\ovar@shift@right} mu\noexpand\relax$%
3175 }%
3176 }%
3177 },
3178 % \end{macrocode}
3179 % TikZ parts: \refKey{tikz command}, \refKey{tikz options}, \refKey{path
3180 % options}, \refKey{path}.
3181 % \begin{macrocode}
3182 tikz command/.store in=\ovar@tikz@command,
3183 tikz options/.initial={x=\overarrowlength, line width=\overarrowthickness},
3184 path options/.initial={arrows={-Classical TikZ Rightarrow}, cap=round},
3185 path/.store in=\ovar@tikz@path,
3186 path={(0,0)--(1,0)},
3187 tikz command/.value required,
3188 tikz options/.value required,
3189 path options/.value required,
3190 path/.value required,
3191 % \end{macrocode}
3192 % TikZ handy keys: \refKey{add path options}, \refKey{add tikz options},
3193 % \refKey{arrows}, \refKey{line thickness}, \refKey{thinner}.
3194 % \begin{macrocode}
3195 add path options/.code=\pgfkeysalso{%
3196 path options/.append={, ##1}},%
3197 add tikz options/.code=\pgfkeysalso{%
3198 tikz options/.append={, ##1}},%
3199 arrows/.code=\pgfkeysalso{add path options={arrows={##1}}},%
3200 line thickness/.code=\pgfkeysalso{add path options={line width=##1}},%
3201 thinner/.code=\pgfkeysalso{line thickness={\overarrowsmallerthickness}},%
3202 add path options/.value required,%
3203 add tikz options/.value required,%
3204 arrows/.value required,%
3205 line thickness/.value required,%
3206 thinner/.value forbidden,%
3207 % \end{macrocode}
3208 % Initial configuration.
3209 % \begin{macrocode}
3210 shift right=-2,
3211 min length=12,
3212 }
3213 % \end{macrocode}
3214 %
3215 % \subsubsection{Keys for the \texttt{pstricks} method}
3216 %
3217 % \changes{v1.2}{2024/07/11}{Add the method pstricks}
3218 %
3219 % \begin{macrocode}
3220 \SetOverArrowsMethod[lens]{pstricks}{%
3221 % \end{macrocode}
3222 % Arrow macro.
3223 % \begin{macrocode}
3224 no arrow macro hook/.code={%
3225 \ovar@set{%
3226 arrow macro/.expanded={%
3227 $\noexpand\mkern \expandonce{\ovar@shift@left} mu\noexpand\relax$%
3228 \noexpand\begin{pspicture}\expandonce{\ovar@pstricks@geometry}%
3229 \noexpand\psset{linewidth=\expandonce{\ovar@pstricks@linethickness}}%
3230 \noexpand\psset{\expandonce{\ovar@pstricks@psset}}%
3231 \expandonce{\ovar@pstricks@command}%
3232 \noexpand\end{pspicture}%
3233 $\noexpand\mkern \expandonce{\ovar@shift@right} mu\noexpand\relax$%
3234 }%
3235 }%
3236 },
3237 % \end{macrocode}
3238 % Pstricks parts: \refKey{pstricks command}, \refKey{psset},
3239 % \refDoc{key:pstricks}{geometry}, \refDoc{key:pstricks}{line thickness}.
3240 % \begin{macrocode}
3241 pstricks command/.store in=\ovar@pstricks@command,
3242 psset/.store in=\ovar@pstricks@psset,
3243 geometry/.store in=\ovar@pstricks@geometry,
3244 line thickness/.store in=\ovar@pstricks@linethickness,
3245 pstricks command/.value required,
3246 psset/.value required,
3247 geometry/.value required,
3248 line thickness/.value required,
3249 % \end{macrocode}
3250 % Pstricks handy key: \refDoc{key:pstricks}{arrow}, \refDoc{key:pstricks}{thinner}.
3251 % \begin{macrocode}
3252 arrow/.style={pstricks command={\psline{##1}(0,0)(\overarrowlength,0)}},%
3253 arrow/.value required,%
3254 thinner/.style={line thickness={\overarrowsmallerthickness}},%
3255 thinner/.value forbidden,%
3256 % \end{macrocode}
3257 % Initial configuration.
3258 % \begin{macrocode}
3259 shift right=-2,
3260 min length=12,
3261 geometry={(0,-0.5ex)(\overarrowlength,0.5ex)},%
3262 line thickness={\overarrowthickness},%
3263 arrow={->},%
3264 psset={},%
3265 }
3266 % \end{macrocode}
3267 %
3268 % \subsubsection{Keys for the \texttt{picture} method}
3269 %
3270 % \begin{macrocode}
3271 \SetOverArrowsMethod[lens]{picture}{%
3272 % \end{macrocode}
3273 % Arrow macro.
3274 % \begin{macrocode}
3275 no arrow macro hook/.code={%
3276 \ovar@set{%
3277 arrow macro/.expanded={%
3278 $\noexpand\mkern \expandonce{\ovar@shift@left} mu\noexpand\relax$%
3279 \noexpand\begin{picture}\expandonce{\ovar@picture@geometry}%
3280 \noexpand\linethickness{\expandonce{\ovar@picture@linethickness}}%
3281 \expandonce{\ovar@picture@command}%
3282 \noexpand\end{picture}%
3283 $\noexpand\mkern \expandonce{\ovar@shift@right} mu\noexpand\relax$%
3284 }%
3285 }%
3286 },
3287 % \end{macrocode}
3288 % Picture parts: \refKey{picture command}, \refDoc{key:picture}{geometry},
3289 % \refDoc{key:picture}{line thickness}.
3290 % \begin{macrocode}
3291 picture command/.store in=\ovar@picture@command,
3292 geometry/.store in=\ovar@picture@geometry,
3293 line thickness/.store in=\ovar@picture@linethickness,
3294 picture command/.value required,
3295 geometry/.value required,
3296 line thickness/.value required,
3297 % \end{macrocode}
3298 % Picture handy key: \refDoc{key:picture}{thinner}.
3299 % \begin{macrocode}
3300 thinner/.code=\pgfkeysalso{line thickness={\overarrowsmallerthickness}},
3301 % \end{macrocode}
3302 % Initial configuration.
3303 % \begin{macrocode}
3304 shift right=-2,
3305 min length=18,
3306 geometry={(\overarrowlength,1ex)(0,-0.5ex)},%
3307 line thickness={\overarrowthickness},%
3308 picture command={\put(0,0){\vector(1,0){\overarrowlength}}},%
3309 }
3310 % \end{macrocode}
3311 %
3312 % \subsection{Commands}
3313 %
3314 % \subsubsection{Macros for symbols assemblage}
3315 %
3316 % \begin{macro}{\xjoinrel}
3317 % \begin{macrocode}
3318 \ifdef{\xjoinrel}{%
3319 \PackageWarning{overarrows}{Command \protect\xjoinrel\space already defined.
3320 \MessageBreak%
3321 Previous definition will be overridden}%
3322 }{}
3323 % \end{macrocode}
3324 % Use a default value of |3.5 mu|, as recommended by Enrico Gregorio (see
3325 % \url{https://tex.stackexchange.com/a/471736}). \cs{joinrel}
3326 % uses a value of 3 mu.
3327 % \begin{macrocode}
3328 \DeclareRobustCommand{\xjoinrel}[1][3.5]{\mathrel{\mkern-#1mu}}
3329 % \end{macrocode}
3330 % \end{macro}
3331 %
3332 % \begin{macro}{\smallermathstyle}
3333 % \begin{macrocode}
3334 \newcommand*{\smallermathstyle}{%
3335 \mathchoice{\scriptstyle}{\scriptstyle}{\scriptscriptstyle}{}%
3336 }
3337 % \end{macrocode}
3338 % \end{macro}
3339 %
3340 % \changes{v1.5}{2025/10/19}{Save math style}
3341 % \begin{macro}{\arrowmathstyle}
3342 % \begin{macro}{\ovar@save@mathstyle}
3343 % Math styles for arrows commands.
3344 % |#1|: math style
3345 % \begin{macrocode}
3346 \def\ovar@save@mathstyle#1{%
3347 \let\arrowmathstyle#1%
3348 }%
3349 % \end{macrocode}
3350 % \end{macro}
3351 % \end{macro}
3352 %
3353 % \begin{macro}{\ovar@bar}
3354 % Draw a zero height horizontal bar aligned on the baseline.\\
3355 % |#1|: math style
3356 % \begin{macrocode}
3357 \def\ovar@bar#1{%
3358 \raisebox
3359 {\dimeval{-0.5\height+0.5\depth}} [0pt] [0pt]
3360 {$\m@th #1\vphantom{+}\std@minus$}%
3361 }
3362 % \end{macrocode}
3363 % \end{macro}
3364 %
3365 % \begin{macro}{\baselinebar}
3366 % Draw a zero height horizontal bar aligned on the baseline with the current
3367 % math style (use \cs{arrowmathstyle}, if defined).
3368 % \begin{macrocode}
3369 \NewDocumentCommand{\baselinebar} { } {%
3370 \mathrel {%
3371 \ifdef \arrowmathstyle
3372 {\ovar@bar\arrowmathstyle}
3373 {\mathpalette\ovar@bar{}}%
3374 }%
3375 }
3376 % \end{macrocode}
3377 % \end{macro}
3378 %
3379 % \begin{macro}{\ovar@arrow@fill}
3380 % Macro used for default \refKey{fill macro}.\\
3381 % |#1|: left shift\\
3382 % |#2|: right shift\\
3383 % |#3|: arrow start\\
3384 % |#4|: arrow middle\\
3385 % |#5|: arrow end\\
3386 % |#6|: math style
3387 % \begin{macrocode}
3388 \def\ovar@arrow@fill#1#2#3#4#5#6{%
3389 $\m@th\thickmuskip0mu\medmuskip\thickmuskip\thinmuskip\thickmuskip\relax%
3390 \mkern #1 mu\relax#6#3%
3391 \cleaders\hbox{$#6#4$}\hfill%
3392 #5\mkern #2 mu\relax$%
3393 }
3394 % \end{macrocode}
3395 % \end{macro}
3396 %
3397 % \subsubsection{Macros for fixed length arrows}
3398 %
3399 % Lengths declaration.
3400 % \begin{macrocode}
3401 \newlength{\overarrowlength}
3402 \newlength{\overarrowthickness}
3403 \newlength{\overarrowsmallerthickness}
3404 \newlength{\ovar@tempdim}
3405 % \end{macrocode}
3406 %
3407 % \begin{macro}{\ovar@set@arrowlength}
3408 % Sets \refLen{overarrowlength}.\\
3409 % |#1|: min length, in math units\\
3410 % |#2|: math style\\
3411 % |#3|: content
3412 % \begin{macrocode}
3413 \def\ovar@set@arrowlength#1#2#3{%
3414 \settowidth{\ovar@tempdim}{$\m@th#2\mskip #1 mu\relax$}%
3415 \settowidth{\overarrowlength}{$\m@th#2#3$}%
3416 \ifdim \overarrowlength < \ovar@tempdim \overarrowlength=\ovar@tempdim\fi%
3417 }
3418 % \end{macrocode}
3419 % \end{macro}
3420 %
3421 % \begin{macro}{\ovar@set@arrowthickness}
3422 % \begin{macro}{\ovar@set@arrowthickness@UM@lua}
3423 % Sets \refLen{overarrowthickness} and \refLen{overarrowsmallerthickness}.\\
3424 % |#1|: math style
3425 %
3426 % Set to the default rule thickness of the current math style, normaly given by
3427 % \cs{fontdimen} 8 family 3. With \pkg{unicode-math}, use instead:
3428 % \begin{itemize}
3429 % \item \cs{fontdimen} 54 family 2 with XeTeX,
3430 % \item \cs{Umathoverbarrule} with LuaTex.
3431 % \end{itemize}
3432 % \changes{v1.2}{2024/07/11}{Get the correct rule thickness with unicode-math}
3433 % \begin{macrocode}
3434 \def\ovar@rulethickness@fontdimen{8}
3435 \def\ovar@rulethickness@family{3}
3436 \def\ovar@set@arrowthickness#1{%
3437 \ifx#1\displaystyle%
3438 \overarrowthickness =
3439 \fontdimen \ovar@rulethickness@fontdimen \textfont \ovar@rulethickness@family%
3440 \overarrowsmallerthickness =
3441 \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family%
3442 \else\ifx#1\textstyle%
3443 \overarrowthickness =
3444 \fontdimen \ovar@rulethickness@fontdimen \textfont \ovar@rulethickness@family%
3445 \overarrowsmallerthickness =
3446 \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family%
3447 \else\ifx#1\scriptstyle%
3448 \overarrowthickness =
3449 \fontdimen \ovar@rulethickness@fontdimen \scriptfont \ovar@rulethickness@family%
3450 \overarrowsmallerthickness =
3451 \fontdimen \ovar@rulethickness@fontdimen \scriptscriptfont \ovar@rulethickness@family%
3452 \else%
3453 \overarrowthickness =
3454 \fontdimen \ovar@rulethickness@fontdimen \scriptscriptfont \ovar@rulethickness@family%
3455 \overarrowsmallerthickness = \overarrowthickness%
3456 \fi\fi\fi%
3457 }
3458 % \end{macrocode}
3459 % \pkg{unicode-math} with LuaTeX version.
3460 % \begin{macrocode}
3461 \def\ovar@set@arrowthickness@UM@lua#1{%
3462 \overarrowthickness = \Umathoverbarrule #1
3463 \ifx#1\displaystyle%
3464 \overarrowsmallerthickness = \Umathoverbarrule \textstyle%
3465 \else\ifx#1\textstyle%
3466 \overarrowsmallerthickness = \Umathoverbarrule \scriptstyle%
3467 \else%
3468 \overarrowsmallerthickness = \Umathoverbarrule \scriptscriptstyle%
3469 \fi\fi%
3470 }
3471 % \end{macrocode}
3472 % Test which version to use.
3473 % \begin{macrocode}
3474 \AddToHook{begindocument}[overarrows]
3475 {%
3476 \@ifpackageloaded{unicode-math-luatex}
3477 {%
3478 \global\let\ovar@set@arrowthickness\ovar@set@arrowthickness@UM@lua%
3479 }%
3480 {%
3481 \@ifpackageloaded{unicode-math-xetex}
3482 {%
3483 \gdef\ovar@rulethickness@fontdimen{54}%
3484 \gdef\ovar@rulethickness@family{2}%
3485 }
3486 {}%
3487 }%
3488 }
3489 % \end{macrocode}
3490 % \end{macro}
3491 % \end{macro}
3492 %
3493 % \subsubsection{Stack macros}
3494 %
3495 % \begin{macro}{\ovar@stackover@@}
3496 % \begin{macro}{\ovar@stackunder@@}
3497 % Bases of all stack macros.\\
3498 % |#1|: min length, in math units\\
3499 % |#2|: vertical mode material before arrow\\
3500 % |#3|: vertical mode material after arrow\\
3501 % |#4|: arrow\\
3502 % |#5|: math style\\
3503 % |#6|: content
3504 % \changes{v1.5}{2025/10/19}{Save math style}
3505 % \changes{v1.5}{2025/10/19}{Make \refLen{overarrowthickness} and
3506 % \refLen{overarrowsmallerthickness} always available}
3507 % \begin{macrocode}
3508 \def\ovar@stackover@@#1#2#3#4#5#6{%
3509 \ovar@save@mathstyle{#5}%
3510 \ovar@set@arrowthickness{#5}%
3511 \vbox{%
3512 \ialign{##\crcr%
3513 $#5\mskip #1 mu\relax$\crcr%
3514 \noalign{#2\nointerlineskip}#4\crcr%
3515 \noalign{#3\nointerlineskip}%
3516 $\m@th\hfil#5#6\hfil$\crcr%
3517 }%
3518 }%
3519 }
3520 \def\ovar@stackunder@@#1#2#3#4#5#6{%
3521 \ovar@save@mathstyle{#5}%
3522 \ovar@set@arrowthickness{#5}%
3523 \vtop{%
3524 \ialign{##\crcr%
3525 $\m@th\hfil#5#6\hfil$\crcr%
3526 \noalign{#2\nointerlineskip}#4\crcr%
3527 \noalign{#3\nointerlineskip}%
3528 $#5\mskip #1 mu\relax$\crcr%
3529 }%
3530 }%
3531 }
3532 % \end{macrocode}
3533 % \end{macro}
3534 % \end{macro}
3535 %
3536 % \begin{macro}{\ovar@stackover@}
3537 % \begin{macro}{\ovar@stackunder@}
3538 % Stack macros without min arrow length.\\
3539 % |#1|: vertical mode material before arrow\\
3540 % |#2|: vertical mode material after arrow\\
3541 % |#3|: arrow macro\\
3542 % |#4|: math style\\
3543 % |#5|: content
3544 % \begin{macrocode}
3545 \def\ovar@stackover@#1#2#3#4#5{\ovar@stackover@@{0}{#1}{#2}{#3}{#4}{#5}}
3546 \def\ovar@stackunder@#1#2#3#4#5{\ovar@stackunder@@{0}{#1}{#2}{#3}{#4}{#5}}
3547 % \end{macrocode}
3548 % \end{macro}
3549 % \end{macro}
3550 %
3551 % \begin{macro}{\ovar@stackover@fill}
3552 % \begin{macro}{\ovar@stackunder@fill}
3553 % \begin{macro}{\ovar@stack@fill}
3554 % Stack macros for extensible arrows.\\
3555 % |#1|: min length, in math units\\
3556 % |#2|: vertical mode material before arrow\\
3557 % |#3|: vertical mode material after arrow\\
3558 % |#4|: arrow filler macro\\
3559 % |#5|: math style\\
3560 % |#6|: content
3561 % \begin{macrocode}
3562 \def\ovar@stackover@fill#1#2#3#4#5#6{\ovar@stackover@@{#1}{#2}{#3}{#4#5}{#5}{#6}}
3563 \def\ovar@stackunder@fill#1#2#3#4#5#6{\ovar@stackunder@@{#1}{#2}{#3}{#4#5}{#5}{#6}}
3564 % \end{macrocode}
3565 % \cs{ovar@stack@fill} matches the macro \cs{ovar@stackover@fill} by default, or
3566 % \cs{ovar@stackunder@fill} with \refKey{arrow under}.
3567 % \begin{macrocode}
3568 \def\ovar@stack@fill{\ovar@stackover@fill}
3569 % \end{macrocode}
3570 % \end{macro}
3571 % \end{macro}
3572 % \end{macro}
3573 %
3574 % \begin{macro}{\ovar@stackover@lens}
3575 % \begin{macro}{\ovar@stackunder@lens}
3576 % \begin{macro}{\ovar@stack@lens}
3577 % Stack macros for fixed-length arrows (these call \cs{ovar@set@arrowlength} and
3578 % \cs{ovar@set@arrowthickness}).\\
3579 % |#1|: min length, in math units\\
3580 % |#2|: vertical mode material before arrow\\
3581 % |#3|: vertical mode material after arrow\\
3582 % |#4|: arrow content macro\\
3583 % |#5|: math style\\
3584 % |#6|: content
3585 % \begin{macrocode}
3586 \def\ovar@stackover@lens#1#2#3#4#5#6{%
3587 \ovar@set@arrowlength{#1}{#5}{#6}%
3588 \ovar@stackover@{#2}{#3}{#4}{#5}{#6}%
3589 }
3590 \def\ovar@stackunder@lens#1#2#3#4#5#6{%
3591 \ovar@set@arrowlength{#1}{#5}{#6}%
3592 \ovar@stackunder@{#2}{#3}{#4}{#5}{#6}%
3593 }
3594 % \end{macrocode}
3595 % \cs{ovar@stack@lens} matches the macro \cs{ovar@stackover@lens} by default, or
3596 % \cs{ovar@stackunder@lens} with \refKey{arrow under}.
3597 % \begin{macrocode}
3598 \def\ovar@stack@lens{\ovar@stackover@lens}
3599 % \end{macrocode}
3600 % \end{macro}
3601 % \end{macro}
3602 % \end{macro}
3603 %
3604 % \subsubsection{Macro for commands creation}
3605 %
3606 % \changes{v1.2}{2024/07/11}{Allow backslash in command name}
3607 % In the initial version, the commands names must be given as csname (without
3608 % backslash). To harmonize the syntax with standard \cs{NewDocumentCommand},
3609 % define an argument processor so that both
3610 % \cs{NewOverArrowCommand}|{\myarrow}| and
3611 % \cs{NewOverArrowCommand}|{myarrow}| are accepted.
3612 %
3613 % \begin{macrocode}
3614 \ExplSyntaxOn
3615 \cs_new_protected:Npn \__overarrows_processor_strip_escape_char:n #1
3616 {
3617 \regex_match:nnTF { ^\cC. } { #1 }
3618 { \tl_set:Nx \ProcessedArgument { \cs_to_str:N #1 } }
3619 { \tl_set:Nx \ProcessedArgument { #1 } }
3620 }
3621 \cs_new_eq:NN \ovar@cmdname@processor \__overarrows_processor_strip_escape_char:n
3622 \ExplSyntaxOff
3623 % \end{macrocode}
3624 %
3625 % \begin{macro}{\DeclareOverArrowCommand}
3626 % \begin{macrocode}
3627 \NewDocumentCommand{\DeclareOverArrowCommand}{
3628 O{symb} >{\ovar@cmdname@processor} m m
3629 }{%
3630 \begingroup
3631 \ovar@set@common
3632 \ifcsdef{ovar@set@#1}{%
3633 \csuse{ovar@set@#1}%
3634 }{%
3635 \PackageError{overarrows}{Unknown method #1}
3636 {Try with 'symb', 'tikz', 'pstriks' or 'picture'}%
3637 }%
3638 \ovar@set{#3}%
3639 \ifdef{\ovar@macro@arrow}{}{%
3640 \ovar@set{no arrow macro hook}%
3641 }%
3642 \ifdef{\ovar@macro@stack}{}{%
3643 \ovar@set{no stack macro hook}%
3644 }%
3645 \csxdef{ovar@#2@normal}{%
3646 \noexpand\mathpalette{%
3647 \expandonce{\ovar@macro@stack}{\expandonce{\ovar@macro@arrow}}%
3648 }%
3649 }%
3650 \csxdef{ovar@#2@starred}{%
3651 \noexpand\mathpalette{%
3652 \noexpand\ovar@starversion{%
3653 \expandonce{\ovar@macro@stack}{\expandonce{\ovar@macro@arrow}}%
3654 }%
3655 }%
3656 }%
3657 \ifovar@option@debug@
3658 \PackageInfo{overarrows}{%
3659 Meaning of \protect\ovar@#2@normal\MessageBreak
3660 used for \@backslashchar#2:\MessageBreak%
3661 \expandafter\meaning\csname ovar@#2@normal\endcsname}%
3662 \fi
3663 % \end{macrocode}
3664 % \changes{v1.4}{2025/04/30}{Make commmands robust}
3665 % Expand \cs{ifovar@detectsubscripts@} before closing the group, then define
3666 % the command.
3667 % \begin{macrocode}
3668 \expandafter%
3669 \endgroup%
3670 \ifovar@detectsubscripts@%
3671 \csgdef{ovar@#2@auto}##1{%
3672 % \end{macrocode}
3673 % \vspace{-2\smallskipamount}%^^A remove space between code blocks
3674 % \changes{v1.1}{2023/02/15}{Support for non-standard subscripts}
3675 % \begin{macrocode}
3676 \@ifnextchar \ovar@subcmd {%
3677 \csuse{ovar@#2@starred}{##1}%
3678 }{%
3679 \csuse{ovar@#2@normal}{##1}%
3680 }%
3681 }%
3682 \expandafter\DeclareDocumentCommand\csname #2\endcsname { s }{%
3683 \IfBooleanTF{##1}{\csuse{ovar@#2@starred}}{\csuse{ovar@#2@auto}}%
3684 }%
3685 \else
3686 \expandafter\DeclareDocumentCommand\csname #2\endcsname { s }{%
3687 \IfBooleanTF{##1}{\csuse{ovar@#2@starred}}{\csuse{ovar@#2@normal}}%
3688 }%
3689 \fi
3690 }
3691 % \end{macrocode}
3692 % \end{macro}
3693 %
3694 % \begin{macro}{\ProvideOverArrowCommand}
3695 % \begin{macrocode}
3696 \NewDocumentCommand{\ProvideOverArrowCommand}{
3697 O{symb} >{\ovar@cmdname@processor} m m
3698 }{%
3699 \ifcsdef{#2}{}{%
3700 \DeclareOverArrowCommand[#1]{#2}{#3}%
3701 }%
3702 }
3703 % \end{macrocode}
3704 % \end{macro}
3705 %
3706 % \begin{macro}{\NewOverArrowCommand}
3707 % \begin{macrocode}
3708 \NewDocumentCommand{\NewOverArrowCommand}{
3709 O{symb} >{\ovar@cmdname@processor} m m
3710 }{%
3711 \ifcsdef{#2}{%
3712 \PackageError{overarrows}{Command \csname #2\endcsname already defined}%
3713 {You have used \protect\NewOverArrowCommand\space with a command that
3714 already has a definition. \MessageBreak%
3715 Choose another name, or use instead \protect\DeclareOverArrowCommand.}%
3716 }{%
3717 \DeclareOverArrowCommand[#1]{#2}{#3}%
3718 }%
3719 }
3720 % \end{macrocode}
3721 % \end{macro}
3722 %
3723 % \begin{macro}{\RenewOverArrowCommand}
3724 % \begin{macrocode}
3725 \NewDocumentCommand{\RenewOverArrowCommand}{
3726 O{symb} >{\ovar@cmdname@processor} m m
3727 }{%
3728 \ifcsundef{#2}{%
3729 \PackageError{overarrows}{Command \csname #2\endcsname undefined}%
3730 {You have used \protect\RenewOverArrowCommand\space with a command that was
3731 never defined. \MessageBreak%
3732 Check the requested name, or use instead \protect\NewOverArrowCommand.}%
3733 }{%
3734 \DeclareOverArrowCommand[#1]{#2}{#3}%
3735 }%
3736 }
3737 % \end{macrocode}
3738 % \end{macro}
3739 %
3740 % \subsubsection{Starred variant}
3741 %
3742 % \changes{v1.2}{2024/07/11}{Use boxes in starred variant for better performances}
3743 % \begin{macro}{\ovar@starversion}
3744 % |#1|: definition (stack macro + arrow macro)\\
3745 % |#2|: math style\\
3746 % |#3|: content
3747 % \begin{macrocode}
3748 \newsavebox\ovar@tempbox
3749 \def\ovar@starversion#1#2#3{%
3750 \sbox{\ovar@tempbox}{$\m@th #1#2{#3}$}%
3751 \usebox{\ovar@tempbox}%
3752 % \end{macrocode}
3753 % Remove the extra space added by the arrow.
3754 % \begin{macrocode}
3755 \settowidth{\ovar@tempdim}{$\m@th #2{#3}$}%
3756 \kern\dimeval{0.5\ovar@tempdim - 0.5\wd\ovar@tempbox}%
3757 }
3758 % \end{macrocode}
3759 % \end{macro}
3760 %
3761 % \subsubsection{\cs{vv} vector command}
3762 %
3763 % \begin{macro}{\vv}
3764 % \begin{macro}{\esvectvv}
3765 % Backup and redefinition of \pkg{esvect} \refCom{vv} vector command.
3766 % \changes{v1.3}{2025/02/02}{Replace esvect conditionnal by the definition of
3767 % a control sequence}
3768 % \begin{macrocode}
3769 \ifdefined\ovar@option@esvect
3770 \let\esvectvv\vv
3771 \undef\vv
3772 % \end{macrocode}
3773 % \changes{v1.2}{2024/07/11}{Use \refKey{middle config}|=relbareda| instead of
3774 % \refKey{middle config}|=auto|}
3775 % \begin{macrocode}
3776 \NewOverArrowCommand{\vv}{esvect, middle config = relbareda}
3777 \fi
3778 % \end{macrocode}
3779 % \end{macro}
3780 % \end{macro}
3781 %
3782 % \subsubsection{Predefined commands}
3783 %
3784 % \changes{v1.2}{2024/07/11}{Declare predefined commands after \pkg{unicode-math} settings}
3785 % Declare predefined commands after \pkg{unicode-math} settings.
3786 %
3787 % \begin{macrocode}
3788 \AddToHook{begindocument}[overarrows]
3789 {%
3790 % \end{macrocode}
3791 %
3792 % \begin{macro}{\overrightarrow}
3793 % \begin{macrocode}
3794 \ifovar@option@overrightarrow@
3795 \DeclareOverArrowCommand{\overrightarrow}{%
3796 amsmath, middle config=relbar,
3797 end=\ovar@rightarrow,
3798 right arrow,
3799 }%
3800 \fi
3801 % \end{macrocode}
3802 % \end{macro}
3803 %
3804 % \begin{macro}{\underrightarrow}
3805 % \begin{macrocode}
3806 \ifovar@option@underrightarrow@
3807 \DeclareOverArrowCommand{\underrightarrow}{%
3808 amsmath, middle config=relbar,
3809 end=\ovar@rightarrow,
3810 right arrow,
3811 arrow under,
3812 }%
3813 \fi
3814 % \end{macrocode}
3815 % \end{macro}
3816 %
3817 % \begin{macro}{\overleftarrow}
3818 % \begin{macrocode}
3819 \ifovar@option@overleftarrow@
3820 \DeclareOverArrowCommand{\overleftarrow}{%
3821 amsmath, middle config=relbar,
3822 start=\ovar@leftarrow,
3823 end=\relbar,
3824 left arrow,
3825 }%
3826 \fi
3827 % \end{macrocode}
3828 % \end{macro}
3829 %
3830 % \begin{macro}{\underleftarrow}
3831 % \begin{macrocode}
3832 \ifovar@option@underleftarrow@
3833 \DeclareOverArrowCommand{\underleftarrow}{%
3834 amsmath, middle config=relbar,
3835 start=\ovar@leftarrow,
3836 end=\relbar,
3837 left arrow,
3838 arrow under,
3839 }%
3840 \fi
3841 % \end{macrocode}
3842 % \end{macro}
3843 %
3844 % \begin{macro}{\overleftrightarrow}
3845 % \begin{macrocode}
3846 \ifovar@option@overleftrightarrow@
3847 \DeclareOverArrowCommand{\overleftrightarrow}{%
3848 amsmath, middle config=relbar,
3849 start=\ovar@leftarrow,
3850 end=\ovar@rightarrow,
3851 center arrow,
3852 }%
3853 \fi
3854 % \end{macrocode}
3855 % \end{macro}
3856 %
3857 % \begin{macro}{\underleftrightarrow}
3858 % \begin{macrocode}
3859 \ifovar@option@underleftrightarrow@
3860 \DeclareOverArrowCommand{\underleftrightarrow}{%
3861 amsmath, middle config=relbar,
3862 start=\ovar@leftarrow,
3863 end=\ovar@rightarrow,
3864 center arrow,
3865 arrow under,
3866 }%
3867 \fi
3868 % \end{macrocode}
3869 % \end{macro}
3870 %
3871 % \begin{macro}{\overrightharpoonup}
3872 % \begin{macrocode}
3873 \ifovar@option@overrightharpoonup@
3874 \DeclareOverArrowCommand{\overrightharpoonup}{%
3875 amsmath, middle config=relbar,
3876 end=\rightharpoonup,
3877 right arrow,
3878 }%
3879 \fi
3880 % \end{macrocode}
3881 % \end{macro}
3882 %
3883 % \begin{macro}{\underrightharpoonup}
3884 % \begin{macrocode}
3885 \ifovar@option@underrightharpoonup@
3886 \DeclareOverArrowCommand{\underrightharpoonup}{%
3887 amsmath, middle config=relbar,
3888 end=\rightharpoonup,
3889 right arrow,
3890 arrow under,
3891 }%
3892 \fi
3893 % \end{macrocode}
3894 % \end{macro}
3895 %
3896 % \begin{macro}{\overrightharpoondown}
3897 % \begin{macrocode}
3898 \ifovar@option@overrightharpoondown@
3899 \DeclareOverArrowCommand{\overrightharpoondown}{%
3900 amsmath, middle config=relbar,
3901 end=\rightharpoondown,
3902 right arrow,
3903 }%
3904 \fi
3905 % \end{macrocode}
3906 % \end{macro}
3907 %
3908 % \begin{macro}{\underrightharpoondown}
3909 % \begin{macrocode}
3910 \ifovar@option@underrightharpoondown@
3911 \DeclareOverArrowCommand{\underrightharpoondown}{%
3912 amsmath, middle config=relbar,
3913 end=\rightharpoondown,
3914 right arrow,
3915 arrow under,
3916 }%
3917 \fi
3918 % \end{macrocode}
3919 % \end{macro}
3920 %
3921 % \begin{macro}{\overleftharpoonup}
3922 % \begin{macrocode}
3923 \ifovar@option@overleftharpoonup@
3924 \DeclareOverArrowCommand{\overleftharpoonup}{%
3925 amsmath, middle config=relbar,
3926 start=\leftharpoonup,
3927 end=\relbar,
3928 left arrow,
3929 }%
3930 \fi
3931 % \end{macrocode}
3932 % \end{macro}
3933 %
3934 % \begin{macro}{\underleftharpoonup}
3935 % \begin{macrocode}
3936 \ifovar@option@underleftharpoonup@
3937 \DeclareOverArrowCommand{\underleftharpoonup}{%
3938 amsmath, middle config=relbar,
3939 start=\leftharpoonup,
3940 end=\relbar,
3941 left arrow,
3942 arrow under,
3943 }%
3944 \fi
3945 % \end{macrocode}
3946 % \end{macro}
3947 %
3948 % \begin{macro}{\overleftharpoondown}
3949 % \begin{macrocode}
3950 \ifovar@option@overleftharpoondown@
3951 \DeclareOverArrowCommand{\overleftharpoondown}{%
3952 amsmath, middle config=relbar,
3953 start=\leftharpoondown,
3954 end=\relbar,
3955 left arrow,
3956 }%
3957 \fi
3958 % \end{macrocode}
3959 % \end{macro}
3960 %
3961 % \begin{macro}{\underleftharpoondown}
3962 % \begin{macrocode}
3963 \ifovar@option@underleftharpoondown@
3964 \DeclareOverArrowCommand{\underleftharpoondown}{%
3965 amsmath, middle config=relbar,
3966 start=\leftharpoondown,
3967 end=\relbar,
3968 left arrow,
3969 arrow under,
3970 }%
3971 \fi
3972 % \end{macrocode}
3973 % \end{macro}
3974 %
3975 % \begin{macro}{\overbar}
3976 % \changes{v1.5}{2025/10/19}{Redefine \refCom{overbar} so that it can be
3977 % properly nested.}
3978 %
3979 % \begin{macrocode}
3980 \ifovar@option@overbar@
3981 \DeclareOverArrowCommand{\overbar}{%
3982 amsmath, middle={\baselinebar},
3983 start={\baselinebar}, end={\baselinebar},
3984 space before arrow={0.5\overarrowthickness},
3985 space after arrow={3.5\overarrowthickness}
3986 }%
3987 \fi
3988 % \end{macrocode}
3989 % \end{macro}
3990 %
3991 % \begin{macro}{\underbar}
3992 % \changes{v1.5}{2025/10/19}{Redefine \refCom{underbar} so that it can be
3993 % properly nested.}
3994 %
3995 % \begin{macrocode}
3996 \ifovar@option@underbar@
3997 \DeclareOverArrowCommand{\underbar}{%
3998 amsmath, middle={\baselinebar},
3999 start={\baselinebar}, end={\baselinebar},
4000 arrow under=noconfig,
4001 space before arrow={3.5\overarrowthickness},
4002 space after arrow={0.5\overarrowthickness}
4003 }%
4004 \fi
4005 % \end{macrocode}
4006 % \end{macro}
4007 %
4008 % End of |\AddToHook{begindocument}| hook.
4009 % \begin{macrocode}
4010 }
4011 % \end{macrocode}
4012 %
4013 % \subsubsection{Test macros}
4014 %
4015 % \begin{macro}{\ovar@testmathstyles}
4016 % Tabular containing the output of a command for the four math styles and
4017 % different patterns.
4018 % \begin{macrocode}
4019 \newcommand{\ovar@testmathstyles}[2][]{%
4020 \begingroup
4021 \newcommand*{\ovar@row@teststyle}[1]{%
4022 $\displaystyle ##1$
4023 & $\textstyle ##1$
4024 & $\scriptstyle ##1$
4025 & $\scriptscriptstyle ##1$
4026 \\
4027 }%
4028 \renewcommand*{\arraystretch}{1.5}%
4029 \begin{tabular*}{0.95\linewidth}{@{\extracolsep{\fill}} cccc}
4030 \hline
4031 \footnotesize\texttt{\texttt{\textbackslash displaystyle}}
4032 & \footnotesize\texttt{\texttt{\textbackslash textstyle}}
4033 & \footnotesize\texttt{\texttt{\textbackslash scriptstyle}}
4034 & \footnotesize\texttt{\texttt{\textbackslash scriptscriptstyle}}
4035 \\
4036 \hline
4037 \ovar@row@teststyle{\csuse{#2}{v}}
4038 \ovar@row@teststyle{\csuse{#2}{AB}}
4039 \ovar@row@teststyle{\csuse{#2}{\mathrm{grad}}}
4040 \ovar@row@teststyle{\csuse{#2}{my~long~vector}}
4041 \IfValueT{#1}{\ovar@row@teststyle{\csuse{#2}{#1}}}
4042 \hline
4043 \end{tabular*}%
4044 \endgroup%
4045 }
4046 % \end{macrocode}
4047 % \end{macro}
4048 %
4049 % \changes{v1.1}{2023/02/15}{Support for non-standard subscripts}
4050 %
4051 % \begin{macro}{\ovar@testkerning}
4052 % \begin{macrocode}
4053 \begingroup
4054 \ifovar@option@subother@ \catcode `_=12 \fi
4055 \ifovar@option@subactive@ \catcode `_=13 \fi
4056 \gdef\ovar@testkerning#1{%
4057 \begin{displaymath}
4058 #1{t}_{#1{u}_{#1{v}}}
4059 \qquad
4060 #1{\imath}_0
4061 \qquad
4062 #1{v}
4063 = #1{v}_x + #1{v}_y + #1{v}_z
4064 = v_x #1{\imath} + v_y #1{\jmath} + v_z #1{k}
4065 \end{displaymath}%
4066 }
4067 \endgroup
4068 % \end{macrocode}
4069 % \end{macro}
4070 %
4071 % \begin{macro}{\TestOverArrow}
4072 % \begin{macrocode}
4073 \NewDocumentCommand{\TestOverArrow}{
4074 s o >{\ovar@cmdname@processor} m
4075 }{%
4076 \ifcsdef{#3}{}{%
4077 \PackageWarning{overarrows}{Unknown name '#3' passed to
4078 \protect\TestOverArrow}%
4079 }%
4080 \IfBooleanTF{#1}{%
4081 \noindent\framebox{%
4082 \begin{minipage}{0.95\linewidth}
4083 \centering
4084 \noindent\textbf{\large%
4085 Test of \texttt{\textbackslash#3} and \texttt{\textbackslash#3*} macros}
4086 \bigskip\par
4087 \textbf{\texttt{\textbackslash#3} for different math styles}
4088 \smallskip\par
4089 \ovar@testmathstyles[#2]{#3}%
4090 \bigskip\par
4091 \textbf{\texttt{\textbackslash#3} kerning}
4092 \ovar@testkerning{\csuse{#3}}
4093 \textbf{\texttt{\textbackslash#3*} kerning}
4094 \ovar@testkerning{\csuse{#3}*}
4095 \end{minipage}%
4096 }\bigskip\par
4097 }{%
4098 \ovar@testmathstyles[#2]{#3}%
4099 }%
4100 }
4101 % \end{macrocode}
4102 % \end{macro}
4103 %
4104 %\iffalse
4105 %</package> ^^A End of package implementation.
4106 %\fi
4107 %
4108 % \iffalse % ^^A The following is not for doc
4109 %
4110 %<*docstyle>
4111 %
4112 % \section*{overarrows-doc package}
4113 %
4114 % The following define some styles used for documentation and should not be
4115 % included in the documentation itself.
4116 %
4117 % \subsection*{Packages}
4118 %
4119 % \begin{macrocode}
4120 \RequirePackage{xcolor}
4121 \PassOptionsToPackage{hyperref}{xcolor}
4122 \RequirePackage[many]{tcolorbox}
4123 \tcbuselibrary{listings}
4124 \tcbuselibrary{documentation}
4125 \hypersetup{hidelinks}
4126 % \end{macrocode}
4127 %
4128 % \subsection*{Colors}
4129 %
4130 % \begin{macrocode}
4131 \definecolor{ovar_lavender}{rgb}{0.92,0.92,1}
4132 \definecolor{ovar_darkblue}{rgb}{0.1,0.2,0.5}
4133 \definecolor{ovar_darkgreen}{rgb}{0,0.39,0}
4134 \definecolor{ovar_beige}{rgb}{.96,.96,.86}
4135 \colorlet{ovar_commands}{ovar_darkblue}
4136 \colorlet{ovar_keys}{ovar_darkgreen}
4137 \colorlet{ovar_lengths}{violet}
4138 \colorlet{ovar_options}{Definition} % from tcolorbox documentation
4139 % \end{macrocode}
4140 %
4141 % \subsection*{listings styles}
4142 %
4143 % \begin{macrocode}
4144 \lstdefinestyle{lstovardoc}{%
4145 language = [LaTeX]TeX,
4146 columns = flexible,
4147 keepspaces = true,
4148 keywordstyle = {\bfseries\color{ovar_darkblue}},
4149 texcsstyle = *{\bfseries\color{ovar_darkblue}},
4150 commentstyle = {\color{gray}},
4151 identifierstyle = {\color{ovar_darkgreen}},
4152 morekeywords = {},% keywordsprefix needs a morekeywords before
4153 keywordsprefix = {\\},
4154 % \end{macrocode}
4155 % For literate, the extra braces around the replacement text avoid the error: "Argument of |lst@FillFixed@| has an extra \}."
4156 % \begin{macrocode}
4157 literate = *{\$}{{\textcolor{red}{\$}}}{1}
4158 {\&}{{\textcolor{red}{\&}}}{1}
4159 {\}}{{\textcolor{darkgray}{\}}}}{1}
4160 {\{}{{\textcolor{darkgray}{\{}}}{1}
4161 {\\\\}{{\textcolor{red}{\textbackslash\textbackslash}}}{2}
4162 % \begin{macrocode}
4163 % One \% and four spaces to remove extra lines added by \cs{macrocode}
4164 % \end{macrocode}
4165 {\%\ \ \ \ }{}0,
4166 basicstyle = \ttfamily\footnotesize,
4167 frame = none,
4168 framesep = 0pt,
4169 aboveskip = 0pt,
4170 belowskip = 0pt,
4171 }
4172 \lstdefinestyle{lstovarcode}{%
4173 style = lstovardoc,
4174 backgroundcolor = \color{ovar_beige},
4175 breakindent = 1cm,
4176 numbers = left,
4177 numberstyle = \scriptsize\ttfamily\color{gray},
4178 aboveskip = \smallskipamount,
4179 belowskip = \smallskipamount,
4180 }
4181 % \end{macrocode}
4182 %
4183 % \subsection*{tcolorbox}
4184 %
4185 % \begin{macrocode}
4186 \tcbset{% copied and adapted from tcolorbox.doc.s_main.sty
4187 documentation listing style=lstovardoc,%
4188 doc keypath=overarrows,
4189 size=small,%
4190 % verbatim ignore percent,
4191 %% styles
4192 docexample/.style={%
4193 bicolor jigsaw,
4194 before skip balanced=\medskipamount,
4195 after skip balanced=\medskipamount,
4196 fonttitle=\bfseries,
4197 fontlower=\normalfont,
4198 halign lower=center,
4199 colframe=ovar_darkblue,
4200 colback=ovar_lavender,
4201 colbacklower=white,
4202 drop fuzzy shadow,
4203 },
4204 color key=ovar_keys,
4205 color command=ovar_commands,
4206 color length=ovar_lengths,
4207 doc head key={fontlower=\footnotesize, collower=darkgray},
4208 before doc body={\parskip=\smallskipamount},
4209 }
4210 % \end{macrocode}
4211 %
4212 % \subsection*{Index}
4213 %
4214 % To deal with internal macros, use '=' as index actual, in place of '@'.
4215 % \begin{macrocode}
4216 \begin{filecontents*}{\jobname.mst}
4217 actual '='
4218 \end{filecontents*}
4219 \tcbset{%
4220 index actual={=},
4221 index colorize=true,
4222 index gather all,
4223 index format=pgfsection,
4224 }
4225 % \end{macrocode}
4226 % Redefine \cs{tcb@doc@index@pgfsection} to add prologue (adapted from
4227 % tcbdocumentation.code.tex).
4228 % \begin{macrocode}
4229 \def\tcb@doc@index@pgfsection{%
4230 \def\index@prologue{%
4231 \section*{\kvtcb@text@index}\addcontentsline{toc}{section}{\kvtcb@text@index}
4232 {\small%
4233 Entries listed in the categories ``commands", ``lengths", and
4234 ``internal macros" also include references to package implementation. }
4235 \bigskip\par\noindent%
4236 }%
4237 \tcb@doc@index@pgf@%
4238 }
4239 % \end{macrocode}
4240 % Unset |\lst@UM| before indexing, to deals with comma (avoid |\unhbox \voidb@x
4241 % \kern \z@| in index file, see: \url{https://tex.stackexchange.com/a/510108}).
4242 % \begin{macrocode}
4243 \newcommand{\indexmacro}[1]{%
4244 \begingroup
4245 \let\lst@UM\@empty%
4246 \index{{Commands!#1=\tcbIndexPrintComC {#1}}}%
4247 \endgroup
4248 }
4249 \newcommand{\indexmacrointernal}[1]{%
4250 \begingroup
4251 \let\lst@UM\@empty%
4252 \index{{Internal macros!#1=\tcbIndexPrintComC {#1}}}%
4253 \endgroup
4254 }
4255 \newcommand{\indexlength}[1]{%
4256 \begingroup
4257 \let\lst@UM\@empty%
4258 \index{{Lengths!#1=\tcbIndexPrintLenC {#1}}}%
4259 \endgroup
4260 }
4261 % \end{macrocode}
4262 %
4263 % \subsection*{Redefinition of macrocode environment}
4264 %
4265 % \begin{macrocode}
4266 \let\macrocode\relax
4267 \lstnewenvironment{macrocode}{%
4268 \lstset{%
4269 name=macrocode,
4270 firstnumber=auto,
4271 style = lstovarcode,
4272 showlines = false,
4273 % \end{macrocode}
4274 % Commands and lengths identification and indexing
4275 %
4276 % Note: index works badly with inherited styles. It seems that "texcs" and
4277 % "index" keys should be set together.
4278 % \begin{macrocode}
4279 texcs = [2]{% commands
4280 DeclareOverArrowCommand, ProvideOverArrowCommand,%
4281 NewOverArrowCommand, RenewOverArrowCommand,%
4282 TestOverArrow, xjoinrel, smallermathstyle, arrowmathstyle, baselinebar,%
4283 esvectvv, vv,%
4284 overrightarrow, overleftarrow, overleftrightarrow, overrightharpoonup,%
4285 overrightharpoondown, overleftharpoonup, overleftharpoondown, overbar,%
4286 underrightarrow, underleftarrow, underleftrightarrow, underrightharpoonup,%
4287 underrightharpoondown, underleftharpoonup, underleftharpoondown, underbar,%
4288 SetOverArrowsMethod, SetOverArrowsSubscriptCommand,%
4289 },
4290 index = [2][texcs2],%
4291 indexstyle = [2]\indexmacro,%
4292 texcs = [3]{% lengths
4293 overarrowlength, overarrowthickness, overarrowsmallerthickness,%
4294 },
4295 index = [3][texcs3],%
4296 indexstyle = [3]\indexlength,%
4297 % \end{macrocode}
4298 % Internal macros identification and indexing
4299 % \begin{macrocode}
4300 texcs = [4]{% internal macros
4301 ovar@rightarrow, ovar@leftarrow, ifovar@option@oldarrows@,
4302 ovar@option@esvect, ifovar@option@tikz@, ifovar@option@pstricks@,
4303 ifovar@option@pstarrows@, ifovar@detectsubscripts@,
4304 ifovar@option@subother@, ifovar@option@subactive@, ifovar@option@debug@,
4305 ifovar@option@overrightarrow@, ifovar@option@underrightarrow@,
4306 ifovar@option@overleftarrow@, ifovar@option@underleftarrow@,
4307 ifovar@option@overleftrightarrow@, ifovar@option@underleftrightarrow@,
4308 ifovar@option@overrightharpoonup@, ifovar@option@underrightharpoonup@,
4309 ifovar@option@overrightharpoondown@, ifovar@option@underrightharpoondown@,
4310 ifovar@option@overleftharpoonup@, ifovar@option@underleftharpoonup@,
4311 ifovar@option@overleftharpoondown@, ifovar@option@underleftharpoondown@,
4312 ifovar@option@overbar@, ifovar@option@underbar@, ovar@auto@middle,
4313 ovar@auto@trim@middle, ovar@subcmd, ovar@set, ovar@length@min,
4314 ovar@before@arrow, ovar@after@arrow, ovar@macro@stack, ovar@macro@arrow,
4315 ovar@shift@left, ovar@shift@right, ovar@stack@fill, ovar@stackunder@fill,
4316 ovar@stack@lens, ovar@stackunder@lens, ovar@macro@arrowfill,
4317 ovar@arrow@fill, ovar@arrow@start, ovar@trim@start, ovar@trim@middle,
4318 ovar@arrow@middle, ovar@trim@end, ovar@arrow@end, ovar@tikz@command,
4319 ovar@tikz@pathoptions, ovar@tikz@path, ovar@tikz@options,
4320 ovar@pstricks@geometry, ovar@pstricks@linethickness, ovar@pstricks@psset,
4321 ovar@pstricks@command, ovar@picture@geometry, ovar@picture@linethickness,
4322 ovar@picture@command, ovar@tempdim, ovar@set@arrowlength,
4323 ovar@set@arrowthickness, ovar@set@arrowthickness@UM@lua,
4324 ovar@rulethickness@fontdimen, ovar@rulethickness@family, ovar@stackover@@,
4325 ovar@stackunder@@, ovar@stackover@, ovar@stackunder@, ovar@stackover@fill,
4326 ovar@stackover@lens, ovar@cmdname@processor, ovar@set@common,
4327 ovar@starversion, ovar@tempbox, ovar@testmathstyles, ovar@row@teststyle,
4328 ovar@testkerning,%
4329 ovar@save@mathstyle, ovar@bar,%
4330 },
4331 index = [4][texcs4],%
4332 indexstyle = [4]\indexmacrointernal,%
4333 % \end{macrocode}
4334 % Other macros identification
4335 % \begin{macrocode}
4336 moretexcs = [5]{% other macros
4337 relbar, Relbar, relbareda, relbaredd, harrowextender, rightarrow,
4338 Rightarrow, varleftarrow, varrightarrow, twoheadrightarrow,%
4339 },
4340 % \end{macrocode}
4341 % Il would be nice to also index keys, but spaces are badly handled by
4342 % \pkg{listings}.
4343 % \begin{macrocode}
4344 %^^A morekeywords = [2]{%
4345 %^^A overarrows, no stack macro hook, stack macro, detect subscripts, arrow
4346 %^^A macro, no arrow macro hook, min length, before arrow, after arrow, space
4347 %^^A before arrow, space after arrow, shift left, shift right, shift leftright,
4348 %^^A center arrow, left arrow, right arrow, arrow under, arrow under/noconfig,
4349 %^^A arrow under/autoconfig, fill macro, start, middle, end, trim start, trim
4350 %^^A middle, trim end, trim, no trimming, middle config, middle config/relbar,
4351 %^^A middle config/relbareda, middle config/harrowextender, middle config/auto,
4352 %^^A amsmath, amsmath/mimic, amsmath/strict, esvect, esvect/mimic,
4353 %^^A esvect/strict, tikz command, tikz options, path options, path, add path
4354 %^^A options, add tikz options, arrows, line thickness, thinner, pstricks
4355 %^^A command, psset, geometry, arrow, picture command,%
4356 %^^A },
4357 %^^A index = [3][keywords2],%
4358 %^^A indexstyle = [3]\lstindexmacro,%
4359 }
4360 % \end{macrocode}
4361 % Save and restore the line number (not done by environments defined with
4362 % |\lstnewenvironment|, see \url{https://tex.stackexchange.com/a/95048}):
4363 % \begin{macrocode}
4364 \csname\@lst @SetFirstNumber\endcsname
4365 }{%
4366 \csname \@lst @SaveFirstNumber\endcsname
4367 }
4368 % \end{macrocode}
4369 %
4370 % \subsection*{Redefinition of macro environment}
4371 %
4372 % \begin{macrocode}
4373 \DeclareDocumentEnvironment{macro}{m}{%
4374 % \end{macrocode}
4375 % Extraction of macro name. Save/restore current \cs{escapechar} in \cs{count@}.
4376 % \begin{macrocode}
4377 \count@\escapechar \escapechar=-1
4378 \edef\macroname{\string#1}
4379 \escapechar\count@
4380 \marginpar{%
4381 \parbox{0.88\linewidth}{%
4382 \scriptsize\flushright\ifcsdef{r@com:\macroname}{\refCom*{\macroname}}{\cs{\macroname}}%
4383 }%
4384 }
4385 }{% end of macro environment
4386 }
4387 % \end{macrocode}
4388 %
4389 % \subsection*{Documentation styles}
4390 %
4391 % \subsubsection*{Tool for references}
4392 %
4393 % \begin{macrocode}
4394 \def\refDoc#1{\tcb@ref@doc{#1}}
4395 % \end{macrocode}
4396 %
4397 % \subsubsection*{Package name}
4398 %
4399 % \begin{macrocode}
4400 \newcommand{\pkg}[1]{\textsf{#1}}
4401 % \end{macrocode}
4402 %
4403 % \subsubsection*{Package options}
4404 %
4405 % Definition of docOption environment to document package options, like keys.
4406 % \begin{macrocode}
4407 \newrobustcmd{\tcbIndexPrintOptionCA}[1]{% adapted from \tcbIndexPrintKeyCA
4408 \tcb@Index@Print@CA{#1}{ovar_options}{package option}%
4409 }
4410 \newrobustcmd{\tcbIndexPrintOptionC}[1]{% adapted from \tcbIndexPrintKeyCA
4411 \tcb@Index@Print@C{#1}{ovar_options}%
4412 }
4413 \DeclareDocumentEnvironment{docOption}{ O{} m }{%
4414 \begin{docKey*}[]
4415 [doc name={#2}, doc label={opt:#2}, color key=ovar_options, #1]
4416 {#2}{}{}%
4417 \kvtcb@index@command{%
4418 \kvtcb@doc@sortindex\idx@actual\tcbIndexPrintOptionCA{#2}%
4419 }%
4420 \kvtcb@index@command{%
4421 {Package options}\idx@level\kvtcb@doc@sortindex\idx@actual%
4422 \tcbIndexPrintOptionC{#2}%
4423 }%
4424 }{%
4425 \end{docKey*}%
4426 }
4427 \def\refOpt{\refDoc{key:opt}}
4428 % \end{macrocode}
4429 %
4430 % \subsubsection*{Lengths}
4431 %
4432 % Definition of docLength environment to document lengths, like commands.
4433 % \begin{macrocode}
4434 \let\tcbdocLength\docLength% save original definition
4435 \DeclareDocumentEnvironment{docLength}{ O{} m }{%
4436 \begin{docCommand*}[doc name=#2, color command=ovar_lengths,#1]{#2}{}
4437 \protected@edef\@currentlabel{\cs{#2}}%
4438 \label{len:#2}%
4439 %% add length index entry (from \docLength original definition)
4440 \kvtcb@index@command{%
4441 \kvtcb@doc@sortindex\idx@actual\tcbIndexPrintLenCA{\kvtcb@doc@index}%
4442 }%
4443 \kvtcb@index@command{%
4444 \kvtcb@text@lengths\idx@level\kvtcb@doc@sortindex\idx@actual%
4445 \tcbIndexPrintLenC{\kvtcb@doc@index}%
4446 }%
4447 }{%
4448 \end{docCommand*}%
4449 }
4450 \def\refLen{\refDoc{len}}
4451 % \end{macrocode}
4452 %
4453 %</docstyle>
4454 %
4455 % \fi ^^A end of \iffalse
4456 %
4457 % \Finale
4458 %
4459 \endinput